From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA 1/2] Use a distinguishing name for minidebug objfile
Date: Thu, 13 Apr 2017 04:44:00 -0000 [thread overview]
Message-ID: <20170413041504.14435-2-tom@tromey.com> (raw)
In-Reply-To: <20170413041504.14435-1-tom@tromey.com>
One part of PR cli/19951 is that the mini debug info objfile reuses the
name of the main objfile from which it comes. This can be seen because
gdb claims to be reading symbols from the same file two times, like:
Reading symbols from /bin/gdb...Reading symbols from /bin/gdb...(no debugging symbols found)...done.
I think this would be less confusing if the minidebug objfile were given
a different name. That is what this patch implements. It also arranges
for the minidebug objfile to be marked OBJF_NOT_FILENAME.
gdb/ChangeLog
2017-04-12 Tom Tromey <tom@tromey.com>
PR cli/19551:
* symfile-add-flags.h (enum symfile_add_flags)
<SYMFILE_NOT_FILENAME>: New constant.
* symfile.c (read_symbols): Use SYMFILE_NOT_FILENAME. Get
objfile name from BFD.
(symbol_file_add_with_addrs): Check SYMFILE_NOT_FILENAME.
* minidebug.c (find_separate_debug_file_in_section): Put
".gnu_debugdata" into BFD's file name.
---
gdb/ChangeLog | 11 +++++++++++
gdb/minidebug.c | 5 ++++-
gdb/symfile-add-flags.h | 7 +++++--
gdb/symfile.c | 4 +++-
4 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 315932e..c56de68 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,14 @@
+2017-04-12 Tom Tromey <tom@tromey.com>
+
+ PR cli/19551:
+ * symfile-add-flags.h (enum symfile_add_flags)
+ <SYMFILE_NOT_FILENAME>: New constant.
+ * symfile.c (read_symbols): Use SYMFILE_NOT_FILENAME. Get
+ objfile name from BFD.
+ (symbol_file_add_with_addrs): Check SYMFILE_NOT_FILENAME.
+ * minidebug.c (find_separate_debug_file_in_section): Put
+ ".gnu_debugdata" into BFD's file name.
+
2017-04-13 Pedro Alves <palves@redhat.com>
* breakpoint.h (struct breakpoint): Reindent.
diff --git a/gdb/minidebug.c b/gdb/minidebug.c
index d4687dd..c2ada46 100644
--- a/gdb/minidebug.c
+++ b/gdb/minidebug.c
@@ -270,7 +270,10 @@ find_separate_debug_file_in_section (struct objfile *objfile)
return NULL;
#ifdef HAVE_LIBLZMA
- abfd = gdb_bfd_openr_iovec (objfile_name (objfile), gnutarget, lzma_open,
+ std::string filename = (std::string (".gnu_debugdata for ")
+ + objfile_name (objfile));
+
+ abfd = gdb_bfd_openr_iovec (filename.c_str (), gnutarget, lzma_open,
section, lzma_pread, lzma_close, lzma_stat);
if (abfd == NULL)
return NULL;
diff --git a/gdb/symfile-add-flags.h b/gdb/symfile-add-flags.h
index 4d5f58a..c2c6fd2 100644
--- a/gdb/symfile-add-flags.h
+++ b/gdb/symfile-add-flags.h
@@ -40,8 +40,11 @@ enum symfile_add_flag
/* Do not immediately read symbols for this file. By default,
symbols are read when the objfile is created. */
- SYMFILE_NO_READ = 1 << 4
- };
+ SYMFILE_NO_READ = 1 << 4,
+
+ /* The new objfile should be marked OBJF_NOT_FILENAME. */
+ SYMFILE_NOT_FILENAME = 1 << 5,
+ };
DEF_ENUM_FLAGS_TYPE (enum symfile_add_flag, symfile_add_flags);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 846aabe..ff1e726 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -876,7 +876,7 @@ read_symbols (struct objfile *objfile, symfile_add_flags add_flags)
section. Therefore use also non-canonical name form for the same
file containing the section. */
symbol_file_add_separate (abfd.get (), objfile->original_name,
- add_flags, objfile);
+ add_flags | SYMFILE_NOT_FILENAME, objfile);
}
}
if ((add_flags & SYMFILE_NO_READ) == 0)
@@ -1143,6 +1143,8 @@ symbol_file_add_with_addrs (bfd *abfd, const char *name,
flags |= OBJF_READNOW;
add_flags &= ~SYMFILE_NO_READ;
}
+ if ((add_flags & SYMFILE_NOT_FILENAME) != 0)
+ flags |= OBJF_NOT_FILENAME;
/* Give user a chance to burp if we'd be
interactively wiping out any existing symbols. */
--
2.9.3
next prev parent reply other threads:[~2017-04-13 4:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-13 4:17 [RFA 0/2] Fix PR cli/19551 Tom Tromey
2017-04-13 4:17 ` [RFA 2/2] PR cli/19551 - change formatting of "Reading symbols" messages Tom Tromey
2017-04-18 17:43 ` Pedro Alves
2017-04-18 17:44 ` Pedro Alves
2017-04-20 0:11 ` Tom Tromey
2017-04-27 21:40 ` Simon Marchi
2017-04-27 23:16 ` Tom Tromey
2017-04-27 23:53 ` Simon Marchi
2017-05-29 17:24 ` Tom Tromey
2017-04-13 4:44 ` Tom Tromey [this message]
2017-04-18 17:42 ` [RFA 1/2] Use a distinguishing name for minidebug objfile Pedro Alves
2017-04-19 3:11 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170413041504.14435-2-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox