ports/devel/gdb/files/commit-b1babce7c31
John Baldwin 1c25ded0af devel/gdb: Update to 12.1.
One notable feature included in 12.1 is async target support
permitting the use of commands like continue&.

In addition, this commit backports various post-12 commits to add
support for hardware breakpoints/watchpoints on aarch64, support for
resolving TLS variables from core dumps on amd64 and i386 via the
recently added NT_X86_SEGBASES core dump note, and support for
resolving TLS variables on arm and aarch64 via the recently added
NT_ARM_TLS register set.

Reviewed by:	pizzamig
Differential Revision:	https://reviews.freebsd.org/D35111
2022-05-10 10:41:13 -07:00

50 lines
1.5 KiB
Text

commit 8a528699fdc82963d528bbbbd3f3509e1472a64b
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.
(cherry picked from commit b1babce7c31def7fb894875136788490b167f989)
diff --git a/gdb/x86-nat.c b/gdb/x86-nat.c
index c1e892bf564..36513dd8cfb 100644
--- gdb/x86-nat.c
+++ 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
--- gdb/x86-nat.h
+++ 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. */