This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA] Fix problem with i386 watchpoints after restarting
- From: Pierre Muller <muller at cerbere dot u-strasbg dot fr>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 04 Jun 2002 13:39:46 +0200
- Subject: [RFA] Fix problem with i386 watchpoints after restarting
After much efforts to find a reasonable solution for
the bug that I already explained several times,
I think that I found an easy solution.
See http://sources.redhat.com/ml/gdb-patches/2001-11/msg00613.html
and all related threads.
In short, most i386 targets using the common hardware watchpoint code do
not call i386_cleanup_dregs
and this leads to big troubles because
on a second run of a debugged program the watchpoint is not
inserted correctly.
This patch does call i386_cleanup_dregs for
all i386 targets that define
I386_USE_GENERIC_WATCHPOINTS
by simply defining a custom
child_post_startup_inferior function
in the part of i386-nat.c code
that depends on the
I386_USE_GENERIC_WATCHPOINTS
conditional.
Only drawback of that is that this
function does not seem to be
multi-arch compatible,
but does it make sense to have
native code multi-arched?
ChangeLog entry:
2002-06-04 Pierre Muller <muller@ics.u-strasbg.fr>
* i386-nat.c (child_post_startup_inferior): New function
calling i386_cleanup_dregs if
I386_USE_GENERIC_WATCHPOINTS is defined.
* config/i386/nm-i386.h: define CHILD_POST_STARTUP_INFERIOR
conditional to acknowledge that i386-nat.c has its
own child_post_startup_inferior function.
Index: i386-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-nat.c,v
retrieving revision 1.4
diff -u -p -r1.4 i386-nat.c
--- i386-nat.c 21 Sep 2001 07:16:03 -0000 1.4
+++ i386-nat.c 4 Jun 2002 10:58:17 -0000
@@ -230,6 +230,12 @@ i386_cleanup_dregs (void)
dr_status_mirror = 0;
}
+void
+child_post_startup_inferior (ptid_t ptid)
+{
+ i386_cleanup_dregs ();
+}
+
/* Print the values of the mirrored debug registers.
This is called when maint_show_dr is non-zero. To set that
up, type "maint show-debug-regs" at GDB's prompt. */
Index: config/i386/nm-i386.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-i386.h,v
retrieving revision 1.2
diff -u -p -r1.2 nm-i386.h
--- config/i386/nm-i386.h 23 Mar 2001 16:17:45 -0000 1.2
+++ config/i386/nm-i386.h 4 Jun 2002 10:58:18 -0000
@@ -30,6 +30,9 @@
#define TARGET_HAS_HARDWARE_WATCHPOINTS
#endif
+/* Use child_post_startup_inferior to reset all debug registers */
+#define CHILD_POST_STARTUP_INFERIOR
+
/* Clear the reference counts and forget everything we knew about DRi. */
extern void i386_cleanup_dregs (void);
Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99