summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2015-12-10 12:00:31 -0800
committerDoug Evans <dje@google.com>2015-12-10 12:00:31 -0800
commit7eb4df09edb3424392c3e8f233291b007efe192e (patch)
treee76f71e35cc10f2c359d2fad5617e8f85e39af75
parent99a8e537841025daa212aa33e08cfdebc82c27ee (diff)
downloadbinutils-gdb-7eb4df09edb3424392c3e8f233291b007efe192e.tar.gz
patch ../102429928.patch
-rw-r--r--README.google17
-rw-r--r--gdb/symfile.c26
-rw-r--r--gdb/testsuite/gdb.base/sepdebug.exp20
3 files changed, 54 insertions, 9 deletions
diff --git a/README.google b/README.google
index 4a92ff13f05..96331601e11 100644
--- a/README.google
+++ b/README.google
@@ -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.
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 7a5554f9e4a..5754c8bc21b 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -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);
diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp
index 512fb131946..3202ddc2507 100644
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -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
#********