[ECOS] Re: uSTL hello world

John Dallaway john@dallaway.org.uk
Tue Sep 8 15:59:00 GMT 2009


Hi Uwe

Uwe Kindler wrote:

> 
>> Back to the original problem. It may be easiest to drill down into the
>> cout call hierarchy under debug and compare with the equivalent call
>> stack from a working application in order to narrow the problem search
>> space.
>>
>> John Dallaway
> 
> O.k. - I did this and here are my results.
> 
> In both situations (reference to printf exists and no reference to
> printf exists in main.cpp) the call cout << "Hello world!\n" brings us
> into the function readwritev() in fileio/io.cxx. In this file the lines
> 105 - 108 makes the difference:
> 
>     fp = cyg_fp_get( fd );
> 
>     if( fp == NULL )
>         FILEIO_RETURN(EBADF);
> 
> If a printf call is present in main.cpp then cyg_fp_get() returns a
> valid file pointer. If no printf call is present in main.cpp the
> cyg_fp_get() returns 0 and the function returns with EBADF.
> 
> Here are the local variables in readwritev() with printf:
> 
> fd    0x1   
> _iov    0xa0140948   
> iov_len    0x1   
> direction    0x2   
> cnt    0xd   
> len    0xd   
> ret    0x11110008   
> _idx    0x1   
> fp    0xa0140d90   
> iov    0xa014086c   
> uio    {...}   
> op    0xa014095c
> 
> and here are the locals in readwritev() without printf in main:
> 
> fd    0x1   
> _iov    0xa013d5e8   
> iov_len    0x1   
> direction    0x2   
> cnt    0x11110006   
> len    0xd   
> ret    0x11110008   
> _idx    0x1   
> fp    0x00000000   
> iov    0xa013d50c   
> uio    {...}   
> op    0xa013d5fc
> 
> Any idea what is going wrong here before I dig even more deeper?

The file descriptor (fd) is unchanged between working and non-working
code which suggests that the relevant descriptor table entry is not
being initialised. Try planting breakpoints at cyg_fd_assign() and
cyg_fd_alloc(). I expect these will be called in the case where cout is
working and the call stack may provide a clue as to what is triggering
the correct behaviour.

John Dallaway

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list