aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.c
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2003-01-23 23:03:32 +0000
committerJim Blandy <jimb@codesourcery.com>2003-01-23 23:03:32 +0000
commit5b5d99cf4d5ded93b60fd64c6069d45e3eeab1d3 (patch)
tree4a1aee75b40925f41c77c4719c476f79a6c05e8f /gdb/objfiles.c
parent2e9d25326799fc76b25edca6d6e6b644e0a72f1c (diff)
downloadgdb-5b5d99cf4d5ded93b60fd64c6069d45e3eeab1d3.zip
gdb-5b5d99cf4d5ded93b60fd64c6069d45e3eeab1d3.tar.gz
gdb-5b5d99cf4d5ded93b60fd64c6069d45e3eeab1d3.tar.bz2
gdb/ChangeLog:
2003-01-23 Alexander Larsson <alexl@redhat.com> Jim Blandy <jimb@redhat.com> Add support for executables whose debug info has been separated out into a separate file, leaving only a link behind. * objfiles.h (struct objfile): New fields: separate_debug_objfile and separate_debug_objfile_backlink. (put_objfile_before): New declaration. * symfile.c: #include "filenames.h". (symbol_file_add_with_addrs_or_offsets): If this objfile has its debug info in a separate file, read that, too. Save the addrs argument, so we can use it again to read the separated debug info; syms_from_objfile modifies the table we pass it. (reread_symbols): After re-reading an objfile, call reread_separate_symbols to refresh its separate debug info objfile, if it has one. (reread_separate_symbols, find_separate_debug_file, get_debug_link_info, separate_debug_file_exists): New functions. (debug_file_directory): New global var. (_initialize_symfile): Initialize debug_file_directory, and provide the new `set debug-file-directory' command to let the user change it. * objfiles.c (free_objfile): If this objfile has its debug info in a separate objfile, free that one too. If this is itself a separate debug info objfile, clear our parent's backlink. (put_objfile_before): New function. * utils.c (gnu_debuglink_crc32): New function. * defs.h (gnu_debuglink_crc32): New declaration. * Makefile.in (symfile.o): Note dependency on "filenames.h". * configure.in: Handle --with-separate-debug-dir config option. * acinclude.m4 (AC_DEFINE_DIR): New macro. * acconfig.h (DEBUGDIR): New macro. * configure, aclocal.m4, config.in: Regenerated. gdb/doc/ChangeLog: 2003-01-23 Jim Blandy <jimb@redhat.com> * gdb.texinfo (Separate Debug Files): New section.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r--gdb/objfiles.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index ae1613d..d62b28f 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -333,6 +333,30 @@ allocate_objfile (bfd *abfd, int flags)
return (objfile);
}
+/* Put one object file before a specified on in the global list.
+ This can be used to make sure an object file is destroyed before
+ another when using ALL_OBJFILES_SAFE to free all objfiles. */
+void
+put_objfile_before (struct objfile *objfile, struct objfile *before_this)
+{
+ struct objfile **objp;
+
+ unlink_objfile (objfile);
+
+ for (objp = &object_files; *objp != NULL; objp = &((*objp)->next))
+ {
+ if (*objp == before_this)
+ {
+ objfile->next = *objp;
+ *objp = objfile;
+ return;
+ }
+ }
+
+ internal_error (__FILE__, __LINE__,
+ "put_objfile_before: before objfile not in list");
+}
+
/* Put OBJFILE at the front of the list. */
void
@@ -405,6 +429,18 @@ unlink_objfile (struct objfile *objfile)
void
free_objfile (struct objfile *objfile)
{
+ if (objfile->separate_debug_objfile)
+ {
+ free_objfile (objfile->separate_debug_objfile);
+ }
+
+ if (objfile->separate_debug_objfile_backlink)
+ {
+ /* We freed the separate debug file, make sure the base objfile
+ doesn't reference it. */
+ objfile->separate_debug_objfile_backlink->separate_debug_objfile = NULL;
+ }
+
/* First do any symbol file specific actions required when we are
finished with a particular symbol file. Note that if the objfile
is using reusable symbol information (via mmalloc) then each of