From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2551 invoked by alias); 8 Feb 2009 23:22:57 -0000 Received: (qmail 2543 invoked by uid 22791); 8 Feb 2009 23:22:56 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.155) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 08 Feb 2009 23:22:50 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.2/jtpda-5.5pre1) with ESMTP id n18NMiIk071103 for ; Mon, 9 Feb 2009 00:22:44 +0100 (CET) Received: from mailserver.u-strasbg.fr (ms2.u-strasbg.fr [IPv6:2001:660:2402:d::11]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id n18NMhlw094512 for ; Mon, 9 Feb 2009 00:22:44 +0100 (CET) (envelope-from muller@ics.u-strasbg.fr) Received: from d620muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id n18NMgMx016762 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Mon, 9 Feb 2009 00:22:43 +0100 (CET) (envelope-from muller@ics.u-strasbg.fr) From: "Pierre Muller" To: "'gdb-patches ml'" Subject: [RFA] Use i386_use_watchpoints for go32v2, bds and windows native Date: Sun, 08 Feb 2009 23:22:00 -0000 Message-ID: <000001c98a44$29b02a30$7d107e90$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-02/txt/msg00194.txt.bz2 I started a while ago to write a patch to add support for hardware watchpoints in windows gdbserver. After some success in writing the adequate code, I realized that this could not work with a GDB compiled for cygwin in 'target remote' mode. The reason is the following: cygwin native nm-cygwin.h header includes nm-i386.h header with I386_USE_GENERIC_WATCHPOINTS defined, but not I386_WATCHPOINTS_IN_TARGET_VECTOR. This then defines the macros target_insert_watchpoint and target_remove_watchpoint and thus even after setting 'target remote' the same i386_insert_watchpoint function is still called, whereas remote_insert_watchpoint should be called. Using 'set debug target 1' also allows to see that the current_target->to_insert_watchpoint is not called for current cygwin native GDB. The correction of this problem is easy, as it is already implemented for linux. The patch only adds #define I386_WATCHPOINTS_IN_TARGET_VECTOR to all config/i386/nm-*.h that defines I386_USE_GENERIC_WATCHPOINTS before including nm-i386.h and add the corresponding call to i386_use_watchpoints (target) in the native file when the target vector gets defined. I found only three places where this happens: nm-go32.h with native go32-nat.c nm-fbsd.h with native i386bsd-nat.c and nm-cygwin.h and nm-cygwin64.h with native windows-nat.c I was able to test that FreeBSD compiles with that patch, and that the 'set debug target 1' does write 'target_insert_watchpoint' (which is not the case without the patch). Pierre Muller Pascal language support maintainer for GDB PS1: Cygwin testsuite runs show no significant change. PS2: It could have seemed more logical to insert the call to i386_use_watchpoints to i386-windows-nat.c and amd64-windows-nat.c in case we later support other processors for windows, but the required functions cygwin_set_dr, cygwin_set_dr7 and cygwin_get_dr6 are also in windows-nat.c file, and there is still a lot of code that is i386 specific in that file... ChangeLog entry: 2009-02-08 Pierre Muller * Extend use of i386_use_watchpoints to all i386 native files using hardware watchpoints. go32-nat.c (init_go32_ops): Call i386_use_watchpoints. i386bsd-nat.c (i386bsd_target): Ditto. windows-nat.c (init_windows_ops): Ditto. config/i386/nm-cygwin.h: Define I386_WATCHPOINTS_IN_TARGET_VECTOR. config/i386/nm-cygwin64.h: Ditto. config/i386/nm-fbsd.h: Ditto. config/i386/nm-go32.h: Ditto. Index: gdb/go32-nat.c =================================================================== RCS file: /cvs/src/src/gdb/go32-nat.c,v retrieving revision 1.63 diff -u -p -r1.63 go32-nat.c --- gdb/go32-nat.c 6 Feb 2009 22:21:26 -0000 1.63 +++ gdb/go32-nat.c 8 Feb 2009 22:27:44 -0000 @@ -910,6 +910,9 @@ init_go32_ops (void) go32_ops.to_has_stack = 1; go32_ops.to_has_registers = 1; go32_ops.to_has_execution = 1; + + i386_use_watchpoints (&go32_ops); + go32_ops.to_magic = OPS_MAGIC; /* Initialize child's cwd as empty to be initialized when starting Index: gdb/i386bsd-nat.c =================================================================== RCS file: /cvs/src/src/gdb/i386bsd-nat.c,v retrieving revision 1.41 diff -u -p -r1.41 i386bsd-nat.c --- gdb/i386bsd-nat.c 3 Jan 2009 05:57:52 -0000 1.41 +++ gdb/i386bsd-nat.c 8 Feb 2009 22:27:44 -0000 @@ -248,6 +248,7 @@ i386bsd_target (void) t = inf_ptrace_target (); t->to_fetch_registers = i386bsd_fetch_inferior_registers; t->to_store_registers = i386bsd_store_inferior_registers; + i386_use_watchpoints (t); return t; } Index: gdb/windows-nat.c =================================================================== RCS file: /cvs/src/src/gdb/windows-nat.c,v retrieving revision 1.179 diff -u -p -r1.179 windows-nat.c --- gdb/windows-nat.c 6 Feb 2009 22:21:26 -0000 1.179 +++ gdb/windows-nat.c 8 Feb 2009 22:27:46 -0000 @@ -2135,6 +2135,8 @@ init_windows_ops (void) windows_ops.to_has_registers = 1; windows_ops.to_has_execution = 1; windows_ops.to_pid_to_exec_file = windows_pid_to_exec_file; + i386_use_watchpoints (&windows_ops); + windows_ops.to_magic = OPS_MAGIC; } Index: gdb/config/i386/nm-cygwin.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin.h,v retrieving revision 1.8 diff -u -p -r1.8 nm-cygwin.h --- gdb/config/i386/nm-cygwin.h 3 Jan 2009 05:57:54 -0000 1.8 +++ gdb/config/i386/nm-cygwin.h 8 Feb 2009 22:27:46 -0000 @@ -20,6 +20,7 @@ void dll_symbol_command (char *, int); #define I386_USE_GENERIC_WATCHPOINTS +#define I386_WATCHPOINTS_IN_TARGET_VECTOR #include "i386/nm-i386.h" Index: gdb/config/i386/nm-cygwin64.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin64.h,v retrieving revision 1.1 diff -u -p -r1.1 nm-cygwin64.h --- gdb/config/i386/nm-cygwin64.h 11 Jan 2009 13:15:56 -0000 1.1 +++ gdb/config/i386/nm-cygwin64.h 8 Feb 2009 22:27:46 -0000 @@ -19,6 +19,7 @@ void dll_symbol_command (char *, int); #define I386_USE_GENERIC_WATCHPOINTS +#define I386_WATCHPOINTS_IN_TARGET_VECTOR #include "i386/nm-i386.h" Index: gdb/config/i386/nm-fbsd.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/nm-fbsd.h,v retrieving revision 1.18 diff -u -p -r1.18 nm-fbsd.h --- gdb/config/i386/nm-fbsd.h 3 Jan 2009 05:57:54 -0000 1.18 +++ gdb/config/i386/nm-fbsd.h 8 Feb 2009 22:27:46 -0000 @@ -23,6 +23,7 @@ #ifdef HAVE_PT_GETDBREGS #define I386_USE_GENERIC_WATCHPOINTS +#define I386_WATCHPOINTS_IN_TARGET_VECTOR #endif #include "i386/nm-i386.h" Index: gdb/config/i386/nm-go32.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/nm-go32.h,v retrieving revision 1.8 diff -u -p -r1.8 nm-go32.h --- gdb/config/i386/nm-go32.h 3 Jan 2009 05:57:54 -0000 1.8 +++ gdb/config/i386/nm-go32.h 8 Feb 2009 22:27:46 -0000 @@ -18,6 +18,7 @@ along with this program. If not, see . */ #define I386_USE_GENERIC_WATCHPOINTS +#define I386_WATCHPOINTS_IN_TARGET_VECTOR #include "i386/nm-i386.h"