Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: PATCH: read stabs from files with no .data section
Date: Mon, 08 Sep 2003 19:28:00 -0000	[thread overview]
Message-ID: <vt2brtvytbz.fsf@zenia.home> (raw)


This fixes gdb/291, symtab/1241, and gdb/644.

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,


             reply	other threads:[~2003-09-08 19:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-08 19:28 Jim Blandy [this message]
2003-09-09  3:30 ` Andrew Cagney
2003-09-09 17:47   ` Jim Blandy
2003-09-09 18:22     ` Andrew Cagney
2003-09-09 20:03       ` Jim Blandy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vt2brtvytbz.fsf@zenia.home \
    --to=jimb@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox