summaryrefslogtreecommitdiff
path: root/gdb/x86-nat.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-03-22 12:05:43 -0700
committerJohn Baldwin <jhb@FreeBSD.org>2022-03-22 12:05:43 -0700
commitb1babce7c31def7fb894875136788490b167f989 (patch)
tree7e79468da5548d20d6d802366a91a3adafb64544 /gdb/x86-nat.c
parent922c2fc18e4de33d24b6ba3b7b6e8732209a5e69 (diff)
downloadbinutils-gdb-b1babce7c31def7fb894875136788490b167f989.tar.gz
x86-nat: Add x86_lookup_debug_reg_state.
This function returns nullptr if debug register state does not yet exist for a given process rather than creating new state.
Diffstat (limited to 'gdb/x86-nat.c')
-rw-r--r--gdb/x86-nat.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/x86-nat.c b/gdb/x86-nat.c
index c1e892bf564..36513dd8cfb 100644
--- a/gdb/x86-nat.c
+++ b/gdb/x86-nat.c
@@ -46,6 +46,18 @@ struct x86_dr_low_type x86_dr_low;
static std::unordered_map<pid_t,
struct x86_debug_reg_state> x86_debug_process_state;
+/* See x86-nat.h. */
+
+struct x86_debug_reg_state *
+x86_lookup_debug_reg_state (pid_t pid)
+{
+ auto it = x86_debug_process_state.find (pid);
+ if (it != x86_debug_process_state.end ())
+ return &it->second;
+
+ return nullptr;
+}
+
/* Get debug registers state for process PID. */
struct x86_debug_reg_state *