bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNU gdb 2001-06-20-cvs on solaris 2.7


From: Wolfgang Wander
Subject: GNU gdb 2001-06-20-cvs on solaris 2.7
Date: Wed, 20 Jun 2001 16:01:18 -0400 (EDT)

Hi,

   since 5.0 the indexing into the sections in elf_symfile_read seems
to have changed a lot. Whereas before the BSS section was always at
index 2 it is now at objfile->sect_index_bss. Unfortunately there
is no check whatsover if objfile->sect_index_bss is below SECT_OFF_MAX
and as it turns out objfile->sect_index_bss can be in the 2000s after
'default_symfile_offsets()'.

   The following patch checks for sane section indices in symfile.c

              

----------------------------------------------------------------------
   Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.34
diff -c -r1.34 symfile.c
*** symfile.c   2001/06/06 17:12:30     1.34
--- symfile.c   2001/06/20 19:50:53
***************
*** 519,539 ****
       .rodata sections. */
  
    sect = bfd_get_section_by_name (objfile->obfd, ".text");
!   if (sect) 
!     objfile->sect_index_text = sect->index;
  
    sect = bfd_get_section_by_name (objfile->obfd, ".data");
!   if (sect) 
!     objfile->sect_index_data = sect->index;
  
    sect = bfd_get_section_by_name (objfile->obfd, ".bss");
!   if (sect) 
!     objfile->sect_index_bss = sect->index;
  
    sect = bfd_get_section_by_name (objfile->obfd, ".rodata");
!   if (sect) 
!     objfile->sect_index_rodata = sect->index;
  
  }
  
  /* Process a symbol file, as either the main file or as a dynamically
--- 519,541 ----
       .rodata sections. */
  
    sect = bfd_get_section_by_name (objfile->obfd, ".text");
!   objfile->sect_index_text = sect ? sect->index : -1;
  
    sect = bfd_get_section_by_name (objfile->obfd, ".data");
!   objfile->sect_index_data = sect ? sect->index : -1;
  
    sect = bfd_get_section_by_name (objfile->obfd, ".bss");
!   objfile->sect_index_bss = sect ? sect->index : -1;
  
    sect = bfd_get_section_by_name (objfile->obfd, ".rodata");
!   objfile->sect_index_rodata = sect ? sect->index : -1;
  
+   if( objfile->sect_index_text   >= SECT_OFF_MAX ||
+       objfile->sect_index_data   >= SECT_OFF_MAX ||
+       objfile->sect_index_bss    >= SECT_OFF_MAX ||
+       objfile->sect_index_rodata >= SECT_OFF_MAX ) {
+     internal_error (__FILE__, __LINE__, "SECT_OFF_MAX too small"); 
+   }
  }
  
  /* Process a symbol file, as either the main file or as a dynamically

----------------------------------------------------------------------

and after the following increasing SECT_OFF_MAX to an insane value
gdb works as expected on solaris and is usuable with the new gcc-3
ABI. This does not look like an optimal solution though...

Index: gdb-stabs.h
===================================================================
RCS file: /cvs/src/src/gdb/gdb-stabs.h,v
retrieving revision 1.5
diff -c -r1.5 gdb-stabs.h
*** gdb-stabs.h 2001/03/06 08:21:07     1.5
--- gdb-stabs.h 2001/06/20 19:50:51
***************
*** 29,35 ****
  #if !defined (GDBSTABS_H)
  #define GDBSTABS_H
  
! #define       SECT_OFF_MAX    64      /* Count of possible values */
  
  /* The stab_section_info chain remembers info from the ELF symbol table,
     while psymtabs are being built for the other symbol tables in the 
--- 29,35 ----
  #if !defined (GDBSTABS_H)
  #define GDBSTABS_H
  
! #define       SECT_OFF_MAX    6400    /* Count of possible values */
  
  /* The stab_section_info chain remembers info from the ELF symbol table,
     while psymtabs are being built for the other symbol tables in the 

---
GNU gdb 2001-06-20-cvs
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.7".
---




reply via email to

[Prev in Thread] Current Thread [Next in Thread]