From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH] [gdb/symtab] Handle failure to open .gnu_debugaltlink file
Date: Sat, 19 Nov 2022 11:32:16 +0100 [thread overview]
Message-ID: <20221119103216.19369-1-tdevries@suse.de> (raw)
If we instrument cc-with-tweaks.sh to remove the .gnu_debugaltlink file after
dwz has created it, with test-case
gdb.threads/access-mem-running-thread-exit.exp and target board cc-with-dwz-m
we run into:
...
(gdb) file access-mem-running-thread-exit^M
Reading symbols from access-mem-running-thread-exit...^M
could not find '.gnu_debugaltlink' file for access-mem-running-thread-exit^M
...
followed a bit later by:
...
(gdb) file access-mem-running-thread-exit^M
Reading symbols from access-mem-running-thread-exit...^M
gdb/dwarf2/read.c:7284: internal-error: create_all_units: \
Assertion `per_objfile->per_bfd->all_units.empty ()' failed.^M
...
The problem is that create_units does not catch the error thrown by
dwarf2_get_dwz_file.
Fix this by catching the error and performing the necessary cleanup, getting
the same result for the first and second file command.
PR symtab/29805
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29805
---
gdb/dwarf2/read.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 60e120a9d76..53a6a8b5e6d 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -7291,7 +7291,16 @@ create_all_units (dwarf2_per_objfile *per_objfile)
&per_objfile->per_bfd->abbrev, 0,
types_htab, rcuh_kind::TYPE);
- dwz_file *dwz = dwarf2_get_dwz_file (per_objfile->per_bfd);
+ dwz_file *dwz;
+ try
+ {
+ dwz = dwarf2_get_dwz_file (per_objfile->per_bfd);
+ }
+ catch (const gdb_exception_error &)
+ {
+ per_objfile->per_bfd->all_units.clear ();
+ throw;
+ }
if (dwz != NULL)
{
/* Pre-read the sections we'll need to construct an index. */
base-commit: 15253318be0995200cc59929ca32eedbfd041e45
--
2.35.3
next reply other threads:[~2022-11-19 10:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-19 10:32 Tom de Vries [this message]
2022-11-26 13:19 ` Tom de Vries
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=20221119103216.19369-1-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).