Re: GDB 7.7 crashes on LTO-built executable

Tom Tromey
2014-02-12T19:22:26Z

>> Is there a better way than saying "unknown" when s->debugformat is
>> NULL?

Eli> A better way to fix the crash, I mean.

I looked a tiny bit.

I don't know what code path hits this, but basically something is not
calling record_debugformat when it ought to. So one way to fix the bug
would be to track down what this is. I would probably start by finding
where the symtab in question was allocated.

The current design seems fragile in that it requires sprinkling these
calls to record_debugformat all around.

I did find this comment in buildsym.c:

/* Save the debug format string (if any) in the symtab. */
symtab->debugformat = subfile->debugformat;

And it does seem that nothing tries to ensure that a subfile's
debugformat is set. So perhaps fixing it at the printf site is fine; or
alternatively changing the field's initialization in start_subfile.
Though it seems better to try to fix the value properly; since "unknown"
can't ever really be correct -- it it's unknown one wonders how gdb
could have read it :)

Tom