Re: [PATCHv3,Hurd] Add hardware watch support

Thomas Schwinge
2014-09-15T22:08:21Z

[-- Attachment #1: Type: text/plain, Size: 1682 bytes --]

Hi Samuel!

On Fri, 12 Sep 2014 19:56:13 +0200, I wrote:
> Many thanks for persisting with this patch. The GDB testsuite shows a
> pretty good improvement! I'll try to assess the remaining issues

From a quick scan through the »FAIL:.*watch« matches, the following one
issue should be relevant for a lot of the regressions: given, for
example, the gdb.base/pr11022 test case, on GNU/Linux we see:

$ gcc [...]/gdb/testsuite/gdb.base/pr11022.c -g -o pr11022
$ ./gdb -q -ex 'watch x' -ex run pr11022
[...]
Hardware watchpoint 1: x

Old value = 0
New value = 42
main () at ../../W._C._Handy/gdb/testsuite/gdb.base/pr11022.c:28
28 j = i; /* expect HW watchpoint stop */

... whereas on GNU Hurd we see:

[...]
Program received signal SIGTRAP, Trace/breakpoint trap.
main () at ../../../W._C._Handy/gdb/testsuite/gdb.base/pr11022.c:28
28 j = i; /* expect HW watchpoint stop */

You may want to prepend »-ex 'maintenance set show-debug-regs on'« to see
some debugging output (and notice that »watchpoint_hit« is missing on GNU
Hurd).

I tracked this down to gdb/nat/x86-dregs.c:x86_dr_stopped_data_address
and x86_dr_stopped_by_watchpoint not returning the information as
desired, and tracked that in turn down to our kernel interface always
returning zero for DR6, the debug status register. See the comment in
x86_dr_stopped_data_address for how GDB is using this information. Do
you agree that thread_get_state(i386_DEBUG_STATE) should be returning the
actual DR6, and where in GNU Mach would we need to copy the DR6 register
into the PCB?

Grüße,
Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]