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  <tromey@adacore.com>

	* dwarf2/loc.c (dwarf2_evaluate_loc_desc::get_frame_base): Throw
	if frame is null.
This commit is contained in:
Tom Tromey
2021-05-17 13:07:25 -06:00
parent 5917321695
commit 9e541c7918
2 changed files with 8 additions and 0 deletions

View File

@@ -1,3 +1,8 @@
2021-05-17 Tom Tromey <tromey@adacore.com>
* dwarf2/loc.c (dwarf2_evaluate_loc_desc::get_frame_base): Throw
if frame is null.
2021-05-17 Tom Tromey <tromey@adacore.com>
* nat/linux-osdata.c (user_from_uid, time_from_time_t)

View File

@@ -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. */