aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHui Li <lihui@loongson.cn>2025-01-06 18:21:21 +0800
committerTiezhu Yang <yangtiezhu@loongson.cn>2025-01-15 21:30:51 +0800
commitf6f845bb3533fe145285526a09ef4a03dc9fd8b6 (patch)
tree921276a52ec886219bc67782d8c6d8560c945553
parent072fa8ed047b5bffd8fca509b50cecfc9b090d34 (diff)
downloadgdb-f6f845bb3533fe145285526a09ef4a03dc9fd8b6.zip
gdb-f6f845bb3533fe145285526a09ef4a03dc9fd8b6.tar.gz
gdb-f6f845bb3533fe145285526a09ef4a03dc9fd8b6.tar.bz2
gdb: LoongArch: Adjust loongarch_{get,remove}_debug_reg_state()
loongarch_{get,remove}_debug_reg_state() are used as helper functions by loongarch_linux_nat_target. We should move their definitions from gdb/nat/loongarch-linux-hw-point.c to gdb/loongarch-linux-nat.c. Signed-off-by: Hui Li <lihui@loongson.cn> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
-rw-r--r--gdb/loongarch-linux-nat.c24
-rw-r--r--gdb/nat/loongarch-linux-hw-point.c25
-rw-r--r--gdb/nat/loongarch-linux-hw-point.h5
3 files changed, 24 insertions, 30 deletions
diff --git a/gdb/loongarch-linux-nat.c b/gdb/loongarch-linux-nat.c
index fd3581b..0735992 100644
--- a/gdb/loongarch-linux-nat.c
+++ b/gdb/loongarch-linux-nat.c
@@ -32,6 +32,30 @@
#include <asm/ptrace.h>
+/* Hash table storing per-process data. We don't bind this to a
+ per-inferior registry because of targets like x86 GNU/Linux that
+ need to keep track of processes that aren't bound to any inferior
+ (e.g., fork children, checkpoints). */
+
+static std::unordered_map<pid_t, loongarch_debug_reg_state>
+loongarch_debug_process_state;
+
+/* See nat/loongarch-linux-hw-point.h. */
+
+struct loongarch_debug_reg_state *
+loongarch_get_debug_reg_state (pid_t pid)
+{
+ return &loongarch_debug_process_state[pid];
+}
+
+/* Remove any existing per-process debug state for process PID. */
+
+static void
+loongarch_remove_debug_reg_state (pid_t pid)
+{
+ loongarch_debug_process_state.erase (pid);
+}
+
/* LoongArch Linux native additions to the default Linux support. */
class loongarch_linux_nat_target final : public linux_nat_trad_target
diff --git a/gdb/nat/loongarch-linux-hw-point.c b/gdb/nat/loongarch-linux-hw-point.c
index 9c39cce..26a88ee 100644
--- a/gdb/nat/loongarch-linux-hw-point.c
+++ b/gdb/nat/loongarch-linux-hw-point.c
@@ -36,14 +36,6 @@
#include "elf/common.h"
-/* Hash table storing per-process data. We don't bind this to a
- per-inferior registry because of targets like x86 GNU/Linux that
- need to keep track of processes that aren't bound to any inferior
- (e.g., fork children, checkpoints). */
-
-static std::unordered_map<pid_t, loongarch_debug_reg_state>
-loongarch_debug_process_state;
-
/* See loongarch-linux-hw-point.h */
/* Helper for loongarch_notify_debug_reg_change. Records the
@@ -219,20 +211,3 @@ loongarch_linux_get_debug_reg_capacity (int tid)
loongarch_num_bp_regs = 0;
}
}
-
-/* Return the debug register state for process PID. If no existing
- state is found for this process, create new state. */
-
-struct loongarch_debug_reg_state *
-loongarch_get_debug_reg_state (pid_t pid)
-{
- return &loongarch_debug_process_state[pid];
-}
-
-/* Remove any existing per-process debug state for process PID. */
-
-void
-loongarch_remove_debug_reg_state (pid_t pid)
-{
- loongarch_debug_process_state.erase (pid);
-}
diff --git a/gdb/nat/loongarch-linux-hw-point.h b/gdb/nat/loongarch-linux-hw-point.h
index 161db92..3efc9a7 100644
--- a/gdb/nat/loongarch-linux-hw-point.h
+++ b/gdb/nat/loongarch-linux-hw-point.h
@@ -113,9 +113,4 @@ void loongarch_linux_get_debug_reg_capacity (int tid);
struct loongarch_debug_reg_state *loongarch_get_debug_reg_state (pid_t pid);
-/* Remove any existing per-process debug state for process PID. */
-
-void loongarch_remove_debug_reg_state (pid_t pid);
-
-
#endif /* GDB_NAT_LOONGARCH_LINUX_HW_POINT_H */