* [PATCH] Avoid crash with GCC trunk
@ 2021-05-06 16:42 Tom Tromey
2021-05-17 19:02 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2021-05-06 16:42 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Avoid crash with GCC trunk
2021-05-06 16:42 [PATCH] Avoid crash with GCC trunk Tom Tromey
@ 2021-05-17 19:02 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2021-05-17 19:02 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:
Tom> With GCC trunk, gdb.ada/access_to_packed_array.exp causes a GDB crash.
Tom> The problem is that ptype tries to resolve a dynamic type. However,
Tom> the inferior is not running, so there are no frames.
Tom> This patch updates dwarf2_evaluate_loc_desc::get_frame_base to handle
Tom> this situation.
I'm checking this in.
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-17 19:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 16:42 [PATCH] Avoid crash with GCC trunk Tom Tromey
2021-05-17 19:02 ` Tom Tromey
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).