[gdb/cli] Add maint info frame-unwinders

Add a new command "maint info frame-unwinders":
...
(gdb) help maint info frame-unwinders
List the frame unwinders currently in effect, starting with the highest \
  priority.
...

Output for i386:
...
$ gdb -q -batch -ex "set arch i386" -ex "maint info frame-unwinders"
The target architecture is set to "i386".
dummy                   DUMMY_FRAME
dwarf2 tailcall         TAILCALL_FRAME
inline                  INLINE_FRAME
i386 epilogue           NORMAL_FRAME
dwarf2                  NORMAL_FRAME
dwarf2 signal           SIGTRAMP_FRAME
i386 stack tramp        NORMAL_FRAME
i386 sigtramp           SIGTRAMP_FRAME
i386 prologue           NORMAL_FRAME
...

Output for x86_64:
...
$ gdb -q -batch -ex "set arch i386:x86-64" -ex "maint info frame-unwinders"
The target architecture is set to "i386:x86-64".
dummy                   DUMMY_FRAME
dwarf2 tailcall         TAILCALL_FRAME
inline                  INLINE_FRAME
python                  NORMAL_FRAME
amd64 epilogue          NORMAL_FRAME
i386 epilogue           NORMAL_FRAME
dwarf2                  NORMAL_FRAME
dwarf2 signal           SIGTRAMP_FRAME
amd64 sigtramp          SIGTRAMP_FRAME
amd64 prologue          NORMAL_FRAME
i386 stack tramp        NORMAL_FRAME
i386 sigtramp           SIGTRAMP_FRAME
i386 prologue           NORMAL_FRAME
...

Tested on x86_64-linux.

Reviewed-By: Tom Tromey <tom@tromey.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
This commit is contained in:
Tom de Vries
2023-02-10 13:07:14 +01:00
parent 779b250278
commit be01687991
5 changed files with 46 additions and 2 deletions

View File

@ -28,6 +28,7 @@
#include "target.h"
#include "gdbarch.h"
#include "dwarf2/frame-tailcall.h"
#include "cli/cli-cmds.h"
struct frame_unwind_table_entry
{
@ -337,3 +338,34 @@ frame_unwind_got_address (frame_info_ptr frame, int regnum,
register_type (gdbarch, regnum), addr);
return reg_val;
}
/* Implement "maintenance info frame-unwinders" command. */
static void
maintenance_info_frame_unwinders (const char *args, int from_tty)
{
struct gdbarch *gdbarch = target_gdbarch ();
struct frame_unwind_table *table = get_frame_unwind_table (gdbarch);
for (struct frame_unwind_table_entry *entry = table->list; entry != NULL;
entry = entry->next)
{
const char *name = entry->unwinder->name;
const char *type = frame_type_str (entry->unwinder->type);
gdb_printf (gdb_stdout, "%-16s\t%-16s\n", name, type);
}
}
void _initialize_frame_unwind ();
void
_initialize_frame_unwind ()
{
/* Add "maint info frame-unwinders". */
add_cmd ("frame-unwinders",
class_maintenance,
maintenance_info_frame_unwinders,
_("List the frame unwinders currently in effect, "
"starting with the highest priority."),
&maintenanceinfolist);
}