Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

_IO_wide_data_2: what's this?

Tags:

c++

c

debugging

gdb

I'm working on an embedded platform (architecture is SH4), and my program crashed a few minutes ago with a SIGABRT.

Luckily, I was running under gdbserver, and the thread that was interrupted by this signal has this stack dump:

#0  0x2a7f1678 in raise () from /home/[user]/target/lib/libc.so.6
#1  0x2a7f2a4c in abort () from /home/[user]/target/lib/libc.so.6
#2  0x2a81ade0 in __libc_message () from /home/[user]/target/lib/libc.so.6
#3  0x2a81f3a8 in malloc_printerr () from /home/[user]/target/lib/libc.so.6
#4  0x2a8c3700 in _IO_wide_data_2 () from /home/[user]/target/lib/libc.so.6

Do you know what happened here? A bad free()? bad delete ? bad malloc? What's "_IO_wide_data_2" supposed to do? I see the malloc_printerr() call that I don't understand either.

Google gives me 234 results on this, but all of them are simply because the guys have that "function" in their backtrace.

like image 338
Gui13 Avatar asked Feb 20 '23 18:02

Gui13


1 Answers

It is a stream to stderr for wide character support.

You can break it down into various parts:

  • _IO : Input/Output.
  • wide_data : Wide data
  • 2 : stderr

You also have;

_IO_wide_data_0 : stdin _IO_wide_data_1 : stdout

They are chained as 2->1->0.

malloc_printerr() is used to print various error messages when there is something bad happening/caught in dynamic memory management. But your trace looks capped (have you removed anything?).

It could be a write to stderr where you try to write something not in memory, in corrupted memory, in …

Or it could be lower stack point causing write to stderr.

Or …

like image 98
Morpfh Avatar answered Mar 04 '23 12:03

Morpfh