aboutsummaryrefslogtreecommitdiff
path: root/gdb/stack.c
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2019-08-16 10:19:18 +0100
committerAlan Hayward <alan.hayward@arm.com>2019-08-16 10:19:18 +0100
commitaa7ca1bb443e8c2baad17392f395d1556fecfafa (patch)
treea5a8006f5d93879956ad07a0a184bc657e0fc69e /gdb/stack.c
parentfdfc8cf7f04e2f4d24ec9fff331ebd71a2e768a3 (diff)
downloadbinutils-aa7ca1bb443e8c2baad17392f395d1556fecfafa.zip
binutils-aa7ca1bb443e8c2baad17392f395d1556fecfafa.tar.gz
binutils-aa7ca1bb443e8c2baad17392f395d1556fecfafa.tar.bz2
Move [PAC] into a new MI field addr_flags
Add a new print_pc which prints both the PC and a new field addr_flags. Call this wherever the PC is printed in stack.c. Add a new gdbarch method get_pc_address_flags to obtain the addr_flag contents. By default returns an empty string, on AArch64 this returns PAC if the address has been masked in the frame. Document this in the manual and NEWS file. gdb/ChangeLog: * NEWS (Other MI changes): New subsection. * aarch64-tdep.c (aarch64_get_pc_address_flags): New function. (aarch64_gdbarch_init): Add aarch64_get_pc_address_flags. * arch-utils.c (default_get_pc_address_flags): New function. * arch-utils.h (default_get_pc_address_flags): New declaration. * gdbarch.sh: Add get_pc_address_flags. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * stack.c (print_pc): New function. (print_frame_info) (print_frame): Call print_pc. gdb/doc/ChangeLog: * gdb.texinfo (AArch64 Pointer Authentication) (GDB/MI Breakpoint Information) (Frame Information): Document addr_field.
Diffstat (limited to 'gdb/stack.c')
-rw-r--r--gdb/stack.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/gdb/stack.c b/gdb/stack.c
index 49b9100..06431ea 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -923,6 +923,23 @@ print_frame_info_to_print_what (const char *print_frame_info)
print_frame_info);
}
+/* Print the PC from FRAME, plus any flags, to UIOUT. */
+
+static void
+print_pc (struct ui_out *uiout, struct gdbarch *gdbarch, frame_info *frame,
+ CORE_ADDR pc)
+{
+ uiout->field_core_addr ("addr", gdbarch, pc);
+
+ std::string flags = gdbarch_get_pc_address_flags (gdbarch, frame, pc);
+ if (!flags.empty ())
+ {
+ uiout->text (" [");
+ uiout->field_string ("addr_flags", flags);
+ uiout->text ("]");
+ }
+}
+
/* See stack.h. */
void
@@ -980,8 +997,7 @@ print_frame_info (const frame_print_options &fp_opts,
if (uiout->is_mi_like_p ())
{
annotate_frame_address ();
- uiout->field_core_addr ("addr",
- gdbarch, get_frame_pc (frame));
+ print_pc (uiout, gdbarch, frame, get_frame_pc (frame));
annotate_frame_address_end ();
}
@@ -1065,8 +1081,7 @@ print_frame_info (const frame_print_options &fp_opts,
ability to decide for themselves if it is desired. */
if (opts.addressprint && mid_statement)
{
- uiout->field_core_addr ("addr",
- gdbarch, get_frame_pc (frame));
+ print_pc (uiout, gdbarch, frame, get_frame_pc (frame));
uiout->text ("\t");
}
@@ -1292,11 +1307,7 @@ print_frame (const frame_print_options &fp_opts,
{
annotate_frame_address ();
if (pc_p)
- {
- uiout->field_core_addr ("addr", gdbarch, pc);
- if (get_frame_pc_masked (frame))
- uiout->field_string ("pac", " [PAC]");
- }
+ print_pc (uiout, gdbarch, frame, pc);
else
uiout->field_string ("addr", "<unavailable>",
ui_out_style_kind::ADDRESS);