This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA/RFC 3] Remove hardware break and watchpoints at program exit.
At 14:19 12/01/02 +0100, Mark Kettenis wrote:
>Pierre Muller <muller@cerbere.u-strasbg.fr> writes:
>
>> After the previous discussion about the
>> hardware watch and breakpoint removal
>> about the debuggee exited. I slightly modifed my patch
>> by adding a test to avoid calling ptrace
>> in i386-linux-nat.c, i386bsd-nat.c and x86-64-linux-nat.c
>> i386_linux_dr_set, i386bsd_dr_set and x86_64_linux_dr_set functions
>> if taget_has_execution is 0.
>
>That should not be necessary. Those functions shouldn't be called
>when there is no debuggee. I suspect that there is something wrong
>with the hardware breakpoint/watchpoint implementation at a much
>higher level.
There was no call tp ptrace before my patch,
but as Eli thought that the right solution would be to remove the
hardware break and watchpoints at exit, I tried to implement this.
But that implementation then ran into that
problem that the code in i386-linux-nat.c,
i386bsd-nat.c and x86-64-linux-nat.c
implicitly supposed that the debuggee was still running...
So here there is a conflict between
i386-nat code that would work cleaner if
we remove the hardware break and watchpoint at exit
(and which works correctly for go32v2
and my still uncommitted patch for win32-nat)
and the code that use ptrace.
I did quite agree with Eli that its cleaner
to remove those breakpoints, but if you prefer, I could
resubmit a patch where the macros that
trigger the removal are only set for go32v2 and
win32 targets. As long as we also call i386_cleanup_dregs
function, it should solve the bug present in 5.1
version, by which a watchpoint does not work anymore after
a rerun of the debuggee.