[RFA] Fix troubles with watchpoints in DJGPP

Pierre Muller (IMAP)
2009-05-27T07:49:04Z

I finally managed to be able to compile current CVS
with DJGPP v2.03.

I also tried to use it but I have several problems,
some are probably DJGPP specific
(bad file descriptor errors when trying to restart
a ./gdb executable at level 2, meaning inside another gdb
itself being debugged by gdb).

The reason of that email is the behavior for watchpoints:

When I set a watchpoint before starting a program in cygwin,
the type is first set to 'software watchpoint'
and then modified to 'hardware_watchpoint' (if the watch memory size
is compatible with debug register limitations for i386) during
initialization.
But this does not happen for DJGPP
if I set a watchpoint before starting on a pointer,
it never is changed to a hardware watchpoint.

After some debugging, I realized that
DJGPP only calls insert_breakpoints ()
that does call update_watchpoint with reparse set to one,
after pushing go32 target,
while with cygwin, the DLL loaded caused a
reloading of all breakpoints and triggered a
call to update_watchpoint with reparse = 1.

This one line patch fixes the problem.

Is this patch OK?

Pierre Muller
Pascal language support maintainer for GDB

PS-1) Are there not other native targets, without
dynamic libraries, that will suffer the same troubles?
PS-2) Eli,
do you have anything that could help me debug the
Bad file descriptor problems, like a library recording
file opening/closing using the DJGPP file system extensions?

ChangeLog entry:

2009-05-27 Pierre Muller <muller@ics.u-strasbg.fr>

* go32-nat.c (go32_create_inferior): Add call to breakpoint_re_set.

Index: go32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/go32-nat.c,v
retrieving revision 1.76
diff -u -p -r1.76 go32-nat.c
--- go32-nat.c 21 May 2009 15:48:41 -0000 1.76
+++ go32-nat.c 27 May 2009 07:44:50 -0000
@@ -721,6 +721,7 @@ go32_create_inferior (struct target_ops
add_thread_silent (inferior_ptid);

clear_proceed_status ();
+ breakpoint_re_set ();
insert_breakpoints ();
prog_has_started = 1;
}
~