From: Tom Tromey Date: Mon, 17 May 2021 19:07:25 +0000 (-0600) Subject: Avoid crash with GCC trunk X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9e541c7918c184aa226c1544159e37b6387ef205;p=binutils-gdb.git Avoid crash with GCC trunk 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-17 Tom Tromey * dwarf2/loc.c (dwarf2_evaluate_loc_desc::get_frame_base): Throw if frame is null. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 39cdb3a50ef..4589251f022 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2021-05-17 Tom Tromey + + * dwarf2/loc.c (dwarf2_evaluate_loc_desc::get_frame_base): Throw + if frame is null. + 2021-05-17 Tom Tromey * nat/linux-osdata.c (user_from_uid, time_from_time_t) 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 @@ public: 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. */