This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch 0/4] hw watchpoints across fork() + multi-inf
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 6 Dec 2010 12:11:35 +0100
- Subject: [patch 0/4] hw watchpoints across fork() + multi-inf
Hi,
this is an Archer branch
archer-jankratochvil-watchpoint3
being posted here since 2007 and (different impl.) present in Fedora:
[patch] Fix disarmed hw watchpoints after inferior's fork()
http://sourceware.org/ml/gdb-patches/2007-10/msg00367.html
http://sourceware.org/ml/gdb-patches/2007-11/msg00454.html
http://sourceware.org/ml/gdb-patches/2008-01/msg00042.html
[patch 4/4] Fix hw watchpoints: across fork()
http://sourceware.org/ml/gdb-patches/2009-08/msg00258.html
http://sourceware.org/ml/gdb-patches/2009-11/msg00353.html
problem #1: Disarmed watchpoints - watchpoints are not caught after fork().
problem #2: Leftover watchpoints - there will be a core file from the child.
(on very recent Linux kernels it no longer crashes - see [patch 3/4])
echo 'int v;main(){fork();v++;}'|gcc -g -x c -;(ulimit -c unlimited;./gdb -nx ./a.out -ex start -ex 'watch v' -ex c -ex q)
Only (part of) the main testcase remained; the code did not expect
multi-inferior and for multi-inferior it would have to be reimplemented later
anyway. Therefore at least this patch also fixes hw watchpoints to be
multi-inferior capable/compatible.
Currently the hw watchpoints are made specific to one inferior.
There is no way to create a single watchpoint across-all-inferiors.
Currently they were set globally but they SIGTRAP various way in
multi-inferior mode. More of this per-inferior differentiation is probably
in the scope of Tom Tromey's multi-inferior breakpoints work.
The hw watchpoints are now tracked per-PID. While one can create
breakpoints/watchpoints also per-TID (by the "thread" keyword) this is
currently (inefficiently) implemented only by GDB evaluation while the
breakpoints/watchpoints are still global per-PID, for all TIDs.
I do not try to target this performance optimization in this patch.
This is only linux-nat fix; gdbserver FAILs on these testcases now.
Still remains a problem of hw watchpoints being silently ignored in some
virtual machines, at least:
* qemu-system-x86_64 0.9.1-6.fc9.x86_64
* qemu-kvm kvm-65-7.fc9.x86_64 + kernel-2.6.25.9-76.fc9.x86_64.
There should be a runtime test to verify the watchpoints work, like linux-nat.c
has already some other runtime tests. But that would be an unrelated patch.
The ppc part is only tested on non-BookE (=DABR) machine (RHEL-6). It fixes
there some new testcases but still many `set follow-fork-mode child' FAIL but I
find it as an unrelated problem:
Error in re-setting breakpoint 1: reading register r31 (#31): No such process.^M
No regressions on {x86_64,x86_64-m32,i686}-fedora14-linux-gnu.
Thanks,
Jan