]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
patch ../102429928.patch
authorDoug Evans <dje@google.com>
Thu, 10 Dec 2015 20:00:31 +0000 (12:00 -0800)
committerDoug Evans <dje@google.com>
Thu, 10 Dec 2015 20:00:31 +0000 (12:00 -0800)
README.google
gdb/symfile.c
gdb/testsuite/gdb.base/sepdebug.exp

index 4a92ff13f0534302211fcfffd767a41c9824d7c8..96331601e11b698c6aa31b2077cc1dffbc86e170 100644 (file)
@@ -242,3 +242,20 @@ they are an ongoing maintenance burden.
 +      separate debug files.
 +      (clear_symtab_users): Don't call observer_notify_new_objfile (NULL)
 +      here if SYMFILE_MAINLINE.
+--- README.google      2015-09-05 18:26:36.000000000 -0700
++++ README.google      2015-09-05 18:44:15.000000000 -0700
++
++2015-09-05  Doug Evans  <dje@google.com>
++
++      PR python/17936
++      * symfile.c (symbol_file_add_with_addrs): Don't query whether to load
++      a new symbol table for separate debug files.  Don't call
++      observer_notify_new_objfile (NULL) for separate debug files.  Turn off
++      SYMFILE_MAINLINE when calling finish_new_objfile for separate debug
++      files.
++      (symbol_file_add_separate): Don't turn off SYMFILE_MAINLINE.  Add a
++      comment explaining why.
++
++      testsuite/
++      * gdb.base/sepdebug.exp: Add test to verify two "Reading symbols ..."
++      messages are printed.
index 7a5554f9e4ace1d36fc03d9324738fe6d40c50d9..5754c8bc21b2d68944693225a250ba99fd14bd85 100644 (file)
@@ -1187,17 +1187,19 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name, int add_flags,
 
   if ((have_full_symbols () || have_partial_symbols ())
       && mainline
+      && parent == NULL
       && from_tty
       && !query (_("Load new symbol table from \"%s\"? "), name))
     error (_("Not confirmed."));
 
-  /* If mainline, send the new_objfile (NULL) notification now.
-     This is done here so that clients will see one event instead of one for
-     the main objfile and a second one for a possible separate debug file, and
-     will see the event before any objfiles are loaded including possible
-     separate debug files. Note that if there is a separate debug file, we
-     will end up back here from calling syms_from_objfile below.  PR 17936.  */
-  if (mainline)
+  /* If mainline and not a separate debug file, send the new_objfile (NULL)
+     notification now.  This is done here so that clients will see one event
+     instead of one for the main objfile and a second one for a possible
+     separate debug file, and will see the event before any objfiles are
+     loaded including possible separate debug files.  Note that if there is a
+     separate debug file, we will end up back here from calling
+     syms_from_objfile below.  PR 17936.  */
+  if (mainline && parent == NULL)
     observer_notify_new_objfile (NULL);
 
   objfile = allocate_objfile (abfd, name,
@@ -1267,7 +1269,10 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name, int add_flags,
       return objfile;  /* No symbols.  */
     }
 
-  finish_new_objfile (objfile, add_flags);
+  finish_new_objfile (objfile,
+                     parent != NULL
+                     ? (add_flags & ~SYMFILE_MAINLINE)
+                     : add_flags);
 
   observer_notify_new_objfile (objfile);
 
@@ -1292,8 +1297,11 @@ symbol_file_add_separate (bfd *bfd, const char *name, int symfile_flags,
   sap = build_section_addr_info_from_objfile (objfile);
   my_cleanup = make_cleanup_free_section_addr_info (sap);
 
+  /* Note: We pass on SYMFILE_MAINLINE for the separate debug file on purpose:
+     We want to have the same "Reading symbols ..." handling for the separate
+     debug file.  */
   new_objfile = symbol_file_add_with_addrs
-    (bfd, name, symfile_flags & ~SYMFILE_MAINLINE, sap,
+    (bfd, name, symfile_flags, sap,
      objfile->flags & (OBJF_REORDERED | OBJF_SHARED | OBJF_READNOW
                       | OBJF_USERLOADED),
      objfile);
index 512fb131946a52cc727a624a10a5765708343db1..3202ddc2507391316e706aea88bc8c6c3f15bc3e 100644 (file)
@@ -628,6 +628,26 @@ proc test_next_with_recursion {} {
 
 test_next_with_recursion
 
+# Verify we see two "Reading symbols from ..." messages.
+# Normally gdb_file_cmd is used, but it is a monster which we don't want to
+# replicate.  We could put the detection of two "Reading ..." messages there,
+# but that would further complicate it just for this one test.  Instead we do
+# a stripped down version of gdb_file_cmd here: we don't need to be be as
+# general purpose.
+# We take advantage of the fact that the previous clean_restart will have
+# already downloaded the binary
+
+proc test_two_reading_messages { } {
+    global srcdir subdir testfile EXEEXT
+    gdb_exit
+    gdb_start
+    gdb_reinitialize_dir $srcdir/$subdir
+    gdb_test "file [standard_output_file ${testfile}${EXEEXT}]" \
+       "Reading symbols from.*Reading symbols from.*done." \
+       "Verify two \"Reading symbols\" messages are seen"
+}
+
+test_two_reading_messages
 
 #********