[3/4] gdb: LoongArch: Adjust loongarch_stopped_data_address()
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Test passed
|
Commit Message
loongarch_stopped_data_address() is a common function and will be used by
gdb and gdbserver, so move its definition from gdb/loongarch-linux-nat.c
to gdb/nat/loongarch-hw-point.c. This is preparation for later gdbserver
patch on LoongArch and is no effect for the current code.
Signed-off-by: Hui Li <lihui@loongson.cn>
---
gdb/loongarch-linux-nat.c | 27 ---------------------------
gdb/nat/loongarch-hw-point.c | 24 ++++++++++++++++++++++++
gdb/nat/loongarch-hw-point.h | 8 ++++++++
3 files changed, 32 insertions(+), 27 deletions(-)
@@ -470,33 +470,6 @@ fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregset,
sizeof (gdb_fpregset_t));
}
-/* Helper for the "stopped_data_address" target method. Returns TRUE
- if a hardware watchpoint trap at ADDR_TRAP matches a set watchpoint.
- The address of the matched watchpoint is returned in *ADDR_P. */
-
-static bool
-loongarch_stopped_data_address (const struct loongarch_debug_reg_state *state,
- CORE_ADDR addr_trap, CORE_ADDR *addr_p)
-{
-
- int i;
-
- for (i = loongarch_num_wp_regs - 1; i >= 0; --i)
- {
- const CORE_ADDR addr_watch = state->dr_addr_wp[i];
-
- if (state->dr_ref_count_wp[i]
- && DR_CONTROL_ENABLED (state->dr_ctrl_wp[i])
- && addr_trap == addr_watch)
- {
- *addr_p = addr_watch;
- return true;
- }
- }
- return false;
-}
-
-
/* Returns the number of hardware watchpoints of type TYPE that we can
set. Value is positive if we can set CNT watchpoints, zero if
setting watchpoints of type TYPE is not supported, and negative if
@@ -317,3 +317,27 @@ loongarch_region_ok_for_watchpoint (CORE_ADDR addr, int len)
return 1;
}
+
+/* See nat/loongarch-hw-point.h*/
+
+bool
+loongarch_stopped_data_address (const struct loongarch_debug_reg_state *state,
+ CORE_ADDR addr_trap, CORE_ADDR *addr_p)
+{
+ int i;
+
+ for (i = loongarch_num_wp_regs - 1; i >= 0; --i)
+ {
+ const CORE_ADDR addr_watch = state->dr_addr_wp[i];
+
+ if (state->dr_ref_count_wp[i]
+ && DR_CONTROL_ENABLED (state->dr_ctrl_wp[i])
+ && addr_trap == addr_watch)
+ {
+ *addr_p = addr_watch;
+ return true;
+ }
+ }
+
+ return false;
+}
@@ -100,4 +100,12 @@ void loongarch_show_debug_reg_state (struct loongarch_debug_reg_state *state,
int loongarch_region_ok_for_watchpoint (CORE_ADDR addr, int len);
+/* Helper for the "stopped_data_address/low_stopped_data_address" target
+ method. Returns TRUE if a hardware watchpoint trap at ADDR_TRAP matches
+ a set watchpoint. The address of the matched watchpoint is returned in
+ *ADDR_P. */
+
+bool loongarch_stopped_data_address (const struct loongarch_debug_reg_state *state,
+ CORE_ADDR addr_trap, CORE_ADDR *addr_p);
+
#endif /* GDB_NAT_LOONGARCH_HW_POINT_H */