From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Avoid crash with GCC trunk
Date: Thu, 6 May 2021 10:42:51 -0600 [thread overview]
Message-ID: <20210506164251.1480602-1-tromey@adacore.com> (raw)
With GCC trunk, gdb.ada/access_to_packed_array.exp causes a GDB crash.
The problem is that ptype tries to resolve a dynamic type. However,
the inferior is not running, so there are no frames.
This patch updates dwarf2_evaluate_loc_desc::get_frame_base to handle
this situation.
gdb/ChangeLog
2021-05-06 Tom Tromey <tromey@adacore.com>
* dwarf2/loc.c (dwarf2_evaluate_loc_desc::get_frame_base): Throw
if frame is null.
---
gdb/ChangeLog | 5 +++++
gdb/dwarf2/loc.c | 3 +++
2 files changed, 8 insertions(+)
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index aec50da4b6d..e816f926696 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -785,6 +785,9 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
its length in LENGTH. */
void get_frame_base (const gdb_byte **start, size_t * length) override
{
+ if (frame == nullptr)
+ error (_("frame address is not available."));
+
/* FIXME: cagney/2003-03-26: This code should be using
get_frame_base_address(), and then implement a dwarf2 specific
this_base method. */
--
2.26.3
next reply other threads:[~2021-05-06 16:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-06 16:42 Tom Tromey [this message]
2021-05-17 19:02 ` 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=20210506164251.1480602-1-tromey@adacore.com \
--to=tromey@adacore.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).