[gdb] Fix "value is not available" with debug frame

On arm-linux, with a started hello world, running "info frame" works fine, but
when I set debug frame to on, I run into:
...
(gdb) info frame
  ...
[frame] frame_unwind_register_value: exit
value is not available
(gdb)
...

The problem is here in frame_unwind_register_value:
...
          if (value->lazy ())
            gdb_printf (&debug_file, " lazy");
          else
            {
              int i;
              gdb::array_view<const gdb_byte> buf = value->contents ();
...
where we call value->contents () while !value->entirely_available ().

Fix this by checking value->entirely_available () and printing:
...
    [frame] frame_unwind_register_value:   -> register=91 unavailable
...

Tested on arm-linux.

PR gdb/31369
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31369
This commit is contained in:
Tom de Vries
2024-02-26 15:31:34 +01:00
parent 4a4fd10d17
commit 2aaba74446
4 changed files with 106 additions and 0 deletions

View File

@@ -1315,6 +1315,8 @@ frame_unwind_register_value (const frame_info_ptr &next_frame, int regnum)
if (value->lazy ())
gdb_printf (&debug_file, " lazy");
else if (!value->entirely_available ())
gdb_printf (&debug_file, " unavailable");
else
{
int i;