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]

symtab/1142: dwarf2 symtab bfd_section corrupt?


>Number:         1142
>Category:       symtab
>Synopsis:       dwarf2 symtab bfd_section corrupt?
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 13 20:48:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     ac131313 at redhat dot com
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
Hello,

Both the symtab and psymtab objects contain the common entry `asection 
*bfd_section'.  One field of the BFD section is it's `struct bfd *owner' 
- the object file that contains the section.

The new dwarf2loc stuff extends the symtab object adding a `struct 
objfile *objfile' field.  An objfile contains the field `struct bfd *obfd'.

Hmm, looks like redundant information.  Why not just point the 
symtab/psymtab at the obj_section?

The attached patch adds an assert to check the theory out.  It fails. 
The bfd_section ends up pointing at the file "libc.so"!

Andrew

Index: dwarf2loc.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2loc.c,v
retrieving revision 1.1
diff -u -r1.1 dwarf2loc.c
--- dwarf2loc.c	21 Feb 2003 15:24:17 -0000	1.1
+++ dwarf2loc.c	2 Mar 2003 16:48:23 -0000
@@ -31,6 +31,8 @@
 #include "dwarf2expr.h"
 #include "dwarf2loc.h"
 
+#include "objfiles.h"
+#include "gdb_assert.h"
 #include "gdb_string.h"
 
 #ifndef DWARF2_REG_TO_REGNUM
@@ -241,6 +243,8 @@
 {
   struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
   struct value *val;
+  gdb_assert (SYMBOL_BFD_SECTION (symbol) == NULL
+	      || SYMBOL_BFD_SECTION (symbol)->owner == dlbaton->objfile->obfd);
   val = dwarf2_evaluate_loc_desc (symbol, frame, dlbaton->data, dlbaton->size,
 				  dlbaton->objfile);
 
@@ -252,6 +256,8 @@
 locexpr_read_needs_frame (struct symbol *symbol)
 {
   struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
+  gdb_assert (SYMBOL_BFD_SECTION (symbol) == NULL
+	      || SYMBOL_BFD_SECTION (symbol)->owner == dlbaton->objfile->obfd);
   return dwarf2_loc_desc_needs_frame (dlbaton->data, dlbaton->size);
 }
 
@@ -261,7 +267,8 @@
 {
   /* FIXME: be more extensive.  */
   struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
-
+  gdb_assert (SYMBOL_BFD_SECTION (symbol) == NULL
+	      || SYMBOL_BFD_SECTION (symbol)->owner == dlbaton->objfile->obfd);
   if (dlbaton->size == 1
       && dlbaton->data[0] >= DW_OP_reg0
       && dlbaton->data[0] <= DW_OP_reg31)




>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]