From 277941710e61f7716c0c48db467fec2d35d04c48 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 1 Sep 2022 17:07:43 -0700 Subject: [PATCH] Retire gdbarch_get/set_cap_tag_from_address. These methods are no longer used as core GDB code now reads and writes capabilities atomically. --- gdb/aarch64-linux-tdep.c | 38 -------------------------------- gdb/arch-utils.c | 15 ------------- gdb/arch-utils.h | 8 ------- gdb/gdbarch-components.py | 22 ------------------- gdb/gdbarch-gen.h | 12 ---------- gdb/gdbarch.c | 46 --------------------------------------- 6 files changed, 141 deletions(-) diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index c19425b32a8..444acea9654 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -2193,40 +2193,6 @@ aarch64_linux_decode_memtag_section (struct gdbarch *gdbarch, return tags; } -/* AArch64 Linux implementation of the get_cap_tag_from_address gdbarch - hook. Returns the tag from the capability located at ADDR. */ - -static bool -aarch64_linux_get_cap_tag_from_address (struct gdbarch *gdbarch, CORE_ADDR addr) -{ - gdb::byte_vector cap; - - cap = target_read_capability (addr); - - if (cap.size () == 0) - return false; - - return cap[0] != 0; -} - -/* AArch64 Linux implementation of the set_cap_tag_from_address gdbarch - hook. Sets the tag from the capability located at ADDR to TAG. */ - -static void -aarch64_linux_set_cap_tag_from_address (struct gdbarch *gdbarch, CORE_ADDR addr, - bool tag) -{ - gdb::byte_vector cap; - - /* Read original capability at ADDR. */ - cap = target_read_capability (addr); - - cap[0] = tag? 1 : 0; - - /* Write back the same contents but with a custom tag. */ - target_write_capability (addr, cap); -} - /* Implement the maintenance print capability tag command. */ static void @@ -2658,10 +2624,6 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_report_signal_info (gdbarch, aarch64_linux_report_signal_info); - set_gdbarch_get_cap_tag_from_address (gdbarch, - aarch64_linux_get_cap_tag_from_address); - set_gdbarch_set_cap_tag_from_address (gdbarch, - aarch64_linux_set_cap_tag_from_address); add_cmd ("cap_from_addr", class_maintenance, maint_print_cap_from_addr_cmd, diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index e81c4596a3b..821b2390f7e 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -1092,21 +1092,6 @@ default_read_core_file_mappings { } -/* See arch-utils.h. */ -bool default_get_cap_tag_from_address (struct gdbarch *gdbarch, - CORE_ADDR addr) -{ - return false; -} - -/* See arch-utils.h. */ -void -default_set_cap_tag_from_address (struct gdbarch *gdbarch, - CORE_ADDR addr, bool tag) -{ - return; -} - /* See arch-utils.h. */ void diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index c665b0b6869..c6e9ea69d3e 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -301,14 +301,6 @@ extern void default_read_core_file_mappings read_core_file_mappings_pre_loop_ftype pre_loop_cb, read_core_file_mappings_loop_ftype loop_cb); -/* Default implementation of gdbarch_cap_tag_from_address. */ -extern bool default_get_cap_tag_from_address (struct gdbarch *gdbarch, - CORE_ADDR addr); - -/* Default implementation of gdbarch_set_cap_tag_from_address. */ -extern void default_set_cap_tag_from_address (struct gdbarch *gdbarch, - CORE_ADDR addr, bool tag); - /* Default implementation of gdbarch_print_cap_attributes. */ extern void default_print_cap (struct gdbarch *gdbarch, const gdb_byte *contents, bool tag, bool compact, diff --git a/gdb/gdbarch-components.py b/gdb/gdbarch-components.py index a08063f2f4e..6a691cf8d4b 100644 --- a/gdb/gdbarch-components.py +++ b/gdb/gdbarch-components.py @@ -1021,28 +1021,6 @@ register. Normally the identity mapping. invalid=False, ) -Method( - comment=""" -Return the tag from a capability stored at address ADDR. -""", - type="bool", - name="get_cap_tag_from_address", - params=[("CORE_ADDR", "addr")], - predefault="default_get_cap_tag_from_address", - invalid=False, -) - -Method( - comment=""" -Set the tag from a capability stored at address ADDR to TAG. -""", - type="void", - name="set_cap_tag_from_address", - params=[("CORE_ADDR", "addr"), ("bool", "tag")], - predefault="default_set_cap_tag_from_address", - invalid=False, -) - Method( comment=""" Print value of a capability containing CONTENTS and TAG to STREAM. diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h index 5593da3ce81..d3314cb6d8f 100644 --- a/gdb/gdbarch-gen.h +++ b/gdb/gdbarch-gen.h @@ -547,18 +547,6 @@ typedef int (gdbarch_remote_register_number_ftype) (struct gdbarch *gdbarch, int extern int gdbarch_remote_register_number (struct gdbarch *gdbarch, int regno); extern void set_gdbarch_remote_register_number (struct gdbarch *gdbarch, gdbarch_remote_register_number_ftype *remote_register_number); -/* Return the tag from a capability stored at address ADDR. */ - -typedef bool (gdbarch_get_cap_tag_from_address_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr); -extern bool gdbarch_get_cap_tag_from_address (struct gdbarch *gdbarch, CORE_ADDR addr); -extern void set_gdbarch_get_cap_tag_from_address (struct gdbarch *gdbarch, gdbarch_get_cap_tag_from_address_ftype *get_cap_tag_from_address); - -/* Set the tag from a capability stored at address ADDR to TAG. */ - -typedef void (gdbarch_set_cap_tag_from_address_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr, bool tag); -extern void gdbarch_set_cap_tag_from_address (struct gdbarch *gdbarch, CORE_ADDR addr, bool tag); -extern void set_gdbarch_set_cap_tag_from_address (struct gdbarch *gdbarch, gdbarch_set_cap_tag_from_address_ftype *set_cap_tag_from_address); - /* Print value of a capability containing CONTENTS and TAG to STREAM. */ typedef void (gdbarch_print_cap_ftype) (struct gdbarch *gdbarch, const gdb_byte *contents, bool tag, bool compact, struct ui_file *stream); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index c6766d9bee4..dec322d7ac5 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -130,8 +130,6 @@ struct gdbarch CORE_ADDR decr_pc_after_break; CORE_ADDR deprecated_function_start_offset; gdbarch_remote_register_number_ftype *remote_register_number; - gdbarch_get_cap_tag_from_address_ftype *get_cap_tag_from_address; - gdbarch_set_cap_tag_from_address_ftype *set_cap_tag_from_address; gdbarch_print_cap_ftype *print_cap; gdbarch_print_cap_attributes_ftype *print_cap_attributes; gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address; @@ -330,8 +328,6 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint; gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint; gdbarch->remote_register_number = default_remote_register_number; - gdbarch->get_cap_tag_from_address = default_get_cap_tag_from_address; - gdbarch->set_cap_tag_from_address = default_set_cap_tag_from_address; gdbarch->print_cap = default_print_cap; gdbarch->print_cap_attributes = default_print_cap_attributes; gdbarch->unwind_pc = default_unwind_pc; @@ -498,8 +494,6 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of decr_pc_after_break, invalid_p == 0 */ /* Skip verify of deprecated_function_start_offset, invalid_p == 0 */ /* Skip verify of remote_register_number, invalid_p == 0 */ - /* Skip verify of get_cap_tag_from_address, invalid_p == 0 */ - /* Skip verify of set_cap_tag_from_address, invalid_p == 0 */ /* Skip verify of print_cap, invalid_p == 0 */ /* Skip verify of print_cap_attributes, invalid_p == 0 */ /* Skip verify of fetch_tls_load_module_address, has predicate. */ @@ -951,12 +945,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_filtered (file, "gdbarch_dump: remote_register_number = <%s>\n", host_address_to_string (gdbarch->remote_register_number)); - fprintf_filtered (file, - "gdbarch_dump: get_cap_tag_from_address = <%s>\n", - host_address_to_string (gdbarch->get_cap_tag_from_address)); - fprintf_filtered (file, - "gdbarch_dump: set_cap_tag_from_address = <%s>\n", - host_address_to_string (gdbarch->set_cap_tag_from_address)); fprintf_filtered (file, "gdbarch_dump: print_cap = <%s>\n", host_address_to_string (gdbarch->print_cap)); @@ -3002,40 +2990,6 @@ set_gdbarch_remote_register_number (struct gdbarch *gdbarch, gdbarch->remote_register_number = remote_register_number; } -bool -gdbarch_get_cap_tag_from_address (struct gdbarch *gdbarch, CORE_ADDR addr) -{ - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->get_cap_tag_from_address != NULL); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_get_cap_tag_from_address called\n"); - return gdbarch->get_cap_tag_from_address (gdbarch, addr); -} - -void -set_gdbarch_get_cap_tag_from_address (struct gdbarch *gdbarch, - gdbarch_get_cap_tag_from_address_ftype get_cap_tag_from_address) -{ - gdbarch->get_cap_tag_from_address = get_cap_tag_from_address; -} - -void -gdbarch_set_cap_tag_from_address (struct gdbarch *gdbarch, CORE_ADDR addr, bool tag) -{ - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->set_cap_tag_from_address != NULL); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_set_cap_tag_from_address called\n"); - gdbarch->set_cap_tag_from_address (gdbarch, addr, tag); -} - -void -set_gdbarch_set_cap_tag_from_address (struct gdbarch *gdbarch, - gdbarch_set_cap_tag_from_address_ftype set_cap_tag_from_address) -{ - gdbarch->set_cap_tag_from_address = set_cap_tag_from_address; -} - void gdbarch_print_cap (struct gdbarch *gdbarch, const gdb_byte *contents, bool tag, bool compact, struct ui_file *stream) { -- 2.47.2