aboutsummaryrefslogtreecommitdiff
path: root/gdb/x86-linux-nat.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2015-03-24 14:05:44 +0000
committerGary Benson <gbenson@redhat.com>2015-03-24 14:05:44 +0000
commit2b95d4403883ba22687ecb81520855204348a7fb (patch)
tree5f6c46bcdf561123a68a355549864122098d2a83 /gdb/x86-linux-nat.c
parent14b0bc68e8a9f8e8fc3d27c64c7cf5f7c676cea1 (diff)
downloadfsf-binutils-gdb-2b95d4403883ba22687ecb81520855204348a7fb.zip
fsf-binutils-gdb-2b95d4403883ba22687ecb81520855204348a7fb.tar.gz
fsf-binutils-gdb-2b95d4403883ba22687ecb81520855204348a7fb.tar.bz2
Introduce x86_linux_update_debug_registers
This commit moves the entire body of both GDB's and gdbserver's x86_linux_prepare_to_resume functions into new functions, x86_linux_update_debug_registers. This reorganisation allows all Linux x86 low-level debug register code to be placed in one shared file, separate from general Linux x86 shared code. gdb/ChangeLog: * x86-linux-nat.c (x86_linux_update_debug_registers): New function, factored out from... (x86_linux_prepare_to_resume): ...this. gdb/gdbserver/ChangeLog: * linux-x86-low.c (x86_linux_update_debug_registers): New function, factored out from... (x86_linux_prepare_to_resume): ...this.
Diffstat (limited to 'gdb/x86-linux-nat.c')
-rw-r--r--gdb/x86-linux-nat.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index b49ef8f..9eb82c5 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -171,15 +171,17 @@ x86_linux_dr_set_addr (int regnum, CORE_ADDR addr)
iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
}
-/* Called prior to resuming a thread. Updates the thread's debug
- registers if the values in our local mirror have been changed. */
+/* Update the thread's debug registers if the values in our local
+ mirror have been changed. */
static void
-x86_linux_prepare_to_resume (struct lwp_info *lwp)
+x86_linux_update_debug_registers (struct lwp_info *lwp)
{
ptid_t ptid = ptid_of_lwp (lwp);
int clear_status = 0;
+ gdb_assert (lwp_is_stopped (lwp));
+
if (lwp_debug_registers_changed (lwp))
{
struct x86_debug_reg_state *state
@@ -217,6 +219,14 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp)
x86_linux_dr_set (ptid, DR_STATUS, 0);
}
+/* Called prior to resuming a thread. */
+
+static void
+x86_linux_prepare_to_resume (struct lwp_info *lwp)
+{
+ x86_linux_update_debug_registers (lwp);
+}
+
/* Called when a new thread is detected. */
static void