This is the mail archive of the gdb-patches@sourceware.org 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]

Re: FYI: fix latent bug in dw2_find_symbol_file


>>>>> "Doug" == Doug Evans <dje@google.com> writes:

Doug> You need to call init_cutu_and_read_dies in both debug-types and
Doug> non-debug-types cases.

Here's the patch I'm checking in.

Doug patiently walked me through the setup.  Thanks, Doug.

For the record, you must:

* Build the google/gcc-4_6 branch of gcc
* Build CVS HEAD binutils and arrange for gold to be built and be
  the installed 'ld'
* Run the test suite like so:

    runtest {C,CXX}FLAGS_FOR_TARGET='-g -gdwarf-4 -gfission -Wl,--gdb-index' GDB='../gdb --use-deprecated-index-sections'

Even with this I couldn't see a regression, I think because I forgot to
build the Objective C compiler (for the dwz branch, the failure that
motivated the initial patch came from the gdb.objc).

Doug showed me a simple reproducer, though, and I've incorporated this
into the patch.

Built and regtested on x86-64 Fedora 16.

Tom

2012-06-15  Tom Tromey  <tromey@redhat.com>

	* dwarf2read.c (dw2_find_symbol_file): Unconditionally use
	init_cutu_and_read_dies.

2012-06-15  Tom Tromey  <tromey@redhat.com>

	* gdb.cp/namespace.exp: Add "show lang" test.

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 1fdd819..a8cd158 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2906,12 +2906,8 @@ dw2_find_symbol_file (struct objfile *objfile, const char *name)
   if (per_cu->v.quick->symtab != NULL)
     return per_cu->v.quick->symtab->filename;
 
-  if (per_cu->is_debug_types)
-    init_cutu_and_read_dies (per_cu, 0, 0, dw2_get_primary_filename_reader,
-			     &filename);
-  else
-    init_cutu_and_read_dies_simple (per_cu, dw2_get_primary_filename_reader,
-				    &filename);
+  init_cutu_and_read_dies (per_cu, 0, 0, dw2_get_primary_filename_reader,
+			   &filename);
 
   return filename;
 }
diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp
index cf5a858..82018c6 100644
--- a/gdb/testsuite/gdb.cp/namespace.exp
+++ b/gdb/testsuite/gdb.cp/namespace.exp
@@ -66,6 +66,7 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
+gdb_test "show lang" "auto; currently c\\+\\+.*"
 
 #
 # set it up at a breakpoint so we can play with the variable values


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