public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] x86-nat: Add x86_lookup_debug_reg_state.
@ 2022-03-22 22:53 John Baldwin
0 siblings, 0 replies; only message in thread
From: John Baldwin @ 2022-03-22 22:53 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b1babce7c31def7fb894875136788490b167f989
commit b1babce7c31def7fb894875136788490b167f989
Author: John Baldwin <jhb@FreeBSD.org>
Date: Tue Mar 22 12:05:43 2022 -0700
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.
Diff:
---
gdb/x86-nat.c | 12 ++++++++++++
gdb/x86-nat.h | 5 +++++
2 files changed, 17 insertions(+)
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 *
diff --git a/gdb/x86-nat.h b/gdb/x86-nat.h
index 913291a2305..d9c2a3f6e14 100644
--- a/gdb/x86-nat.h
+++ b/gdb/x86-nat.h
@@ -40,6 +40,11 @@ extern void x86_set_debug_register_length (int len);
extern void x86_cleanup_dregs (void);
+/* Return the debug register state for process PID. If no existing
+ state is found for this process, return nullptr. */
+
+struct x86_debug_reg_state *x86_lookup_debug_reg_state (pid_t pid);
+
/* Called whenever GDB is no longer debugging process PID. It deletes
data structures that keep track of debug register state. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-22 22:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 22:53 [binutils-gdb] x86-nat: Add x86_lookup_debug_reg_state John Baldwin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).