The following stack shows backtrace () requiring malloc () when initializing. This makes writing memory tools slightly problematic. In the example, the code deadlocks in my malloc () during initialization:
#0 malloc (size=28) at example.cpp:17 #1 0x006821d8 in _dl_map_object_deps () from /lib/ld-linux.so.2 #2 0x00791159 in dl_open_worker () from /lib/tls/libc.so.6 #3 0x006830fe in _dl_catch_error () from /lib/ld-linux.so.2 #4 0x00791cb8 in _dl_open () from /lib/tls/libc.so.6 #5 0x0079304d in do_dlopen () from /lib/tls/libc.so.6 #6 0x006830fe in _dl_catch_error () from /lib/ld-linux.so.2 #7 0x0079312e in __libc_dlopen_mode () from /lib/tls/libc.so.6 #8 0x0076fdfa in init () from /lib/tls/libc.so.6 #9 0x0091dc8b in pthread_once () from /lib/tls/libpthread.so.0 #10 0x007700f9 in backtrace () from /lib/tls/libc.so.6 #11 0x080486ff in malloc (size=4) at example.cpp:29 #12 0x080487fc in main () at example.cpp:55 This appears to be an issue in newer versions (~3.4.6 and above). Older versions do not appear to initialize in this manner (tested with 3.2.3). -- Summary: backtrace () requires malloc () during initialization Product: gcc Version: 3.4.6 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: stephenc at cisco dot com GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34129