From 1aa7e42c3f5c5295f81ff94301c642642be86395 Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Wed, 25 Jun 2014 14:57:42 +0100 Subject: Comment and whitespace changes This commit merges the comments and whitespace in the common parts of i386-linux-nat.c and amd64-linux-nat.c. gdb/ 2014-07-11 Gary Benson * amd64-linux-nat.c: Comment and whitespace changes. * i386-linux-nat.c: Comment and whitespace changes. --- gdb/ChangeLog | 5 +++++ gdb/amd64-linux-nat.c | 3 +++ gdb/i386-linux-nat.c | 15 ++++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 46ec2af..490e652 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2014-07-11 Gary Benson + * amd64-linux-nat.c: Comment and whitespace changes. + * i386-linux-nat.c: Comment and whitespace changes. + +2014-07-11 Gary Benson + * amd64-linux-nat.c (x86_linux_create_target): New function. (x86_linux_add_target): Likewise. (_initialize_amd64_linux_nat): Delegate to the above new functions. diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c index d3a09d3..42af924 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -277,8 +277,11 @@ amd64_linux_store_inferior_registers (struct target_ops *ops, } } + /* Support for debug registers. */ +/* Get debug register REGNUM value from only the one LWP of PTID. */ + static unsigned long x86_linux_dr_get (ptid_t ptid, int regnum) { diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index f4d8d5f..1ee7503 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -732,7 +732,7 @@ update_debug_registers_callback (struct lwp_info *lwp, void *arg) return 0; } -/* Set DR_CONTROL to ADDR in all LWPs of the current inferior. */ +/* Set DR_CONTROL to CONTROL in all LWPs of the current inferior. */ static void x86_linux_dr_set_control (unsigned long control) @@ -775,9 +775,16 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp) = i386_debug_reg_state (ptid_get_pid (lwp->ptid)); int i; - /* See amd64_linux_prepare_to_resume for Linux kernel note on - i386_linux_dr_set calls ordering. */ + /* On Linux kernel before 2.6.33 commit + 72f674d203cd230426437cdcf7dd6f681dad8b0d + if you enable a breakpoint by the DR_CONTROL bits you need to have + already written the corresponding DR_FIRSTADDR...DR_LASTADDR registers. + Ensure DR_CONTROL gets written as the very last register here. */ + + /* Clear DR_CONTROL first. In some cases, setting DR0-3 to a + value that doesn't match what is enabled in DR_CONTROL + results in EINVAL. */ x86_linux_dr_set (lwp->ptid, DR_CONTROL, 0); for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) @@ -792,6 +799,8 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp) clear_status = 1; } + /* If DR_CONTROL is supposed to be zero, we've already set it + above. */ if (state->dr_control_mirror != 0) x86_linux_dr_set (lwp->ptid, DR_CONTROL, state->dr_control_mirror); -- cgit v1.1