[gdbserver] Fix watchpoint support on Windows
authorJoel Brobecker <brobecker@gnat.com>
Mon, 7 Nov 2011 14:45:09 +0000 (14:45 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Mon, 7 Nov 2011 14:45:09 +0000 (14:45 +0000)
commit8d26e50c573726f76d7f50fc9016a6b4bc12ca28
treed0a19207c7428f322e9f3a9af782a18660f382cf
parent855565bb2aa01b381dffa3b3f327087d368bf0bb
[gdbserver] Fix watchpoint support on Windows

Watchpoint support doesn't work anymore when using gdbserver on Windows.
They just never trigger.

The problem comes from the fact that we always set the debug registers
to zero, no matter what.  This in turn comes from the fact that we
use i386_low_insert_watchpoint to compute the DR values:

      return i386_low_insert_watchpoint (&debug_reg_state,
                                         type, addr, len);

This function saves the new values in debug_reg_state.  However,
the values we actually use when setting the DR registers are
taken from two different globals:

        static unsigned dr_status_mirror;
        static unsigned dr_control_mirror;

These are really never actually changed (their value is set from
the DR values read from the inferior, but since we never change
them, in practice, they never change).

The fix is to use the values provided by debug_reg_state, and
to eliminate the two dr_[...] globals.

gdb/gdbserver/ChangeLog:

        * win32-i386-low.c (dr_status_mirror, dr_control_mirror): Delete.
        (i386_dr_low_get_control, i386_dr_low_get_status): Use
        dr_status_mirror and dr_control_mirror from debug_reg_state.
        (i386_dr_low_get_status): Use debug_reg_state.dr_status_mirror
        (i386_initial_stuff): Remove use of deleted globals.
        (i386_get_thread_context, i386_set_thread_context,
        i386_thread_added): Use dr_status_mirror and dr_control_mirror
        from debug_reg_state.
gdb/gdbserver/ChangeLog
gdb/gdbserver/win32-i386-low.c