aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-11-26 19:23:56 +0000
committerTom Tromey <tromey@redhat.com>2012-11-26 19:23:56 +0000
commit608e2dbbfefcec9aa3efc863ffcc889786ae93d7 (patch)
tree864efd0235bc2d56f8be06b71c4b0e058cbdc5eb /gdb/symfile.c
parent4648e5880ea4bc32689612ccf586b0fb2c9c0884 (diff)
downloadgdb-608e2dbbfefcec9aa3efc863ffcc889786ae93d7.zip
gdb-608e2dbbfefcec9aa3efc863ffcc889786ae93d7.tar.gz
gdb-608e2dbbfefcec9aa3efc863ffcc889786ae93d7.tar.bz2
2012-11-26 Alexander Larsson <alexl@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com> Tom Tromey <tromey@redhat.com> * NEWS: Mention mini debuginfo feature. * minidebug.c: New file. * configure.ac: Check for lzma. * configure, config.in: Rebuild. * Makefile.in (LIBLZMA): New variable. (CLIBS): Include LIBLZMA. (SFILES): Mention minidebug.c. (COMMON_OBS): Mention minidebug.o. * symfile.c (read_symbols): New function. (syms_from_objfile, reread_symbols): Call it. * symfile.h (find_separate_debug_file_in_section): Declare. doc * gdb.texinfo (MiniDebugInfo): New node. (GDB Files): Update. testsuite * gdb.base/gnu-debugdata.exp: New file. * gdb.base/gnu-debugdata.c: New file. * lib/gdb.exp (gdb_file_cmd): Handle LZMA warning. (gdb_unload): Return 0 on success.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 55af541e..6a2fc89 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -876,6 +876,27 @@ default_symfile_segments (bfd *abfd)
return data;
}
+/* This is a convenience function to call sym_read for OBJFILE and
+ possibly force the partial symbols to be read. */
+
+static void
+read_symbols (struct objfile *objfile, int add_flags)
+{
+ (*objfile->sf->sym_read) (objfile, add_flags);
+ if (!objfile_has_partial_symbols (objfile))
+ {
+ bfd *abfd = find_separate_debug_file_in_section (objfile);
+ struct cleanup *cleanup = make_cleanup_bfd_unref (abfd);
+
+ if (abfd != NULL)
+ symbol_file_add_separate (abfd, add_flags, objfile);
+
+ do_cleanups (cleanup);
+ }
+ if ((add_flags & SYMFILE_NO_READ) == 0)
+ require_partial_symbols (objfile, 0);
+}
+
/* Process a symbol file, as either the main file or as a dynamically
loaded file.
@@ -996,10 +1017,7 @@ syms_from_objfile (struct objfile *objfile,
init_objfile_sect_indices (objfile);
}
- (*objfile->sf->sym_read) (objfile, add_flags);
-
- if ((add_flags & SYMFILE_NO_READ) == 0)
- require_partial_symbols (objfile, 0);
+ read_symbols (objfile, add_flags);
/* Discard cleanups as symbol reading was successful. */
@@ -2601,14 +2619,9 @@ reread_symbols (void)
(*objfile->sf->sym_init) (objfile);
clear_complaints (&symfile_complaints, 1, 1);
- /* Do not set flags as this is safe and we don't want to be
- verbose. */
- (*objfile->sf->sym_read) (objfile, 0);
- if ((objfile->flags & OBJF_PSYMTABS_READ) != 0)
- {
- objfile->flags &= ~OBJF_PSYMTABS_READ;
- require_partial_symbols (objfile, 0);
- }
+
+ objfile->flags &= ~OBJF_PSYMTABS_READ;
+ read_symbols (objfile, 0);
if (!objfile_has_symbols (objfile))
{