This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: handle executables with .bss but no .data


This is a fix for symtab/1241.

http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=1241

2003-07-10  Jim Blandy  <jimb@redhat.com>

	* Makefile.in (dbxread.o): Note new dependency on $(gdb_assert_h).
	* dbxread.c: #include "gdb_assert.h".
	(read_dbx_symtab): If the objfile has no .data section, use the
	section index for the .bss section instead.

Index: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.403
diff -c -r1.403 Makefile.in
*** gdb/Makefile.in	13 Jun 2003 15:28:29 -0000	1.403
--- gdb/Makefile.in	18 Jun 2003 06:18:15 -0000
***************
*** 1661,1667 ****
  	$(gdb_stat_h) $(symtab_h) $(breakpoint_h) $(target_h) $(gdbcore_h) \
  	$(libaout_h) $(symfile_h) $(objfiles_h) $(buildsym_h) $(stabsread_h) \
  	$(gdb_stabs_h) $(demangle_h) $(language_h) $(complaints_h) \
! 	$(cp_abi_h) $(aout_aout64_h) $(aout_stab_gnu_h)
  dcache.o: dcache.c $(defs_h) $(dcache_h) $(gdbcmd_h) $(gdb_string_h) \
  	$(gdbcore_h) $(target_h)
  delta68-nat.o: delta68-nat.c $(defs_h)
--- 1661,1667 ----
  	$(gdb_stat_h) $(symtab_h) $(breakpoint_h) $(target_h) $(gdbcore_h) \
  	$(libaout_h) $(symfile_h) $(objfiles_h) $(buildsym_h) $(stabsread_h) \
  	$(gdb_stabs_h) $(demangle_h) $(language_h) $(complaints_h) \
! 	$(cp_abi_h) $(aout_aout64_h) $(aout_stab_gnu_h) $(gdb_assert_h)
  dcache.o: dcache.c $(defs_h) $(dcache_h) $(gdbcmd_h) $(gdb_string_h) \
  	$(gdbcore_h) $(target_h)
  delta68-nat.o: delta68-nat.c $(defs_h)
Index: gdb/dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.48
diff -c -r1.48 dbxread.c
*** gdb/dbxread.c	11 Jun 2003 22:27:10 -0000	1.48
--- gdb/dbxread.c	18 Jun 2003 06:18:17 -0000
***************
*** 58,63 ****
--- 58,64 ----
  #include "language.h"		/* Needed for local_hex_string */
  #include "complaints.h"
  #include "cp-abi.h"
+ #include "gdb_assert.h"
  
  #include "aout/aout64.h"
  #include "aout/stab_gnu.h"	/* We always use GNU stabs, not native, now */
***************
*** 1304,1309 ****
--- 1305,1311 ----
    struct cleanup *back_to;
    bfd *abfd;
    int textlow_not_set;
+   int data_sect_index;
  
    /* Current partial symtab */
    struct partial_symtab *pst;
***************
*** 1355,1360 ****
--- 1357,1368 ----
    textlow_not_set = 1;
    has_line_numbers = 0;
  
+   /* If the objfile has no .data section, try using the .bss section.  */
+   data_sect_index = objfile->sect_index_data;
+   if (data_sect_index == -1)
+     data_sect_index = SECT_OFF_BSS (objfile);
+   gdb_assert (data_sect_index != -1);
+ 
    for (symnum = 0; symnum < DBX_SYMCOUNT (objfile); symnum++)
      {
        /* Get the symbol for this run and pull out some info */
***************
*** 1401,1407 ****
  
  	  case N_DATA | N_EXT:
  	  case N_NBDATA | N_EXT:
! 	  nlist.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
  	  goto record_it;
  
  	  case N_BSS:
--- 1409,1415 ----
  
  	  case N_DATA | N_EXT:
  	  case N_NBDATA | N_EXT:
! 	  nlist.n_value += ANOFFSET (objfile->section_offsets, data_sect_index);
  	  goto record_it;
  
  	  case N_BSS:
***************
*** 1468,1474 ****
  	  continue;
  
  	  case N_DATA:
! 	  nlist.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
  	  goto record_it;
  
  	  case N_UNDF | N_EXT:
--- 1476,1482 ----
  	  continue;
  
  	  case N_DATA:
! 	  nlist.n_value += ANOFFSET (objfile->section_offsets, data_sect_index);
  	  goto record_it;
  
  	  case N_UNDF | N_EXT:
***************
*** 1757,1763 ****
  	  switch (p[1])
  	  {
  	  case 'S':
! 	    nlist.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
  #ifdef STATIC_TRANSFORM_NAME
  	    namestring = STATIC_TRANSFORM_NAME (namestring);
  #endif
--- 1765,1771 ----
  	  switch (p[1])
  	  {
  	  case 'S':
! 	    nlist.n_value += ANOFFSET (objfile->section_offsets, data_sect_index);
  #ifdef STATIC_TRANSFORM_NAME
  	    namestring = STATIC_TRANSFORM_NAME (namestring);
  #endif
***************
*** 1768,1774 ****
  				 psymtab_language, objfile);
  	    continue;
  	  case 'G':
! 	    nlist.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
  	    /* The addresses in these entries are reported to be
  	       wrong.  See the code that reads 'G's for symtabs. */
  	    add_psymbol_to_list (namestring, p - namestring,
--- 1776,1782 ----
  				 psymtab_language, objfile);
  	    continue;
  	  case 'G':
! 	    nlist.n_value += ANOFFSET (objfile->section_offsets, data_sect_index);
  	    /* The addresses in these entries are reported to be
  	       wrong.  See the code that reads 'G's for symtabs. */
  	    add_psymbol_to_list (namestring, p - namestring,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]