+ 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.
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,
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);
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);
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
#********