http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60681
Ian Lance Taylor <ian at airs dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ian at airs dot com --- Comment #1 from Ian Lance Taylor <ian at airs dot com> --- I don't think there is anything useful that the libbacktrace library can do. When running under an emulator, opening /proc/self/exe should open the program being emulated. It shouldn't open the emulator itself. The libbacktrace library does permit the program to provide the name of the executable file. For the case of GCC in particular, we could modify it so that it passes argv[0] to backtrace_create_state in diagnostic_action_after_output in gcc/diagnostic.c. I didn't do that already because GCC does not currently record the unmodified argv[0] anywhere, and there are several different places that would need to be modified. I don't know that it's worth it for such an odd use case. But I wouldn't block such a patch if someone else writes it. And, of course, modifying GCC itself would not fix your problem since as far as I can tell you aren't running GCC anyhow. What program are you running? Can you arrange for it to pass argv[0] to backtrace_create_state? On GNU/Linux the libbacktrace library could try to get the executable name from /proc/self/cmdline, but I'm guessing that under QEMU that would give you the wrong answer just as /proc/self/exe does.