Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Crash in write_exp_msymbol for coff targets.
@ 2006-11-16 20:53 Pedro Alves
  2006-11-16 21:02 ` Daniel Jacobowitz
  2006-11-18 23:54 ` Daniel Jacobowitz
  0 siblings, 2 replies; 12+ messages in thread
From: Pedro Alves @ 2006-11-16 20:53 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 884 bytes --]

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.


[-- Attachment #2: nodeb.diff --]
[-- Type: text/plain, Size: 457 bytes --]

--- parse.c.org	2006-11-16 20:37:10.000000000 +0000
+++ parse.c	2006-11-16 00:19:52.000000000 +0000
@@ -408,7 +408,8 @@ write_exp_msymbol (struct minimal_symbol
 
   write_exp_elt_opcode (OP_LONG);
 
-  if (SYMBOL_BFD_SECTION (msymbol)->flags & SEC_THREAD_LOCAL)
+  if (SYMBOL_BFD_SECTION (msymbol)
+      && (SYMBOL_BFD_SECTION (msymbol)->flags & SEC_THREAD_LOCAL))
     {
       bfd *bfd = SYMBOL_BFD_SECTION (msymbol)->owner;
       struct objfile *ofp;

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2006-11-28 17:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-16 20:53 Crash in write_exp_msymbol for coff targets Pedro Alves
2006-11-16 21:02 ` Daniel Jacobowitz
2006-11-16 23:40   ` Pedro Alves
2006-11-16 23:59     ` Daniel Jacobowitz
2006-11-17  0:47       ` Pedro Alves
2006-11-17  1:14         ` Pedro Alves
2006-11-18  1:15           ` Pedro Alves
2006-11-18 23:50           ` Daniel Jacobowitz
2006-11-19  4:05             ` Pedro Alves
2006-11-28 17:07               ` Daniel Jacobowitz
2006-11-18 23:54 ` Daniel Jacobowitz
2006-11-22  0:06   ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox