[ECOS] assertion error in stdio
James Kahkoska
jkahkoska@wire-less-inc.com
Mon Jul 10 14:22:00 GMT 2000
I am having a problem with eCos when I turn on
asserts in eCos. I thought everything I/O related was working ok but when I
turn on assertions, I get the following assertion error:
ÃÂ
ASSERT FAIL:
stream.cxxÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ [ÃÂ 79]
Cyg_StdioStream::Cyg_StdioStream() Attempt to open invalid
device!
ÃÂ
The call stack looks
like hal_misc.c\cyg_hal_invoke_constructors() Line #92 (0x0001C930) ÃÂ
stdout.cxx\global constructors keyed to 50000.cyg_libc_stdio_stdout() Line #90
(0x00020240) ÃÂ ÃÂ ÃÂ
stdiofiles.inl\__static_initialization_and_destruction_0() Line #83
(0x000200DC) ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ
stream.cxx\Cyg_StdioStream::Cyg_StdioStream(void *, Cyg_StdioStream::OpenMode,
bool, bool, int, unsigned int, unsigned char *)() Line #82
(0x00020328) ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ
buffer.cxx\cyg_assert_fail() Line #741 (0x0001DE84)
ÃÂ
It appears the Cyg_StdioStream::Cyg_StdioStream
contructor is being passed a NULL for the device and the assertion catches
that. I went further into the code and this originates in stdout.cxx
cyg_libc_stdio_stdout() Line #90
ÃÂ
ÃÂ // And here's an instance of the class just
to make the code run ÃÂ static cyg_libc_dummy_stdout_init_class
cyg_libc_dummy_stdout_init ÃÂ ÃÂ
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ
CYG_INIT_PRIORITY(LIBC)
ÃÂ
The constructor ends up calling callingÃÂ
ÃÂ
ÃÂ Cyg_libc_stdio_files::set_file_stream( fd_t
fd, Cyg_StdioStream *stream )
ÃÂ
which invokes the
Cyg_StdioStream::Cyg_StdioStream(cyg_io_handle_t dev, constructor with a null
device. ÃÂ ÃÂ ÃÂ CYG_CHECK_DATA_PTR(dev, "Attempt to open
invalid device!");
ÃÂ
Without asserts enabled my printf's to stdout seem
to work fine. I am not sure about this dummy class and single static instance
that causes the assertion to fail. The comment is my only clue to it's
existence:
ÃÂ
// This is a dummy class just so we can execute
arbitrary code when // stdout is requested
ÃÂ
Any ideas as to why I need this dummy class or why
it might be blowing up?
ÃÂ
Thanks, James
ÃÂ
ÃÂ
James Kahkoska jkahkoska@wire-less-inc.com 719-528-8885
x104
More information about the Ecos-discuss
mailing list