This is the mail archive of the gdb-prs@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]

pending/968: [RFA] Relocate debug information in object files (e.g. add-symbol-file) [take 2]


>Number:         968
>Category:       pending
>Synopsis:       [RFA] Relocate debug information in object files (e.g. add-symbol-file) [take 2]
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   unknown
>Arrival-Date:   Thu Jan 30 03:28:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
 Hey, remember this old patch?  I said it would take me a little while
 to get back to it... I didn't really expect it to be six months,
 though.
 
 On Thu, Apr 04, 2002 at 05:06:10PM -0500, Daniel Jacobowitz wrote:
 > This fixes a nasty problem debugging kernel modules on PowerPC.  The test is
 > in my previous message to this list today; it fixes:
 > FAIL: gdb.base/relocate.exp: static variables have different addresses
 > 
 > The problem goes like this: We know, when loading a new file at a specified
 > offset, that addresses in debug info are going to be a bit off.  We shift
 > them all by the appropriate constants (well, sometimes the appropriate
 > constants.  PowerPC has other problems with .data vs .sdata occasionally).
 > Shifting by constant section offsets is all we do.
 > 
 > On i386 and many other targets this suffices.  Why?  Because the debug info
 > looks like this:
 > 22     STSYM  0      1      00000000 934    static_foo:S(0,1)
 > 23     STSYM  0      2      00000004 952    static_bar:S(0,1)
 > 0000011c  00000301 R_386_32          00000000   .data
 > 00000128  00000301 R_386_32          00000000   .data
 > 
 > On PowerPC, it doesn't look like that at all.  I believe the reason has to
 > do with the ABI allowing .sdata optimizations.  It may also show up on other
 > architectures that use RELA; even though the offset will still be against
 > the section in that case, it will be shifted into the relocation entry
 > instead of the debug info directly.  Instead we have:
 > 22     STSYM  0      1      00000000 948    static_foo:S(0,1)
 > 23     STSYM  0      2      00000000 966    static_bar:S(0,1)
 >   0000011c  00601 R_PPC_ADDR32          00000000  static_foo	+ 0
 >   00000128  00701 R_PPC_ADDR32          00000004  static_bar	+ 0
 > 
 > The important changes are: the +4 in static_bar's stab has disappeared, and
 > the relocations are now against symbols.
 > 
 > The only way to make sense of this is to relocate the section.  It turned
 > out to be easier than I feared.  BFD provides (almost) the perfect hooks; we
 > need to fake a couple of data structures in order to pretend that we're a
 > linker, but that's it.  One consequence is that (in the case of an object
 > file only, not in the unchanged normal case) we preread the entire stabs
 > debug section.  Since this will only happen for individual object files, and
 > we don't keep it around, the memory increase doesn't worry me.  The
 > relocation itself is blindingly fast (imperceptible on a module I have here
 > with 4000 relocations and tons of symbols).
 
 I've updated the patch for all of Elena's concerns: no true/false, no
 PTR, a cleaner BFD interface to do the actual relocation, and an
 accessor function for the stabs section buffer.  It's come to my
 attention that the patch isn't quite complete - it won't read dynamic
 relocation sections, so shared libraries with relocations in the debug
 sections won't be handled correctly - but at the moment this is worked
 around in binutils anyway so I'm not terribly concerned.  I'll be back
 to that later.
 
 Here's the updated patch; is this one OK?
 
 -- 
 Daniel Jacobowitz
 MontaVista Software                         Debian GNU/Linux Developer
 
 2002-10-11  Daniel Jacobowitz  <drow@mvista.com>
 
 	* dbxread.c (stabs_data): New static variable.
 	(fill_symbuf): Support an in-memory buffer for stabs data.
 	(stabs_seek): New function.
 	(dbx_psymtab_to_symtab): Relocate the stabs data if necessary.
 	(read_ofile_symtab): Use stabs_seek.
 	(elfstab_build_psymtabs): Take an asection* instead of
 	an offset and size.  Relocate the stabs data if necessary.
 	Save the section* for dbx_psymtab_to_symtab.
 	* dwarf2read.c: Add section variables for each debug section.
 	(dwarf2_locate_sections): Fill them in.
 	(dwarf2_read_section): Take an asection* argument.
 	Relocate the section contents if necessary.
 	(dwarf2_build_psymtabs, dwarf2_build_psymtabs_easy): Update callers.
 	* dwarf2cfi.c (dwarf2_build_frame_info): Likewise.
 	* elfread.c (elf_symfile_read): Update call to
 	elfstab_build_psymtabs.
 	* gdb-stabs.h (struct dbx_symfile_info): Add stab_section.
 	(DBX_STAB_SECTION): New macro.
 	* stabsread.h (elfstab_build_psymtabs): Update prototype. 
 	* symfile.c (symfile_dummy_outputs): New function.
 	(symfile_relocate_debug_section): New function.
 	* symfile.h (symfile_relocate_debug_section): Add prototype.
 
 ? x
 ? mips-tdep.h
 ? mips-work.patch
 Index: dbxread.c
 ===================================================================
 RCS file: /cvs/src/src/gdb/dbxread.c,v
 retrieving revision 1.35
 diff -u -p -r1.35 dbxread.c
 --- dbxread.c	18 Sep 2002 20:47:39 -0000	1.35
 +++ dbxread.c	11 Oct 2002 14:42:45 -0000
 @@ -899,6 +899,10 @@ static struct stab_section_list *symbuf_
  static unsigned int symbuf_left;
  static unsigned int symbuf_read;
  
 +/* This variable stores a global stabs buffer, if we read stabs into
 +   memory in one chunk in order to process relocations.  */
 +static bfd_byte *stabs_data;
 +
  /* Refill the symbol table input buffer
     and set the variables that control fetching entries from it.
     Reports an error if no data available.
 @@ -911,8 +915,18 @@ fill_symbuf (bfd *sym_bfd)
    unsigned int count;
    int nbytes;
  
 -  if (symbuf_sections == NULL)
 -    count = sizeof (symbuf);
 +  if (stabs_data)
 +    {
 +      nbytes = sizeof (symbuf);
 +      if (nbytes > symbuf_left)
 +        nbytes = symbuf_left;
 +      memcpy (symbuf, stabs_data + symbuf_read, nbytes);
 +    }
 +  else if (symbuf_sections == NULL)
 +    {
 +      count = sizeof (symbuf);
 +      nbytes = bfd_bread (symbuf, count, sym_bfd);
 +    }
    else
      {
        if (symbuf_left <= 0)
 @@ -928,9 +942,9 @@ fill_symbuf (bfd *sym_bfd)
        count = symbuf_left;
        if (count > sizeof (symbuf))
  	count = sizeof (symbuf);
 +      nbytes = bfd_bread (symbuf, count, sym_bfd);
      }
  
 -  nbytes = bfd_bread ((PTR) symbuf, count, sym_bfd);
    if (nbytes < 0)
      perror_with_name (bfd_get_filename (sym_bfd));
    else if (nbytes == 0)
 @@ -941,6 +955,18 @@ fill_symbuf (bfd *sym_bfd)
    symbuf_read += nbytes;
  }
  
 +static void
 +stabs_seek (int sym_offset)
 +{
 +  if (stabs_data)
 +    {
 +      symbuf_read += sym_offset;
 +      symbuf_left -= sym_offset;
 +    }
 +  else
 +    bfd_seek (symfile_bfd, sym_offset, SEEK_CUR);
 +}
 +
  #define INTERNALIZE_SYMBOL(intern, extern, abfd)			\
    {									\
      (intern).n_type = bfd_h_get_8 (abfd, (extern)->e_type);		\
 @@ -2467,6 +2493,7 @@ static void
  dbx_psymtab_to_symtab (struct partial_symtab *pst)
  {
    bfd *sym_bfd;
 +  struct cleanup *back_to = NULL;
  
    if (!pst)
      return;
 @@ -2492,8 +2519,21 @@ dbx_psymtab_to_symtab (struct partial_sy
  
        next_symbol_text_func = dbx_next_symbol_text;
  
 +      if (DBX_STAB_SECTION (pst->objfile))
 +	{
 +	  stabs_data
 +	    = symfile_relocate_debug_section (pst->objfile->obfd,
 +					      DBX_STAB_SECTION (pst->objfile),
 +					      NULL);
 +	  if (stabs_data)
 +	    back_to = make_cleanup (free_current_contents, (void *) &stabs_data);
 +	}
 +
        dbx_psymtab_to_symtab_1 (pst);
  
 +      if (back_to)
 +	do_cleanups (back_to);
 +
        /* Match with global symbols.  This only needs to be done once,
           after all of the symtabs and dependencies have been read in.   */
        scan_file_globals (pst->objfile);
 @@ -2542,6 +2582,8 @@ read_ofile_symtab (struct partial_symtab
    abfd = objfile->obfd;
    symfile_bfd = objfile->obfd;	/* Implicit param to next_text_symbol */
    symbuf_end = symbuf_idx = 0;
 +  symbuf_read = 0;
 +  symbuf_left = sym_offset + sym_size;
  
    /* It is necessary to actually read one symbol *before* the start
       of this symtab's symbols, because the GCC_COMPILED_FLAG_SYMBOL
 @@ -2551,7 +2593,7 @@ read_ofile_symtab (struct partial_symtab
       would slow down initial readin, so we look for it here instead.  */
    if (!processing_acc_compilation && sym_offset >= (int) symbol_size)
      {
 -      bfd_seek (symfile_bfd, sym_offset - symbol_size, SEEK_CUR);
 +      stabs_seek (sym_offset - symbol_size);
        fill_symbuf (abfd);
        bufp = &symbuf[symbuf_idx++];
        INTERNALIZE_SYMBOL (nlist, bufp, abfd);
 @@ -2594,7 +2636,7 @@ read_ofile_symtab (struct partial_symtab
        /* The N_SO starting this symtab is the first symbol, so we
           better not check the symbol before it.  I'm not this can
           happen, but it doesn't hurt to check for it.  */
 -      bfd_seek (symfile_bfd, sym_offset, SEEK_CUR);
 +      stabs_seek (sym_offset);
        processing_gcc_compilation = 0;
      }
  
 @@ -3437,8 +3479,7 @@ coffstab_build_psymtabs (struct objfile 
     the base address of the text segment).
     MAINLINE is true if we are reading the main symbol
     table (as opposed to a shared lib or dynamically loaded file).
 -   STABOFFSET and STABSIZE define the location in OBJFILE where the .stab
 -   section exists.
 +   STABSECT is the BFD section information for the .stab section.
     STABSTROFFSET and STABSTRSIZE define the location in OBJFILE where the
     .stabstr section exists.
  
 @@ -3447,13 +3488,14 @@ coffstab_build_psymtabs (struct objfile 
  
  void
  elfstab_build_psymtabs (struct objfile *objfile, int mainline,
 -			file_ptr staboffset, unsigned int stabsize,
 +			asection *stabsect,
  			file_ptr stabstroffset, unsigned int stabstrsize)
  {
    int val;
    bfd *sym_bfd = objfile->obfd;
    char *name = bfd_get_filename (sym_bfd);
    struct dbx_symfile_info *info;
 +  struct cleanup *back_to = NULL;
  
    /* There is already a dbx_symfile_info allocated by our caller.
       It might even contain some info from the ELF symtab to help us.  */
 @@ -3465,9 +3507,11 @@ elfstab_build_psymtabs (struct objfile *
  
  #define	ELF_STABS_SYMBOL_SIZE	12	/* XXX FIXME XXX */
    DBX_SYMBOL_SIZE (objfile) = ELF_STABS_SYMBOL_SIZE;
 -  DBX_SYMCOUNT (objfile) = stabsize / DBX_SYMBOL_SIZE (objfile);
 +  DBX_SYMCOUNT (objfile)
 +    = bfd_section_size (objfile->obfd, stabsect) / DBX_SYMBOL_SIZE (objfile);
    DBX_STRINGTAB_SIZE (objfile) = stabstrsize;
 -  DBX_SYMTAB_OFFSET (objfile) = staboffset;
 +  DBX_SYMTAB_OFFSET (objfile) = stabsect->filepos;
 +  DBX_STAB_SECTION (objfile) = stabsect;
  
    if (stabstrsize > bfd_get_size (sym_bfd))
      error ("ridiculous string table size: %d bytes", stabstrsize);
 @@ -3492,10 +3536,19 @@ elfstab_build_psymtabs (struct objfile *
  
    processing_acc_compilation = 1;
  
 +  symbuf_read = 0;
 +  symbuf_left = bfd_section_size (objfile->obfd, stabsect);
 +  stabs_data = symfile_relocate_debug_section (objfile->obfd, stabsect, NULL);
 +  if (stabs_data)
 +    back_to = make_cleanup (free_current_contents, (void *) &stabs_data);
 +
    /* In an elf file, we've already installed the minimal symbols that came
       from the elf (non-stab) symbol table, so always act like an
       incremental load here. */
    dbx_symfile_read (objfile, 0);
 +
 +  if (back_to)
 +    do_cleanups (back_to);
  }
  
  /* Scan and build partial symbols for a file with special sections for stabs
 Index: dwarf2cfi.c
 ===================================================================
 RCS file: /cvs/src/src/gdb/dwarf2cfi.c,v
 retrieving revision 1.16
 diff -u -p -r1.16 dwarf2cfi.c
 --- dwarf2cfi.c	19 Jul 2002 09:40:51 -0000	1.16
 +++ dwarf2cfi.c	11 Oct 2002 14:42:46 -0000
 @@ -199,10 +199,13 @@ extern file_ptr dwarf_frame_offset;
  extern unsigned int dwarf_frame_size;
  extern file_ptr dwarf_eh_frame_offset;
  extern unsigned int dwarf_eh_frame_size;
 +extern asection *dwarf_frame_section;
 +extern asection *dwarf_eh_frame_section;
 +
  
  
  extern char *dwarf2_read_section (struct objfile *objfile, file_ptr offset,
 -				  unsigned int size);
 +				  unsigned int size, asection* sectp);
  
  static struct fde_unit *fde_unit_alloc (void);
  static struct cie_unit *cie_unit_alloc (void);
 @@ -1409,7 +1412,8 @@ compare_fde_unit (const void *a, const v
                                                                -- mludvig  */
  static void
  parse_frame_info (struct objfile *objfile, file_ptr frame_offset,
 -		  unsigned int frame_size, int eh_frame)
 +		  unsigned int frame_size, asection *frame_section,
 +		  int eh_frame)
  {
    bfd *abfd = objfile->obfd;
    asection *curr_section_ptr;
 @@ -1424,7 +1428,8 @@ parse_frame_info (struct objfile *objfil
  
    unwind_tmp_obstack_init ();
  
 -  frame_buffer = dwarf2_read_section (objfile, frame_offset, frame_size);
 +  frame_buffer = dwarf2_read_section (objfile, frame_offset, frame_size,
 +				      frame_section);
  
    start = frame_buffer;
    end = frame_buffer + frame_size;
 @@ -1677,12 +1682,14 @@ dwarf2_build_frame_info (struct objfile 
    if (dwarf_frame_offset)
      {
        parse_frame_info (objfile, dwarf_frame_offset,
 -			dwarf_frame_size, 0 /* = debug_frame */ );
 +			dwarf_frame_size, dwarf_frame_section,
 +			0 /* = debug_frame */ );
        after_debug_frame = 1;
      }
  
    if (dwarf_eh_frame_offset)
      parse_frame_info (objfile, dwarf_eh_frame_offset, dwarf_eh_frame_size,
 +		      dwarf_eh_frame_section,
  		      1 /* = eh_frame */  + after_debug_frame);
  }
  
 Index: dwarf2read.c
 ===================================================================
 RCS file: /cvs/src/src/gdb/dwarf2read.c,v
 retrieving revision 1.68
 diff -u -p -r1.68 dwarf2read.c
 --- dwarf2read.c	9 Oct 2002 04:43:49 -0000	1.68
 +++ dwarf2read.c	11 Oct 2002 14:42:47 -0000
 @@ -147,6 +147,17 @@ static unsigned int dwarf_str_size;
  unsigned int dwarf_frame_size;
  unsigned int dwarf_eh_frame_size;
  
 +static asection *dwarf_info_section;
 +static asection *dwarf_abbrev_section;
 +static asection *dwarf_line_section;
 +static asection *dwarf_pubnames_section;
 +static asection *dwarf_aranges_section;
 +static asection *dwarf_loc_section;
 +static asection *dwarf_macinfo_section;
 +static asection *dwarf_str_section;
 +asection *dwarf_frame_section;
 +asection *dwarf_eh_frame_section;
 +
  /* names of the debugging sections */
  
  #define INFO_SECTION     ".debug_info"
 @@ -705,7 +716,8 @@ static void dwarf2_psymtab_to_symtab (st
  
  static void psymtab_to_symtab_1 (struct partial_symtab *);
  
 -char *dwarf2_read_section (struct objfile *, file_ptr, unsigned int);
 +char *dwarf2_read_section (struct objfile *, file_ptr, unsigned int,
 +			   asection *);
  
  static void dwarf2_read_abbrevs (bfd *abfd, struct comp_unit_head *cu_header);
  
 @@ -970,51 +982,61 @@ dwarf2_locate_sections (bfd *ignore_abfd
      {
        dwarf_info_offset = sectp->filepos;
        dwarf_info_size = bfd_get_section_size_before_reloc (sectp);
 +      dwarf_info_section = sectp;
      }
    else if (STREQ (sectp->name, ABBREV_SECTION))
      {
        dwarf_abbrev_offset = sectp->filepos;
        dwarf_abbrev_size = bfd_get_section_size_before_reloc (sectp);
 +      dwarf_abbrev_section = sectp;
      }
    else if (STREQ (sectp->name, LINE_SECTION))
      {
        dwarf_line_offset = sectp->filepos;
        dwarf_line_size = bfd_get_section_size_before_reloc (sectp);
 +      dwarf_line_section = sectp;
      }
    else if (STREQ (sectp->name, PUBNAMES_SECTION))
      {
        dwarf_pubnames_offset = sectp->filepos;
        dwarf_pubnames_size = bfd_get_section_size_before_reloc (sectp);
 +      dwarf_pubnames_section = sectp;
      }
    else if (STREQ (sectp->name, ARANGES_SECTION))
      {
        dwarf_aranges_offset = sectp->filepos;
        dwarf_aranges_size = bfd_get_section_size_before_reloc (sectp);
 +      dwarf_aranges_section = sectp;
      }
    else if (STREQ (sectp->name, LOC_SECTION))
      {
        dwarf_loc_offset = sectp->filepos;
        dwarf_loc_size = bfd_get_section_size_before_reloc (sectp);
 +      dwarf_loc_section = sectp;
      }
    else if (STREQ (sectp->name, MACINFO_SECTION))
      {
        dwarf_macinfo_offset = sectp->filepos;
        dwarf_macinfo_size = bfd_get_section_size_before_reloc (sectp);
 +      dwarf_loc_section = sectp;
      }
    else if (STREQ (sectp->name, STR_SECTION))
      {
        dwarf_str_offset = sectp->filepos;
        dwarf_str_size = bfd_get_section_size_before_reloc (sectp);
 +      dwarf_str_section = sectp;
      }
    else if (STREQ (sectp->name, FRAME_SECTION))
      {
        dwarf_frame_offset = sectp->filepos;
        dwarf_frame_size = bfd_get_section_size_before_reloc (sectp);
 +      dwarf_frame_section = sectp;
      }
    else if (STREQ (sectp->name, EH_FRAME_SECTION))
      {
        dwarf_eh_frame_offset = sectp->filepos;
        dwarf_eh_frame_size = bfd_get_section_size_before_reloc (sectp);
 +      dwarf_eh_frame_section = sectp;
      }
  }
  
 @@ -1028,29 +1050,34 @@ dwarf2_build_psymtabs (struct objfile *o
  
    dwarf_info_buffer = dwarf2_read_section (objfile,
  					   dwarf_info_offset,
 -					   dwarf_info_size);
 +					   dwarf_info_size,
 +					   dwarf_info_section);
    dwarf_abbrev_buffer = dwarf2_read_section (objfile,
  					     dwarf_abbrev_offset,
 -					     dwarf_abbrev_size);
 +					     dwarf_abbrev_size,
 +					     dwarf_abbrev_section);
  
    if (dwarf_line_offset)
      dwarf_line_buffer = dwarf2_read_section (objfile,
  					     dwarf_line_offset,
 -					     dwarf_line_size);
 +					     dwarf_line_size,
 +					     dwarf_line_section);
    else
      dwarf_line_buffer = NULL;
  
    if (dwarf_str_offset)
      dwarf_str_buffer = dwarf2_read_section (objfile,
  					    dwarf_str_offset,
 -					    dwarf_str_size);
 +					    dwarf_str_size,
 +					    dwarf_str_section);
    else
      dwarf_str_buffer = NULL;
  
    if (dwarf_macinfo_offset)
      dwarf_macinfo_buffer = dwarf2_read_section (objfile,
                                                  dwarf_macinfo_offset,
 -                                                dwarf_macinfo_size);
 +                                                dwarf_macinfo_size,
 +						dwarf_macinfo_section);
    else
      dwarf_macinfo_buffer = NULL;
  
 @@ -1092,7 +1119,8 @@ dwarf2_build_psymtabs_easy (struct objfi
  
    pubnames_buffer = dwarf2_read_section (objfile,
  					 dwarf_pubnames_offset,
 -					 dwarf_pubnames_size);
 +					 dwarf_pubnames_size,
 +					 dwarf_pubnames_section);
    pubnames_ptr = pubnames_buffer;
    while ((pubnames_ptr - pubnames_buffer) < dwarf_pubnames_size)
      {
 @@ -1112,7 +1140,8 @@ dwarf2_build_psymtabs_easy (struct objfi
  
    aranges_buffer = dwarf2_read_section (objfile,
  					dwarf_aranges_offset,
 -					dwarf_aranges_size);
 +					dwarf_aranges_size,
 +					dwarf_aranges_section);
  
  }
  #endif
 @@ -3347,15 +3376,20 @@ make_cleanup_free_die_list (struct die_i
  
  char *
  dwarf2_read_section (struct objfile *objfile, file_ptr offset,
 -		     unsigned int size)
 +		     unsigned int size, asection *sectp)
  {
    bfd *abfd = objfile->obfd;
 -  char *buf;
 +  char *buf, *retbuf;
  
    if (size == 0)
      return NULL;
  
    buf = (char *) obstack_alloc (&objfile->psymbol_obstack, size);
 +  retbuf
 +    = (char *) symfile_relocate_debug_section (abfd, sectp, (bfd_byte *) buf);
 +  if (retbuf != NULL)
 +    return retbuf;
 +
    if ((bfd_seek (abfd, offset, SEEK_SET) != 0) ||
        (bfd_bread (buf, size, abfd) != size))
      {
 Index: elfread.c
 ===================================================================
 RCS file: /cvs/src/src/gdb/elfread.c,v
 retrieving revision 1.25
 diff -u -p -r1.25 elfread.c
 --- elfread.c	19 Sep 2002 03:58:41 -0000	1.25
 +++ elfread.c	11 Oct 2002 14:42:47 -0000
 @@ -602,8 +602,7 @@ elf_symfile_read (struct objfile *objfil
        if (str_sect)
  	elfstab_build_psymtabs (objfile,
  				mainline,
 -				ei.stabsect->filepos,
 -				bfd_section_size (abfd, ei.stabsect),
 +				ei.stabsect,
  				str_sect->filepos,
  				bfd_section_size (abfd, str_sect));
      }
 Index: gdb-stabs.h
 ===================================================================
 RCS file: /cvs/src/src/gdb/gdb-stabs.h,v
 retrieving revision 1.5
 diff -u -p -r1.5 gdb-stabs.h
 --- gdb-stabs.h	6 Mar 2001 08:21:07 -0000	1.5
 +++ gdb-stabs.h	11 Oct 2002 14:42:47 -0000
 @@ -70,6 +70,9 @@ struct dbx_symfile_info
      asection *text_section;
      asection *data_section;
      asection *bss_section;
 +
 +    /* Pointer to the separate ".stab" section, if there is one.  */
 +    asection *stab_section;
    };
  
  #define DBX_SYMFILE_INFO(o)	((o)->sym_stab_info)
 @@ -83,5 +86,6 @@ struct dbx_symfile_info
  #define DBX_TEXT_SECTION(o)	(DBX_SYMFILE_INFO(o)->text_section)
  #define DBX_DATA_SECTION(o)	(DBX_SYMFILE_INFO(o)->data_section)
  #define DBX_BSS_SECTION(o)	(DBX_SYMFILE_INFO(o)->bss_section)
 +#define DBX_STAB_SECTION(o)	(DBX_SYMFILE_INFO(o)->stab_section)
  
  #endif /* GDBSTABS_H */
 Index: stabsread.h
 ===================================================================
 RCS file: /cvs/src/src/gdb/stabsread.h,v
 retrieving revision 1.8
 diff -u -p -r1.8 stabsread.h
 --- stabsread.h	18 Jul 2002 17:22:50 -0000	1.8
 +++ stabsread.h	11 Oct 2002 14:42:48 -0000
 @@ -188,7 +188,7 @@ extern void process_one_symbol (int, int
  
  extern void elfstab_build_psymtabs (struct objfile *objfile,
  				    int mainline,
 -				    file_ptr staboff, unsigned int stabsize,
 +				    asection *stabsect,
  				    file_ptr stabstroffset,
  				    unsigned int stabstrsize);
  
 Index: symfile.c
 ===================================================================
 RCS file: /cvs/src/src/gdb/symfile.c,v
 retrieving revision 1.69
 diff -u -p -r1.69 symfile.c
 --- symfile.c	20 Sep 2002 14:58:58 -0000	1.69
 +++ symfile.c	11 Oct 2002 14:42:49 -0000
 @@ -23,6 +23,7 @@
     Boston, MA 02111-1307, USA.  */
  
  #include "defs.h"
 +#include "bfdlink.h"
  #include "symtab.h"
  #include "gdbtypes.h"
  #include "gdbcore.h"
 @@ -42,6 +43,7 @@
  #include "gdb_obstack.h"
  #include "completer.h"
  #include "bcache.h"
 +#include "gdb_assert.h"
  
  #include <sys/types.h>
  #include <fcntl.h>
 @@ -3248,6 +3250,30 @@ simple_overlay_update (struct obj_sectio
      }
  }
  
 +
 +static void
 +symfile_dummy_outputs (bfd *abfd, asection *sectp, void *dummy)
 +{
 +  sectp->output_section = sectp;
 +  sectp->output_offset = 0;
 +}
 +
 +bfd_byte *
 +symfile_relocate_debug_section (bfd *abfd, asection *sectp, bfd_byte *buf)
 +{
 +  /* We're only interested in debugging sections with relocation
 +     information.  */
 +  if ((sectp->flags & SEC_RELOC) == 0)
 +    return NULL;
 +  if ((sectp->flags & SEC_DEBUGGING) == 0)
 +    return NULL;
 +
 +  /* We will handle section offsets properly elsewhere, so relocate as if
 +     all sections begin at 0.  */
 +  bfd_map_over_sections (abfd, symfile_dummy_outputs, NULL);
 +
 +  return bfd_simple_get_relocated_section_contents (abfd, sectp, buf);
 +}
  
  void
  _initialize_symfile (void)
 Index: symfile.h
 ===================================================================
 RCS file: /cvs/src/src/gdb/symfile.h,v
 retrieving revision 1.13
 diff -u -p -r1.13 symfile.h
 --- symfile.h	22 Apr 2002 10:19:04 -0000	1.13
 +++ symfile.h	11 Oct 2002 14:42:49 -0000
 @@ -295,6 +295,9 @@ extern void symbol_file_add_main (char *
  /* Clear GDB symbol tables. */
  extern void symbol_file_clear (int from_tty);
  
 +extern bfd_byte *symfile_relocate_debug_section (bfd *abfd, asection *sectp,
 +						 bfd_byte *buf);
 +
  /* From dwarfread.c */
  
  extern void
 
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


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