Crash in write_exp_msymbol for coff targets.

Pedro Alves pedro_alves@portugalmail.pt
Thu Nov 16 20:53:00 GMT 2006


Hi all,

The TLS without debugging info support introduced a bug for coff based 
targets.
While printing for example a global symbol's value I am getting a 
segfault in parse.c:write_exp_msymbol,
at:
  if (SYMBOL_BFD_SECTION (msymbol)->flags & SEC_THREAD_LOCAL)

The problem is that minimal symbols may not have a bfd section set.

The attached patch fixes it, but is it correct?
I see in coffread.c, that prim_record_minimal_symbol_and_info is always 
called with a NULL
bfd section, whilst in elfread.c, is is not. Is this a limitation of the 
coff format? Should coffread.c
be fixed instead?

I caught this while running the testsuite for the arm-wince gdbserver 
port I am working on.

Cheers,
Pedro Alves

---

2006-11-16  Pedro Alves  <pedro_alves@portugalmail.pt>

    * parse.c (write_exp_msymbol): Check if SYMBOL_BFD_SECTION (msymbol) 
is NULL
    before dereferencing it.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nodeb.diff
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20061116/798e6891/attachment.ksh>


More information about the Gdb-patches mailing list