From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Kettenis To: eli@gnu.org Cc: gdb-patches@sources.redhat.com Subject: [PATCH, RFC]: Change order of setting i386 debug registers Date: Sat, 31 Mar 2001 07:56:00 -0000 Message-id: <200103311556.f2VFu2O00222@delius.kettenis.local> X-SW-Source: 2001-03/msg00576.html Hi Eli, FreeBSD/i386 does some strict checking on the debug registers before setting them. This conflicts a bit with the order in which the code in i386-nat.c tries to set the registers. The attached patch fixes these problems by changing the order in which we modify the registers. Instead of enabling an address register before storing the proper address in it, after the patch, we will first store the address and then enable the address register. This seems more correct to me. Any objections to checking this in? Mark Index: ChangeLog from Mark Kettenis * i386-nat.c (i386_insert_aligned_watchpoint): Set address register before enabling it by setting the control register. (i386_remove_aligned_watchpoint): Reset address register after disabling it by setting the control register. Index: i386-nat.c =================================================================== RCS file: /cvs/src/src/gdb/i386-nat.c,v retrieving revision 1.1 diff -u -p -r1.1 i386-nat.c --- i386-nat.c 2001/03/21 11:36:56 1.1 +++ i386-nat.c 2001/03/31 15:47:54 @@ -356,8 +356,8 @@ i386_insert_aligned_watchpoint (CORE_ADD dr_control_mirror &= I386_DR_CONTROL_MASK; /* Finally, actually pass the info to the inferior. */ - I386_DR_LOW_SET_CONTROL (dr_control_mirror); I386_DR_LOW_SET_ADDR (i, addr); + I386_DR_LOW_SET_CONTROL (dr_control_mirror); return 0; } @@ -384,8 +384,8 @@ i386_remove_aligned_watchpoint (CORE_ADD dr_mirror[i] = 0; I386_DR_DISABLE (i); /* Reset it in the inferior. */ - I386_DR_LOW_RESET_ADDR (i); I386_DR_LOW_SET_CONTROL (dr_control_mirror); + I386_DR_LOW_RESET_ADDR (i); } retval = 0; }