GDB 7.7 crashes on LTO-built executable

Eli Zaretskii
2014-02-12T17:37:18Z

I compiled a simple test program with -flto using MinGW GCC 4.7.2, and
tried to debug it with GDB 7.7. However, "info source" crashed with
SIGSEGV. It turns out that source_info was trying to output this
line:

printf_filtered (_("Compiled with %s debugging format.\n"), s->debugformat);

and s->debugformat was a NULL pointer.

Looking around, it sounds like when GDB iterates over objfiles, it
gets a weird file name, something like $TMPDIR/ccN8FPgQ.ltrans0.o,
instead of the expected name of the (single) object file name for this
program. The real objfile then ends up with a NULL pointer instead of
its debugformat field.

Is this expected with LTO programs? Is there a better way than saying
"unknown" when s->debugformat is NULL?

TIA