aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.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/gdbarch.c
parentfdfc8cf7f04e2f4d24ec9fff331ebd71a2e768a3 (diff)
downloadfsf-binutils-gdb-aa7ca1bb443e8c2baad17392f395d1556fecfafa.zip
fsf-binutils-gdb-aa7ca1bb443e8c2baad17392f395d1556fecfafa.tar.gz
fsf-binutils-gdb-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/gdbarch.c')
-rw-r--r--gdb/gdbarch.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 725b98f..7b93d00 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -358,6 +358,7 @@ struct gdbarch
char ** disassembler_options;
const disasm_options_and_args_t * valid_disassembler_options;
gdbarch_type_align_ftype *type_align;
+ gdbarch_get_pc_address_flags_ftype *get_pc_address_flags;
};
/* Create a new ``struct gdbarch'' based on information provided by
@@ -473,6 +474,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
gdbarch->gnu_triplet_regexp = default_gnu_triplet_regexp;
gdbarch->addressable_memory_unit_size = default_addressable_memory_unit_size;
gdbarch->type_align = default_type_align;
+ gdbarch->get_pc_address_flags = default_get_pc_address_flags;
/* gdbarch_alloc() */
return gdbarch;
@@ -721,6 +723,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of disassembler_options, invalid_p == 0 */
/* Skip verify of valid_disassembler_options, invalid_p == 0 */
/* Skip verify of type_align, invalid_p == 0 */
+ /* Skip verify of get_pc_address_flags, invalid_p == 0 */
if (!log.empty ())
internal_error (__FILE__, __LINE__,
_("verify_gdbarch: the following are invalid ...%s"),
@@ -1066,6 +1069,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: get_longjmp_target = <%s>\n",
host_address_to_string (gdbarch->get_longjmp_target));
fprintf_unfiltered (file,
+ "gdbarch_dump: get_pc_address_flags = <%s>\n",
+ host_address_to_string (gdbarch->get_pc_address_flags));
+ fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_get_siginfo_type_p() = %d\n",
gdbarch_get_siginfo_type_p (gdbarch));
fprintf_unfiltered (file,
@@ -5156,6 +5162,23 @@ set_gdbarch_type_align (struct gdbarch *gdbarch,
gdbarch->type_align = type_align;
}
+std::string
+gdbarch_get_pc_address_flags (struct gdbarch *gdbarch, frame_info *frame, CORE_ADDR pc)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->get_pc_address_flags != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_get_pc_address_flags called\n");
+ return gdbarch->get_pc_address_flags (frame, pc);
+}
+
+void
+set_gdbarch_get_pc_address_flags (struct gdbarch *gdbarch,
+ gdbarch_get_pc_address_flags_ftype get_pc_address_flags)
+{
+ gdbarch->get_pc_address_flags = get_pc_address_flags;
+}
+
/* Keep a registry of per-architecture data-pointers required by GDB
modules. */