diff options
author | Gary Benson <gbenson@redhat.com> | 2015-03-24 14:05:43 +0000 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2015-03-24 14:05:43 +0000 |
commit | 70a0bb6b590bcfe304fe082d421feb52e0a0d4dc (patch) | |
tree | 37aa654b17be58f52482f8c8c99092201478f690 /gdb/gdbserver | |
parent | 7b6690874fa3a8afacd731b70a461d55a5b1311c (diff) | |
download | gdb-70a0bb6b590bcfe304fe082d421feb52e0a0d4dc.zip gdb-70a0bb6b590bcfe304fe082d421feb52e0a0d4dc.tar.gz gdb-70a0bb6b590bcfe304fe082d421feb52e0a0d4dc.tar.bz2 |
Add x86_debug_reg_state to gdbserver
This commit introduces a new function, x86_debug_reg_state, that
shared x86 code can use to access the local mirror of a process's
debug registers. This function already existed in GDB and was
in use by GDB's x86_linux_prepare_to_resume. An equivalent was
written for gdbserver and gdbserver's x86_linux_prepare_to_resume
was modified to use it.
gdb/ChangeLog:
* x86-nat.h (x86_debug_reg_state): Move declaration to...
* nat/x86-dregs.h (x86_debug_reg_state): New declaration.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_debug_reg_state): New function.
(x86_linux_prepare_to_resume): Use the above.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/gdbserver/linux-x86-low.c | 16 |
2 files changed, 17 insertions, 4 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 3e51d94..49477df 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,10 @@ 2015-03-24 Gary Benson <gbenson@redhat.com> + * linux-x86-low.c (x86_debug_reg_state): New function. + (x86_linux_prepare_to_resume): Use the above. + +2015-03-24 Gary Benson <gbenson@redhat.com> + * linux-low.c (current_lwp_ptid): New function. * linux-x86-low.c: Include nat/linux-nat.h. (x86_dr_low_get_addr): Use current_lwp_ptid. diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index 66dfc5d..fe4fd25 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -776,6 +776,16 @@ x86_linux_new_thread (void) return info; } +/* See nat/x86-dregs.h. */ + +struct x86_debug_reg_state * +x86_debug_reg_state (pid_t pid) +{ + struct process_info *proc = find_process_pid (pid); + + return &proc->priv->arch_private->debug_reg_state; +} + /* Called when resuming a thread. If the debug regs have changed, update the thread's copies. */ @@ -787,11 +797,9 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp) if (lwp->arch_private->debug_registers_changed) { - int i; - int pid = ptid_get_pid (ptid); - struct process_info *proc = find_process_pid (pid); struct x86_debug_reg_state *state - = &proc->priv->arch_private->debug_reg_state; + = x86_debug_reg_state (ptid_get_pid (ptid)); + int i; x86_linux_dr_set (ptid, DR_CONTROL, 0); |