RFA: [dwarf2read.c] Avoid using section index if not yet set

Fernando Nasser fnasser@redhat.com
Fri May 11 00:13:00 GMT 2001


This fix was suggested to me by someone that loads symbols from object
files.  It seems that in this situation the section index may not be set
and this bit of code tries to use it.

I this fix correct?  Can I check it in?

Thanks.

Fernando



	* dwarf2read.c (new_symbol): Do not attempt to use the section
	index of a symbol if it is not yet set.



Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.24
diff -c -p -r1.24 dwarf2read.c
*** dwarf2read.c	2001/04/30 10:30:27	1.24
--- dwarf2read.c	2001/05/10 23:06:28
*************** new_symbol (struct die_info *die, struct
*** 4195,4203 ****
  		  if (SYMBOL_VALUE_ADDRESS (sym))
  		    {
  		      fixup_symbol_section (sym, objfile);
! 		      SYMBOL_VALUE_ADDRESS (sym) +=
! 			ANOFFSET (objfile->section_offsets,
! 			          SYMBOL_SECTION (sym));
  		      SYMBOL_CLASS (sym) = LOC_STATIC;
  		    }
  		  else
--- 4195,4204 ----
  		  if (SYMBOL_VALUE_ADDRESS (sym))
  		    {
  		      fixup_symbol_section (sym, objfile);
!                       if (SYMBOL_SECTION (sym) != -1)
! 		        SYMBOL_VALUE_ADDRESS (sym) +=
! 		  	  ANOFFSET (objfile->section_offsets,
! 				    SYMBOL_SECTION (sym));
  		      SYMBOL_CLASS (sym) = LOC_STATIC;
  		    }
  		  else
                                                                               
-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9



More information about the Gdb-patches mailing list