From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25776 invoked by alias); 28 Nov 2001 17:44:44 -0000 Mailing-List: contact gdb-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 25617 invoked from network); 28 Nov 2001 17:44:38 -0000 Received: from unknown (HELO cerbere.u-strasbg.fr) (130.79.112.7) by hostedprojects.ges.redhat.com with SMTP; 28 Nov 2001 17:44:38 -0000 Received: from laocoon (laocoon.u-strasbg.fr [130.79.112.72]) by cerbere.u-strasbg.fr (8.9.3/8.8.7) with ESMTP id SAA07063 for ; Wed, 28 Nov 2001 18:44:27 +0100 Message-Id: <4.2.0.58.20011128183252.00acd198@ics.u-strasbg.fr> X-Sender: muller@ics.u-strasbg.fr X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58 Date: Sat, 17 Nov 2001 10:47:00 -0000 To: gdb-patches From: Pierre Muller Subject: [RFC/RFA] Add hardware watchpoint support for cygwin target. Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=====================_183726664==_" X-SW-Source: 2001-11/txt/msg00322.txt.bz2 --=====================_183726664==_ Content-Type: text/plain; charset="us-ascii" Content-length: 1899 Following DJ Delorie's suggestion to use CONTEXT_DEBUG_REGISTERS, I tested the use of i386 debug registers to set hardware watchpoints. It works successfully on my Win2000 box here. But te are some annoying things, the most annoying is that an exception seems to be generated on read access of the watched area even if you only set a normal watchpoint (which should use a write-only debug feature). This results in lost of garbage written on output due to the fact that mention function is called for watchpoints even if the value remains unchanged and thus no stop is done... It is unclear to me if this is a bug in the breakpoint code or if i386 code should take care of this issue. To Eli: If you test this patch, that contains a call to i386_cleanup_dregs(), you can test the failure if you comment the call out... PS: the patch should be a Dos style text file, Eudora seems completely unable to send Unix style text file.... Hopefully this will not create other problems. 2001-11-28 Pierre Muller * win32-nat.c (CONTEXT_DEBUG_DR macro): Add use of CONTEXT_DEBUG_REGISTERS. (dr variable): New static array containing a local copy of debug registers. (debug_registers_changed): Non zero whenever the debug registers where changed and need to be written to inferior. (cygwin_set_dr, cygwin_set_dr7, cygwin_get_dr6): New functions used by i386-nat code. (thread_rec): Set dr array if id is the thread of current_event . (child_continue, child_resume): Change the debug registers for all threads if debug_registers_changed. * config/i386/cygwin.mh: Add use of i386-nat.o file. Link nm.h to new nm-cygwin.h file. + config/i386/nm-cygwin.h: New file. Pierre Muller Institut Charles Sadron 6,rue Boussingault F 67083 STRASBOURG CEDEX (France) mailto:muller@ics.u-strasbg.fr Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99 --=====================_183726664==_ Content-Type: text/plain; charset="us-ascii" Content-length: 4644 Index: win32-nat.c =================================================================== RCS file: /cvs/src/src/gdb/win32-nat.c,v retrieving revision 1.40 diff -r1.40 win32-nat.c 71c71,72 < #define CONTEXT_DEBUGGER_DR CONTEXT_DEBUGGER | CONTEXT_EXTENDED_REGISTERS --- > #define CONTEXT_DEBUGGER_DR CONTEXT_DEBUGGER | CONTEXT_DEBUG_REGISTERS \ > | CONTEXT_EXTENDED_REGISTERS 73c74 < #define CONTEXT_DEBUGGER_DR CONTEXT_DEBUGGER --- > #define CONTEXT_DEBUGGER_DR CONTEXT_DEBUGGER | CONTEXT_DEBUG_REGISTERS 75a77,79 > static unsigned dr[8]; > static int debug_registers_changed = 0; > 235a240,249 > if (id == current_event.dwThreadId) > { > /* Copy dr values from that thread. */ > dr[0] = th->context.Dr0; > dr[1] = th->context.Dr1; > dr[2] = th->context.Dr2; > dr[3] = th->context.Dr3; > dr[6] = th->context.Dr6; > dr[7] = th->context.Dr7; > } 877a892,904 > if (debug_registers_changed) > { > /* Only change the value of the debug registers. */ > th->context.ContextFlags = CONTEXT_DEBUG_REGISTERS; > th->context.Dr0 = dr[0]; > th->context.Dr1 = dr[1]; > th->context.Dr2 = dr[2]; > th->context.Dr3 = dr[3]; > th->context.Dr6 = dr[6]; > th->context.Dr7 = dr[7]; > CHECK (SetThreadContext (th->h, &th->context)); > th->context.ContextFlags = 0; > } 882a910 > debug_registers_changed = 0; 1061a1090 > int i; 1065a1095,1097 > debug_registers_changed = 0; > for (i = 0; i <= 7; i++) > dr[i] = 0; 1344a1377 > i386_cleanup_dregs(); 1411a1445 > 1431a1466,1474 > if (debug_registers_changed) > { > th->context.Dr0 = dr[0]; > th->context.Dr1 = dr[1]; > th->context.Dr2 = dr[2]; > th->context.Dr3 = dr[3]; > th->context.Dr6 = dr[6]; > th->context.Dr7 = dr[7]; > } 1563a1607,1641 > > /* Hardware watchpoint support, adapted from go32-nat.c code. */ > > /* Pass the address ADDR to the inferior in the I'th debug register. > Here we just store the address in dr array, the registers will be > actually set up when child_continue is called. */ > void > cygwin_set_dr (int i, CORE_ADDR addr) > { > if (i < 0 || i > 3) > internal_error (__FILE__, __LINE__, > "Invalid register %d in cygwin_set_dr.\n", i); > dr[i] = (unsigned) addr; > debug_registers_changed = 1; > } > > /* Pass the value VAL to the inferior in the DR7 debug control > register. Here we just store the address in D_REGS, the watchpoint > will be actually set up in child_wait. */ > void > cygwin_set_dr7 (unsigned val) > { > dr[7] = val; > debug_registers_changed = 1; > } > > /* Get the value of the DR6 debug status register from the inferior. > Here we just return the value stored in D_REGS, as we've got it > from the last go32_wait call. */ > unsigned > cygwin_get_dr6 (void) > { > return dr[6]; > } > Index: config/i386/cygwin.mh =================================================================== RCS file: /cvs/src/src/gdb/config/i386/cygwin.mh,v retrieving revision 1.4 diff -r1.4 cygwin.mh 4,5c4,5 < NATDEPFILES= win32-nat.o corelow.o < NAT_FILE=../none/nm-none.h --- > NATDEPFILES= i386-nat.o win32-nat.o corelow.o > NAT_FILE=nm-cygwin.h /* Native definitions for Intel x86 running CYGWIN. Copyright (C) 2001 Free Software Foundation, Inc. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define NO_PTRACE_H #define I386_USE_GENERIC_WATCHPOINTS #include "i386/nm-i386.h" /* Support for hardware-assisted breakpoints and watchpoints. */ #define I386_DR_LOW_SET_CONTROL(VAL) cygwin_set_dr7 (VAL) extern void cygwin_set_dr7 (unsigned); #define I386_DR_LOW_SET_ADDR(N,ADDR) cygwin_set_dr (N,ADDR) extern void cygwin_set_dr (int, CORE_ADDR); #define I386_DR_LOW_RESET_ADDR(N) #define I386_DR_LOW_GET_STATUS() cygwin_get_dr6 () extern unsigned cygwin_get_dr6 (void); --=====================_183726664==_ Content-Type: text/plain; charset="us-ascii" Content-length: 176 Pierre Muller Institut Charles Sadron 6,rue Boussingault F 67083 STRASBOURG CEDEX (France) mailto:muller@ics.u-strasbg.fr Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99 --=====================_183726664==_-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pierre Muller To: gdb-patches Subject: [RFC/RFA] Add hardware watchpoint support for cygwin target. Date: Wed, 28 Nov 2001 09:44:00 -0000 Message-ID: <4.2.0.58.20011128183252.00acd198@ics.u-strasbg.fr> X-SW-Source: 2001-11/msg00537.html Message-ID: <20011128094400.uvkmz--eiI6TIrVLXXbvD8r4dlH8RsHBDIeiYhmpkxs@z> Following DJ Delorie's suggestion to use CONTEXT_DEBUG_REGISTERS, I tested the use of i386 debug registers to set hardware watchpoints. It works successfully on my Win2000 box here. But te are some annoying things, the most annoying is that an exception seems to be generated on read access of the watched area even if you only set a normal watchpoint (which should use a write-only debug feature). This results in lost of garbage written on output due to the fact that mention function is called for watchpoints even if the value remains unchanged and thus no stop is done... It is unclear to me if this is a bug in the breakpoint code or if i386 code should take care of this issue. To Eli: If you test this patch, that contains a call to i386_cleanup_dregs(), you can test the failure if you comment the call out... PS: the patch should be a Dos style text file, Eudora seems completely unable to send Unix style text file.... Hopefully this will not create other problems. 2001-11-28 Pierre Muller * win32-nat.c (CONTEXT_DEBUG_DR macro): Add use of CONTEXT_DEBUG_REGISTERS. (dr variable): New static array containing a local copy of debug registers. (debug_registers_changed): Non zero whenever the debug registers where changed and need to be written to inferior. (cygwin_set_dr, cygwin_set_dr7, cygwin_get_dr6): New functions used by i386-nat code. (thread_rec): Set dr array if id is the thread of current_event . (child_continue, child_resume): Change the debug registers for all threads if debug_registers_changed. * config/i386/cygwin.mh: Add use of i386-nat.o file. Link nm.h to new nm-cygwin.h file. + config/i386/nm-cygwin.h: New file. Pierre Muller Institut Charles Sadron 6,rue Boussingault F 67083 STRASBOURG CEDEX (France) mailto:muller@ics.u-strasbg.fr Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99 Index: win32-nat.c =================================================================== RCS file: /cvs/src/src/gdb/win32-nat.c,v retrieving revision 1.40 diff -r1.40 win32-nat.c 71c71,72 < #define CONTEXT_DEBUGGER_DR CONTEXT_DEBUGGER | CONTEXT_EXTENDED_REGISTERS --- > #define CONTEXT_DEBUGGER_DR CONTEXT_DEBUGGER | CONTEXT_DEBUG_REGISTERS \ > | CONTEXT_EXTENDED_REGISTERS 73c74 < #define CONTEXT_DEBUGGER_DR CONTEXT_DEBUGGER --- > #define CONTEXT_DEBUGGER_DR CONTEXT_DEBUGGER | CONTEXT_DEBUG_REGISTERS 75a77,79 > static unsigned dr[8]; > static int debug_registers_changed = 0; > 235a240,249 > if (id == current_event.dwThreadId) > { > /* Copy dr values from that thread. */ > dr[0] = th->context.Dr0; > dr[1] = th->context.Dr1; > dr[2] = th->context.Dr2; > dr[3] = th->context.Dr3; > dr[6] = th->context.Dr6; > dr[7] = th->context.Dr7; > } 877a892,904 > if (debug_registers_changed) > { > /* Only change the value of the debug registers. */ > th->context.ContextFlags = CONTEXT_DEBUG_REGISTERS; > th->context.Dr0 = dr[0]; > th->context.Dr1 = dr[1]; > th->context.Dr2 = dr[2]; > th->context.Dr3 = dr[3]; > th->context.Dr6 = dr[6]; > th->context.Dr7 = dr[7]; > CHECK (SetThreadContext (th->h, &th->context)); > th->context.ContextFlags = 0; > } 882a910 > debug_registers_changed = 0; 1061a1090 > int i; 1065a1095,1097 > debug_registers_changed = 0; > for (i = 0; i <= 7; i++) > dr[i] = 0; 1344a1377 > i386_cleanup_dregs(); 1411a1445 > 1431a1466,1474 > if (debug_registers_changed) > { > th->context.Dr0 = dr[0]; > th->context.Dr1 = dr[1]; > th->context.Dr2 = dr[2]; > th->context.Dr3 = dr[3]; > th->context.Dr6 = dr[6]; > th->context.Dr7 = dr[7]; > } 1563a1607,1641 > > /* Hardware watchpoint support, adapted from go32-nat.c code. */ > > /* Pass the address ADDR to the inferior in the I'th debug register. > Here we just store the address in dr array, the registers will be > actually set up when child_continue is called. */ > void > cygwin_set_dr (int i, CORE_ADDR addr) > { > if (i < 0 || i > 3) > internal_error (__FILE__, __LINE__, > "Invalid register %d in cygwin_set_dr.\n", i); > dr[i] = (unsigned) addr; > debug_registers_changed = 1; > } > > /* Pass the value VAL to the inferior in the DR7 debug control > register. Here we just store the address in D_REGS, the watchpoint > will be actually set up in child_wait. */ > void > cygwin_set_dr7 (unsigned val) > { > dr[7] = val; > debug_registers_changed = 1; > } > > /* Get the value of the DR6 debug status register from the inferior. > Here we just return the value stored in D_REGS, as we've got it > from the last go32_wait call. */ > unsigned > cygwin_get_dr6 (void) > { > return dr[6]; > } > Index: config/i386/cygwin.mh =================================================================== RCS file: /cvs/src/src/gdb/config/i386/cygwin.mh,v retrieving revision 1.4 diff -r1.4 cygwin.mh 4,5c4,5 < NATDEPFILES= win32-nat.o corelow.o < NAT_FILE=../none/nm-none.h --- > NATDEPFILES= i386-nat.o win32-nat.o corelow.o > NAT_FILE=nm-cygwin.h /* Native definitions for Intel x86 running CYGWIN. Copyright (C) 2001 Free Software Foundation, Inc. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define NO_PTRACE_H #define I386_USE_GENERIC_WATCHPOINTS #include "i386/nm-i386.h" /* Support for hardware-assisted breakpoints and watchpoints. */ #define I386_DR_LOW_SET_CONTROL(VAL) cygwin_set_dr7 (VAL) extern void cygwin_set_dr7 (unsigned); #define I386_DR_LOW_SET_ADDR(N,ADDR) cygwin_set_dr (N,ADDR) extern void cygwin_set_dr (int, CORE_ADDR); #define I386_DR_LOW_RESET_ADDR(N) #define I386_DR_LOW_GET_STATUS() cygwin_get_dr6 () extern unsigned cygwin_get_dr6 (void); >From eliz@is.elta.co.il Wed Nov 28 10:05:00 2001 From: "Eli Zaretskii" To: orjan.friberg@axis.com Cc: gdb-patches@sources.redhat.com Subject: Re: [RFC]: Solib search (Was: Re: Cross solib support; continued) Date: Wed, 28 Nov 2001 10:05:00 -0000 Message-id: <2950-Wed28Nov2001200425+0200-eliz@is.elta.co.il> References: <3BEAA3A0.586B3046@axis.com> <20011108110955.A12240@nevyn.them.org> <3C03AB51.DB27B3D4@axis.com> <3405-Tue27Nov2001175932+0200-eliz@is.elta.co.il> <3C04B5A9.1F054A9F@axis.com> <7458-Wed28Nov2001183554+0200-eliz@is.elta.co.il> <3C052245.8C02668E@axis.com> X-SW-Source: 2001-11/msg00538.html Content-length: 884 > Date: Wed, 28 Nov 2001 18:43:33 +0100 > From: Orjan Friberg > > I was trying to address the situation where in_pathname contains several > leading slashes; then your suggested code (and my original code also) > would terminate too early. I guess we don't normally care about > multiple leading slashes since it's a valid path, but in this case we > need to get rid of all of them to make it a relative path. > > This code should cut it: > > if (found_file < 0 && IS_ABSOLUTE_PATH (in_pathname)) > { > /* First, get rid of any drive letters etc. */ > while (!IS_DIR_SEPARATOR (*in_pathname)) > in_pathname++; > > /* Next, get rid of all leading dir separators. */ > while (IS_DIR_SEPARATOR (*in_pathname)) > in_pathname++; > } Yes, this does what you want, AFAICS. Thanks for explaining the issue.