From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31468 invoked by alias); 13 Mar 2009 00:27:58 -0000 Received: (qmail 31459 invoked by uid 22791); 13 Mar 2009 00:27:57 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_92,MIME_QP_LONG_LINE X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.157) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 Mar 2009 00:27: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 n2D0Rhfh092107 for ; Fri, 13 Mar 2009 01:27:44 +0100 (CET) Received: from mailserver.u-strasbg.fr (ms3.u-strasbg.fr [IPv6:2001:660:2402:d::12]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id n2D0RhVd078375 for ; Fri, 13 Mar 2009 01:27:43 +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 n2D0RfkX097481 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Fri, 13 Mar 2009 01:27:41 +0100 (CET) (envelope-from muller@ics.u-strasbg.fr) From: "Pierre Muller" To: Subject: [RFC] Set I386_USE_GENERIC_WATCHPOINTS in configure Date: Fri, 13 Mar 2009 00:30:00 -0000 Message-ID: <000901c9a372$89647070$9c2d5150$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_000A_01C9A37A.EB28D870" 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-03/txt/msg00181.txt.bz2 Il s'agit d'un message ` parties multiples au format MIME. ------=_NextPart_000_000A_01C9A37A.EB28D870 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-length: 2838 To get fully functional multi-arch, we should try to remove all nm files. I tried to write a patch that completely removes the need of I386_USE_GENERIC_WATCHPOINTS in config/i386/nm-*.h headers. Instead I386_USE_GENERIC_WATCHPOINTS and TARGET_HAS_DR_LEN_8 are set in configure. This allows to almost completely empty the config/i386/nm*.h files. I used four function variables to replace the I386_DR_LOW_* macros, and set those variables close to where i386_use_watchpoints function is called. I am not sure that this is the best solution, but I was afraid of the idea of implementing the same function in different sources, with a possible conflict if two of these native files get compiled into the same executable. I am not really confident in the configure.ac part, as this is the first time I try to modify this file and I have no knowledge of autoconf :( All remarks are welcome. Pierre Muller Pascal language support maintainer for GDB ChangeLog entry: 2009-03-13 Pierre Muller * configure.host: Set gdb_use_i386_dr to 4 or 8 on hosts supporting generic watchpoints. * configure.ac: Set I386_USE_GENERIC_WATCHPOINTS and TARGET_HAS_DR_LEN_8. * config.in: Regenerate. * configure: Ditto. * i386-dr-nat.h: New file. Exports some functions from i386-nat.c. (i386_dr_low_set_control): New function variable. (i386_dr_low_set_addr): Ditto. (i386_dr_low_reset_addr):Ditto. (i386_dr_low_get_status):Ditto. * i386-nat.c: Include i386-dr-nat.h. (I386_DR_LOW_SET_CONTROL): Remove macro. (I386_DR_LOW_SET_ADDR): Remove macro. (I386_DR_LOW_RESET_ADDR): Remove macro. (I386_DR_LOW_GET_STATUS): Remove macro. (i386_insert_aligned_watchpoint, i386_remove_aligned_watchpoint) (i386_stopped_data_address, i386_stopped_by_hwbp): Replace macros by function variables. * go32-nat.c: Include i386-dr-nat.h. (init_go32_ops): Set i386-dr-nat function variables. * i386-linux-nat.c: Include i386-dr-nat.h. (_initialize_i386_linux_nat): Set i386-dr-nat function variables. * amd64-linux-nat.c: Include i386-dr-nat.h. (amd64_linux_dr_set_control): Change argument type to unsigned. (amd64_linux_dr_get_status): Change return type to unsigned. (_initialize_amd64_linux_nat): Set i386-dr-nat function variables. * i386fbsd-nat.c: Include i386-dr-nat.h. (_initialize_i386fbsd_nat): Set i386-dr-nat function variables. * windows-nat.c: Include i386-dr-nat.h. (cygwin_set_dr, cygwin_set_dr7, cygwin_get_dr6): Add forward declarations. (init_windows_ops): Set i386-dr-nat function variables. * config/i386/nm-i386.h: Remove all debug register related code. * config/i386/nm-cygwin.h: Ditto. * config/i386/nm-cygwin64.h: Ditto. * config/i386/nm-fbsd.h: Ditto. * config/i386/nm-go32.h: Ditto. * config/i386/nm-linux.h: Ditto. * config/i386/nm-linux64.h: Ditto. ------=_NextPart_000_000A_01C9A37A.EB28D870 Content-Type: application/octet-stream; name="i386-dr2.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="i386-dr2.patch" Content-length: 37210 projecttype:gdb=0A= email:muller@ics.u-strasbg.fr=0A= revision:HEAD=0A= Index: src/gdb/amd64-linux-nat.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/amd64-linux-nat.c,v=0A= retrieving revision 1.24=0A= diff -u -p -r1.24 amd64-linux-nat.c=0A= --- src/gdb/amd64-linux-nat.c 23 Feb 2009 00:03:48 -0000 1.24=0A= +++ src/gdb/amd64-linux-nat.c 12 Mar 2009 23:42:40 -0000=0A= @@ -25,6 +25,7 @@=0A= #include "regcache.h"=0A= #include "linux-nat.h"=0A= #include "amd64-linux-tdep.h"=0A= +#include "i386-dr-nat.h"=0A= =20=0A= #include "gdb_assert.h"=0A= #include "gdb_string.h"=0A= @@ -286,14 +287,15 @@ amd64_linux_dr_set (ptid_t ptid, int reg=0A= }=0A= =20=0A= void=0A= -amd64_linux_dr_set_control (unsigned long control)=0A= +amd64_linux_dr_set_control (unsigned control)=0A= {=0A= struct lwp_info *lp;=0A= ptid_t ptid;=0A= + unsigned long ctrl =3D control;=0A= =20=0A= - amd64_linux_dr[DR_CONTROL] =3D control;=0A= + amd64_linux_dr[DR_CONTROL] =3D ctrl;=0A= ALL_LWPS (lp, ptid)=0A= - amd64_linux_dr_set (ptid, DR_CONTROL, control);=0A= + amd64_linux_dr_set (ptid, DR_CONTROL, ctrl);=0A= }=0A= =20=0A= void=0A= @@ -315,10 +317,10 @@ amd64_linux_dr_reset_addr (int regnum)=0A= amd64_linux_dr_set_addr (regnum, 0);=0A= }=0A= =20=0A= -unsigned long=0A= +unsigned=0A= amd64_linux_dr_get_status (void)=0A= {=0A= - return amd64_linux_dr_get (inferior_ptid, DR_STATUS);=0A= + return (unsigned) amd64_linux_dr_get (inferior_ptid, DR_STATUS);=0A= }=0A= =20=0A= static void=0A= @@ -658,6 +660,11 @@ _initialize_amd64_linux_nat (void)=0A= =20=0A= i386_use_watchpoints (t);=0A= =20=0A= + i386_dr_low_set_control =3D amd64_linux_dr_set_control;=0A= + i386_dr_low_set_addr =3D amd64_linux_dr_set_addr;=0A= + i386_dr_low_reset_addr =3D amd64_linux_dr_reset_addr;=0A= + i386_dr_low_get_status =3D amd64_linux_dr_get_status;=0A= +=0A= /* Override the GNU/Linux inferior startup hook. */=0A= super_post_startup_inferior =3D t->to_post_startup_inferior;=0A= t->to_post_startup_inferior =3D amd64_linux_child_post_startup_inferior;= =0A= Index: src/gdb/config.in=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/config.in,v=0A= retrieving revision 1.105=0A= diff -u -p -r1.105 config.in=0A= --- src/gdb/config.in 28 Jan 2009 15:01:00 -0000 1.105=0A= +++ src/gdb/config.in 12 Mar 2009 23:42:40 -0000=0A= @@ -561,6 +561,9 @@=0A= /* Define to 1 if you have the `_mcleanup' function. */=0A= #undef HAVE__MCLEANUP=0A= =20=0A= +/* Defined if i386 native port supports debug registers */=0A= +#undef I386_USE_GENERIC_WATCHPOINTS=0A= +=0A= /* Define as const if the declaration of iconv() needs const. */=0A= #undef ICONV_CONST=0A= =20=0A= @@ -662,6 +665,9 @@=0A= moved. */=0A= #undef SYSTEM_GDBINIT_RELOCATABLE=0A= =20=0A= +/* Defined if i386 debug registers are 8 bytes long */=0A= +#undef TARGET_HAS_DR_LEN_8=0A= +=0A= /* Define if has the TD_NOTALLOC error code. */=0A= #undef THREAD_DB_HAS_TD_NOTALLOC=0A= =20=0A= Index: src/gdb/configure=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/configure,v=0A= retrieving revision 1.266=0A= diff -u -p -r1.266 configure=0A= --- src/gdb/configure 2 Feb 2009 23:18:04 -0000 1.266=0A= +++ src/gdb/configure 12 Mar 2009 23:42:49 -0000=0A= @@ -20773,6 +20773,36 @@ done=0A= ac_config_links=3D"$ac_config_links $ac_config_links_1"=0A= =20=0A= =20=0A= +# Set I386_USE_GENERIC_WATCHPOINTS if native host supports it=0A= +if test "${gdb_host_cpu}" =3D=3D "i386"; then=0A= +if test "${gdb_use_i386_dr}" !=3D ""; then=0A= + i386_use_generic_watchpoints=3D1=0A= + # for FreeBSD, we need to know if HAVE_PT_GETDBREGS is set=0A= + # this test is done above=0A= + # and stored in gdb_cv_have_pt_getdbregs variable=0A= + if test "${gdb_host}" =3D=3D "fbsd"; then=0A= + if test $gdb_cv_have_pt_getdbregs =3D no; then=0A= + i386_use_generic_watchpoints=3D0=0A= + fi=0A= + fi=0A= +=0A= + if test "${i386_use_generic_watchpoints}" =3D=3D "1"; then=0A= +=0A= +cat >>confdefs.h <<\_ACEOF=0A= +#define I386_USE_GENERIC_WATCHPOINTS 1=0A= +_ACEOF=0A= +=0A= + fi=0A= + if test "${gdb_use_i386_dr}" =3D=3D "8"; then=0A= +=0A= +cat >>confdefs.h <<\_ACEOF=0A= +#define TARGET_HAS_DR_LEN_8 1=0A= +_ACEOF=0A= +=0A= + fi=0A= +fi=0A= +fi=0A= +=0A= =20=0A= =20=0A= =20=0A= Index: src/gdb/configure.ac=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/configure.ac,v=0A= retrieving revision 1.86=0A= diff -u -p -r1.86 configure.ac=0A= --- src/gdb/configure.ac 2 Feb 2009 23:18:05 -0000 1.86=0A= +++ src/gdb/configure.ac 12 Mar 2009 23:42:50 -0000=0A= @@ -1926,6 +1926,31 @@ AC_SUBST(nm_h)=0A= =20=0A= AC_LINK_FILES($files, $links)=0A= =20=0A= +# Set I386_USE_GENERIC_WATCHPOINTS if native host supports it=0A= +if test "${gdb_host_cpu}" =3D=3D "i386"; then=0A= +dnl Check if native supports generic watchpoints=0A= +if test "${gdb_use_i386_dr}" !=3D ""; then=0A= + i386_use_generic_watchpoints=3D1=0A= + # for FreeBSD, we need to know if HAVE_PT_GETDBREGS is set=0A= + # this test is done above=0A= + # and stored in gdb_cv_have_pt_getdbregs variable=0A= + if test "${gdb_host}" =3D=3D "fbsd"; then=0A= + if test $gdb_cv_have_pt_getdbregs =3D no; then=0A= + i386_use_generic_watchpoints=3D0=0A= + fi=0A= + fi=0A= +=0A= + if test "${i386_use_generic_watchpoints}" =3D=3D "1"; then=0A= + AC_DEFINE(I386_USE_GENERIC_WATCHPOINTS, 1,=0A= + [Defined if i386 native port supports debug registers])=0A= + fi=0A= + if test "${gdb_use_i386_dr}" =3D=3D "8"; then=0A= + AC_DEFINE(TARGET_HAS_DR_LEN_8, 1,=0A= + [Defined if i386 debug registers are 8 bytes long])=0A= + fi=0A= +fi=0A= +fi=0A= +=0A= dnl Check for exe extension set on certain hosts (e.g. Win32)=0A= AC_EXEEXT=0A= =20=0A= Index: src/gdb/configure.host=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/configure.host,v=0A= retrieving revision 1.103=0A= diff -u -p -r1.103 configure.host=0A= --- src/gdb/configure.host 11 Jan 2009 13:15:56 -0000 1.103=0A= +++ src/gdb/configure.host 12 Mar 2009 23:42:50 -0000=0A= @@ -85,16 +85,21 @@ hppa*-*-netbsd*) gdb_host=3Dnbsd ;;=0A= hppa*-*-openbsd*) gdb_host=3Dobsd ;;=0A= =20=0A= i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu)=0A= - gdb_host=3Dfbsd ;;=0A= + gdb_host=3Dfbsd=0A= + gdb_use_i386_dr=3D4 ;;=0A= i[34567]86-*-netbsdelf* | i[34567]86-*-knetbsd*-gnu)=0A= gdb_host=3Dnbsdelf ;;=0A= i[34567]86-*-netbsd*) gdb_host=3Dnbsdaout ;;=0A= -i[34567]86-*-go32*) gdb_host=3Dgo32 ;;=0A= +i[34567]86-*-go32*) gdb_host=3Dgo32=0A= + gdb_use_i386_dr=3D4 ;;=0A= i[34567]86-*-mingw32*) gdb_host=3Dmingw=0A= + gdb_use_i386_dr=3D4=0A= gdb_host_obs=3Dmingw-hdep.o=0A= ;;=0A= -i[34567]86-*-msdosdjgpp*) gdb_host=3Dgo32 ;;=0A= -i[34567]86-*-linux*) gdb_host=3Dlinux ;;=0A= +i[34567]86-*-msdosdjgpp*) gdb_host=3Dgo32=0A= + gdb_use_i386_dr=3D4 ;;=0A= +i[34567]86-*-linux*) gdb_host=3Dlinux=0A= + gdb_use_i386_dr=3D4 ;;=0A= i[34567]86-*-gnu*) gdb_host=3Di386gnu ;;=0A= i[3456]86-*-nto*) gdb_host=3Dnto ;;=0A= i[34567]86-*-openbsd[0-2].* | i[34567]86-*-openbsd3.[0-3])=0A= @@ -102,7 +107,8 @@ i[34567]86-*-openbsd[0-2].* | i[34567]86=0A= i[34567]86-*-openbsd*) gdb_host=3Dobsd ;;=0A= i[34567]86-*-solaris2.1[0-9]*) gdb_host=3Dsol2-64 ;;=0A= i[34567]86-*-solaris*) gdb_host=3Di386sol2 ;;=0A= -i[34567]86-*-cygwin*) gdb_host=3Dcygwin ;;=0A= +i[34567]86-*-cygwin*) gdb_host=3Dcygwin=0A= + gdb_use_i386_dr=3D4 ;;=0A= =20=0A= ia64-*-linux*) gdb_host=3Dlinux ;;=0A= =20=0A= @@ -165,13 +171,16 @@ vax-*-netbsd*) gdb_host=3Dnbsdaout ;;=0A= vax-*-openbsd*) gdb_host=3Dobsd ;;=0A= vax-*-ultrix*) gdb_host=3Dvax ;;=0A= =20=0A= -x86_64-*-linux*) gdb_host=3Dlinux64 ;;=0A= +x86_64-*-linux*) gdb_host=3Dlinux64=0A= + gdb_use_i386_dr=3D8 ;;=0A= x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)=0A= - gdb_host=3Dfbsd64 ;;=0A= + gdb_host=3Dfbsd64=0A= + gdb_use_i386_dr=3D8 ;;=0A= x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)=0A= gdb_host=3Dnbsd64 ;;=0A= x86_64-*-openbsd*) gdb_host=3Dobsd64 ;;=0A= x86_64-*-mingw*) gdb_host=3Dmingw64=0A= + gdb_use_i386_dr=3D8=0A= gdb_host_obs=3Dmingw-hdep.o=0A= ;;=0A= m32r*-*-linux*) gdb_host=3Dlinux ;;=0A= @@ -180,8 +189,6 @@ xtensa*-*-linux*) gdb_host=3Dlinux ;;=0A= =20=0A= esac=0A= =20=0A= -=0A= -=0A= # Map the host/cpu onto the floatformat correspondong to C's "float",=0A= # "double" and "long double" types.=0A= =20=0A= Index: src/gdb/go32-nat.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/go32-nat.c,v=0A= retrieving revision 1.65=0A= diff -u -p -r1.65 go32-nat.c=0A= --- src/gdb/go32-nat.c 23 Feb 2009 00:03:49 -0000 1.65=0A= +++ src/gdb/go32-nat.c 12 Mar 2009 23:42:51 -0000=0A= @@ -31,6 +31,7 @@=0A= #include "buildsym.h"=0A= #include "i387-tdep.h"=0A= #include "i386-tdep.h"=0A= +#include "i386-dr-nat.h"=0A= #include "value.h"=0A= #include "regcache.h"=0A= #include "gdb_string.h"=0A= @@ -919,6 +920,12 @@ init_go32_ops (void)=0A= =20=0A= i386_use_watchpoints (&go32_ops);=0A= =20=0A= +=0A= + i386_dr_low_set_control =3D go32_set_dr7;=0A= + i386_dr_low_set_addr =3D go32_set_dr;=0A= + i386_dr_low_reset_addr =3D NULL;=0A= + i386_dr_low_get_status =3D go32_get_dr6;=0A= +=0A= go32_ops.to_magic =3D OPS_MAGIC;=0A= =20=0A= /* Initialize child's cwd as empty to be initialized when starting=0A= Index: src/gdb/i386-dr-nat.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: src/gdb/i386-dr-nat.h=0A= diff -N src/gdb/i386-dr-nat.h=0A= --- /dev/null 1 Jan 1970 00:00:00 -0000=0A= +++ src/gdb/i386-dr-nat.h 12 Mar 2009 23:42:51 -0000=0A= @@ -0,0 +1,123 @@=0A= +/* Native-dependent code for the i386.=0A= +=0A= + Low level functions to implement Oeprating System specific=0A= + code to manipulate I386 debug registers.=0A= +=0A= + Copyright (C) 2009=0A= + Free Software Foundation, Inc.=0A= +=0A= + This file is part of GDB.=0A= +=0A= + This program is free software; you can redistribute it and/or modify=0A= + it under the terms of the GNU General Public License as published by=0A= + the Free Software Foundation; either version 3 of the License, or=0A= + (at your option) any later version.=0A= +=0A= + This program is distributed in the hope that it will be useful,=0A= + but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the=0A= + GNU General Public License for more details.=0A= +=0A= + You should have received a copy of the GNU General Public License=0A= + along with this program. If not, see . = */=0A= +=0A= +#include "config.h"=0A= +#include "defs.h"=0A= +#include "breakpoint.h"=0A= +#include "command.h"=0A= +#include "gdbcmd.h"=0A= +=0A= +#ifndef I386_DR_NAT_H=0A= +#define I386_DR_NAT_H 1=0A= +=0A= +/* Hardware-assisted breakpoints and watchpoints. */=0A= +=0A= +/* Targets should define this to use the generic x86 watchpoint support. = */=0A= +#ifdef I386_USE_GENERIC_WATCHPOINTS=0A= +=0A= +/* Support for hardware watchpoints and breakpoints using the i386=0A= + debug registers.=0A= +=0A= + This provides several functions for inserting and removing=0A= + hardware-assisted breakpoints and watchpoints, testing if one or=0A= + more of the watchpoints triggered and at what address, checking=0A= + whether a given region can be watched, etc.=0A= +=0A= + In addition, each target should provide three (or four) low-level funct= ions=0A= + that will be called to insert watchpoints and hardware breakpoints=0A= + into the inferior, remove them, and check their status. These=0A= + functions variables are:=0A= +=0A= + i386_dr_low_set_control -- set the debug control (DR7)=0A= + register to a given value=0A= +=0A= + i386_dr_low_set_addr -- put an address into one debug=0A= + register=0A= +=0A= + i386_dr_low_get_status -- return the value of the debug=0A= + status (DR6) register.=0A= +=0A= + i386_dr_low_reset_addr -- reset the address stored in=0A= + one debug register=0A= + This last function is optional, and will only be called if set.=B2=0A= +=0A= +=0A= + The functions below implement debug registers sharing by reference=0A= + counts, and allow to watch regions up to 16 bytes long=0A= + (32 bytes on amd64). */=0A= +=0A= +=0A= +/* Add watchpoint methods to the provided target_ops.=0A= + Targets defining I386_USE_GENERIC_WATCHPOINTS should call=0A= + this function in the init function defining the target vector. */=0A= +struct target_ops;=0A= +void i386_use_watchpoints (struct target_ops *);=0A= +=0A= +/* Clear the reference counts and forget everything we knew about DRi. */= =0A= +extern void i386_cleanup_dregs (void);=0A= +=0A= +/* Insert a watchpoint to watch a memory region which starts at=0A= + address ADDR and whose length is LEN bytes. Watch memory accesses=0A= + of the type TYPE. Return 0 on success, -1 on failure. */=0A= +extern int i386_insert_watchpoint (CORE_ADDR addr, int len, int type);=0A= +=0A= +/* Remove a watchpoint that watched the memory region which starts at=0A= + address ADDR, whose length is LEN bytes, and for accesses of the=0A= + type TYPE. Return 0 on success, -1 on failure. */=0A= +extern int i386_remove_watchpoint (CORE_ADDR addr, int len, int type);=0A= +=0A= +/* Return non-zero if we can watch a memory region that starts at=0A= + address ADDR and whose length is LEN bytes. */=0A= +extern int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len);=0A= +=0A= +/* Return non-zero if the inferior has some break/watchpoint that=0A= + triggered. */=0A= +extern int i386_stopped_by_hwbp (void);=0A= +=0A= +/* If the inferior has some break/watchpoint that triggered, set=0A= + the address associated with that break/watchpoint and return=0A= + true. Otherwise, return false. */=0A= +extern int i386_stopped_data_address (struct target_ops *, CORE_ADDR *);= =0A= +=0A= +/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.=0A= + Return 0 on success, EBUSY on failure. */=0A= +struct bp_target_info;=0A= +extern int i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt);=0A= +=0A= +/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address.=0A= + Return 0 on success, -1 on failure. */=0A= +extern int i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt);=0A= +=0A= +extern int i386_stopped_by_watchpoint (void);=0A= +=0A= +#endif /* I386_USE_GENERIC_WATCHPOINTS */=0A= +=0A= +void (*i386_dr_low_set_control)(unsigned);=0A= +=0A= +void (*i386_dr_low_set_addr)(int, CORE_ADDR);=0A= +=0A= +void (*i386_dr_low_reset_addr)(int);=0A= +=0A= +unsigned (*i386_dr_low_get_status)(void);=0A= +=0A= +#endif /* I386_DR_NAT_H */=0A= Index: src/gdb/i386-linux-nat.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/i386-linux-nat.c,v=0A= retrieving revision 1.90=0A= diff -u -p -r1.90 i386-linux-nat.c=0A= --- src/gdb/i386-linux-nat.c 23 Feb 2009 00:42:06 -0000 1.90=0A= +++ src/gdb/i386-linux-nat.c 12 Mar 2009 23:42:51 -0000=0A= @@ -64,6 +64,7 @@=0A= =20=0A= #include "i387-tdep.h"=0A= #include "i386-tdep.h"=0A= +#include "i386-dr-nat.h"=0A= #include "i386-linux-tdep.h"=0A= =20=0A= /* Defines ps_err_e, struct ps_prochandle. */=0A= @@ -825,6 +826,11 @@ _initialize_i386_linux_nat (void)=0A= =20=0A= i386_use_watchpoints (t);=0A= =20=0A= + i386_dr_low_set_control =3D i386_linux_dr_set_control;=0A= + i386_dr_low_set_addr =3D i386_linux_dr_set_addr;=0A= + i386_dr_low_reset_addr =3D i386_linux_dr_reset_addr;=0A= + i386_dr_low_get_status =3D i386_linux_dr_get_status;=0A= +=0A= /* Override the default ptrace resume method. */=0A= t->to_resume =3D i386_linux_resume;=0A= =20=0A= Index: src/gdb/i386-nat.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/i386-nat.c,v=0A= retrieving revision 1.19=0A= diff -u -p -r1.19 i386-nat.c=0A= --- src/gdb/i386-nat.c 3 Jan 2009 05:57:51 -0000 1.19=0A= +++ src/gdb/i386-nat.c 12 Mar 2009 23:42:51 -0000=0A= @@ -18,6 +18,7 @@=0A= You should have received a copy of the GNU General Public License=0A= along with this program. If not, see . = */=0A= =20=0A= +#include "i386-dr-nat.h"=0A= #include "defs.h"=0A= #include "breakpoint.h"=0A= #include "command.h"=0A= @@ -60,6 +61,15 @@=0A= =20=0A= #ifdef I386_USE_GENERIC_WATCHPOINTS=0A= =20=0A= +#undef I386_DR_LOW_SET_CONTROL=0A= +#undef I386_DR_LOW_SET_ADDR=0A= +#undef I386_DR_LOW_RESET_ADDR=0A= +#undef I386_DR_LOW_GET_STATUS=0A= +#define I386_DR_LOW_SET_CONTROL generate_compile_error()=0A= +#define I386_DR_LOW_SET_ADDR generate_compile_error()=0A= +#define I386_DR_LOW_RESET_ADDR generate_compile_error()=0A= +#define I386_DR_LOW_GET_STATUS generate_compile_error()=0A= +=0A= /* Support for 8-byte wide hw watchpoints. */=0A= #ifndef TARGET_HAS_DR_LEN_8=0A= #define TARGET_HAS_DR_LEN_8 0=0A= @@ -339,6 +349,9 @@ i386_insert_aligned_watchpoint (CORE_ADD=0A= {=0A= int i;=0A= =20=0A= + if (!i386_dr_low_set_addr || !i386_dr_low_set_control)=0A= + return -1;=0A= +=0A= /* First, look for an occupied debug register with the same address=0A= and the same RW and LEN definitions. If we find one, we can=0A= reuse it for this watchpoint as well (and save a register). */=0A= @@ -382,8 +395,8 @@ i386_insert_aligned_watchpoint (CORE_ADD=0A= dr_control_mirror &=3D I386_DR_CONTROL_MASK;=0A= =20=0A= /* Finally, actually pass the info to the inferior. */=0A= - I386_DR_LOW_SET_ADDR (i, addr);=0A= - I386_DR_LOW_SET_CONTROL (dr_control_mirror);=0A= + i386_dr_low_set_addr (i, addr);=0A= + i386_dr_low_set_control (dr_control_mirror);=0A= =20=0A= return 0;=0A= }=0A= @@ -411,8 +424,9 @@ i386_remove_aligned_watchpoint (CORE_ADD=0A= dr_mirror[i] =3D 0;=0A= I386_DR_DISABLE (i);=0A= /* Reset it in the inferior. */=0A= - I386_DR_LOW_SET_CONTROL (dr_control_mirror);=0A= - I386_DR_LOW_RESET_ADDR (i);=0A= + i386_dr_low_set_control (dr_control_mirror);=0A= + if (i386_dr_low_reset_addr)=0A= + i386_dr_low_reset_addr (i);=0A= }=0A= retval =3D 0;=0A= }=0A= @@ -571,7 +585,7 @@ i386_stopped_data_address (struct target=0A= int i;=0A= int rc =3D 0;=0A= =20=0A= - dr_status_mirror =3D I386_DR_LOW_GET_STATUS ();=0A= + dr_status_mirror =3D i386_dr_low_get_status ();=0A= =20=0A= ALL_DEBUG_REGISTERS(i)=0A= {=0A= @@ -612,7 +626,7 @@ i386_stopped_by_hwbp (void)=0A= {=0A= int i;=0A= =20=0A= - dr_status_mirror =3D I386_DR_LOW_GET_STATUS ();=0A= + dr_status_mirror =3D i386_dr_low_get_status ();=0A= if (maint_show_dr)=0A= i386_show_dr ("stopped_by_hwbp", 0, 0, hw_execute);=0A= =20=0A= Index: src/gdb/i386fbsd-nat.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/i386fbsd-nat.c,v=0A= retrieving revision 1.18=0A= diff -u -p -r1.18 i386fbsd-nat.c=0A= --- src/gdb/i386fbsd-nat.c 23 Feb 2009 00:03:49 -0000 1.18=0A= +++ src/gdb/i386fbsd-nat.c 12 Mar 2009 23:42:51 -0000=0A= @@ -30,6 +30,7 @@=0A= #include "fbsd-nat.h"=0A= #include "i386-tdep.h"=0A= #include "i386bsd-nat.h"=0A= +#include "i386-dr-nat.h"=0A= =20=0A= /* Resume execution of the inferior process. If STEP is nonzero,=0A= single-step it. If SIGNAL is nonzero, give it that signal. */=0A= @@ -127,6 +128,13 @@ _initialize_i386fbsd_nat (void)=0A= /* Add some extra features to the common *BSD/i386 target. */=0A= t =3D i386bsd_target ();=0A= i386_use_watchpoints (t);=0A= +=0A= + i386_dr_low_set_control =3D i386bsd_dr_set_control;=0A= + i386_dr_low_set_addr =3D i386bsd_dr_set_addr;=0A= + i386_dr_low_reset_addr =3D i386bsd_dr_reset_addr;=0A= + i386_dr_low_get_status =3D i386bsd_dr_get_status;=0A= +=0A= +=0A= t->to_resume =3D i386fbsd_resume;=0A= t->to_pid_to_exec_file =3D fbsd_pid_to_exec_file;=0A= t->to_find_memory_regions =3D fbsd_find_memory_regions;=0A= Index: src/gdb/windows-nat.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/windows-nat.c,v=0A= retrieving revision 1.183=0A= diff -u -p -r1.183 windows-nat.c=0A= --- src/gdb/windows-nat.c 8 Mar 2009 21:01:52 -0000 1.183=0A= +++ src/gdb/windows-nat.c 12 Mar 2009 23:42:52 -0000=0A= @@ -59,6 +59,7 @@=0A= =20=0A= #include "i386-tdep.h"=0A= #include "i387-tdep.h"=0A= +#include "i386-dr-nat.h"=0A= =20=0A= #include "windows-tdep.h"=0A= #include "windows-nat.h"=0A= @@ -116,6 +117,10 @@ static void windows_stop (ptid_t);=0A= static int windows_thread_alive (struct target_ops *, ptid_t);=0A= static void windows_kill_inferior (void);=0A= =20=0A= +void cygwin_set_dr (int i, CORE_ADDR addr);=0A= +void cygwin_set_dr7 (unsigned val);=0A= +unsigned cygwin_get_dr6 (void);=0A= +=0A= static enum target_signal last_sig =3D TARGET_SIGNAL_0;=0A= /* Set if a signal was received from the debugged process */=0A= =20=0A= @@ -2171,6 +2176,11 @@ init_windows_ops (void)=0A= windows_ops.to_pid_to_exec_file =3D windows_pid_to_exec_file;=0A= i386_use_watchpoints (&windows_ops);=0A= =20=0A= + i386_dr_low_set_control =3D cygwin_set_dr7;=0A= + i386_dr_low_set_addr =3D cygwin_set_dr;=0A= + // i386_dr_low_reset_addr =3D cygwin_reset_addr;=0A= + i386_dr_low_get_status =3D cygwin_get_dr6;=0A= +=0A= windows_ops.to_magic =3D OPS_MAGIC;=0A= }=0A= =20=0A= Index: src/gdb/config/i386/nm-cygwin.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin.h,v=0A= retrieving revision 1.9=0A= diff -u -p -r1.9 nm-cygwin.h=0A= --- src/gdb/config/i386/nm-cygwin.h 20 Feb 2009 10:52:24 -0000 1.9=0A= +++ src/gdb/config/i386/nm-cygwin.h 12 Mar 2009 23:42:52 -0000=0A= @@ -18,21 +18,3 @@=0A= =20=0A= #define ADD_SHARED_SYMBOL_FILES dll_symbol_command=0A= void dll_symbol_command (char *, int);=0A= -=0A= -#define I386_USE_GENERIC_WATCHPOINTS=0A= -#define I386_WATCHPOINTS_IN_TARGET_VECTOR=0A= -=0A= -#include "i386/nm-i386.h"=0A= -=0A= -/* Support for hardware-assisted breakpoints and watchpoints. */=0A= -=0A= -#define I386_DR_LOW_SET_CONTROL(VAL) cygwin_set_dr7 (VAL)=0A= -extern void cygwin_set_dr7 (unsigned);=0A= -=0A= -#define I386_DR_LOW_SET_ADDR(N,ADDR) cygwin_set_dr (N,ADDR)=0A= -extern void cygwin_set_dr (int, CORE_ADDR);=0A= -=0A= -#define I386_DR_LOW_RESET_ADDR(N)=0A= -=0A= -#define I386_DR_LOW_GET_STATUS() cygwin_get_dr6 ()=0A= -extern unsigned cygwin_get_dr6 (void);=0A= Index: src/gdb/config/i386/nm-cygwin64.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin64.h,v=0A= retrieving revision 1.2=0A= diff -u -p -r1.2 nm-cygwin64.h=0A= --- src/gdb/config/i386/nm-cygwin64.h 20 Feb 2009 10:52:24 -0000 1.2=0A= +++ src/gdb/config/i386/nm-cygwin64.h 12 Mar 2009 23:42:52 -0000=0A= @@ -17,21 +17,3 @@=0A= =20=0A= #define ADD_SHARED_SYMBOL_FILES dll_symbol_command=0A= void dll_symbol_command (char *, int);=0A= -=0A= -#define I386_USE_GENERIC_WATCHPOINTS=0A= -#define I386_WATCHPOINTS_IN_TARGET_VECTOR=0A= -=0A= -#include "i386/nm-i386.h"=0A= -=0A= -/* Support for hardware-assisted breakpoints and watchpoints. */=0A= -=0A= -#define I386_DR_LOW_SET_CONTROL(VAL) cygwin_set_dr7 (VAL)=0A= -extern void cygwin_set_dr7 (unsigned);=0A= -=0A= -#define I386_DR_LOW_SET_ADDR(N,ADDR) cygwin_set_dr (N,ADDR)=0A= -extern void cygwin_set_dr (int, CORE_ADDR);=0A= -=0A= -#define I386_DR_LOW_RESET_ADDR(N)=0A= -=0A= -#define I386_DR_LOW_GET_STATUS() cygwin_get_dr6 ()=0A= -extern unsigned cygwin_get_dr6 (void);=0A= Index: src/gdb/config/i386/nm-fbsd.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/config/i386/nm-fbsd.h,v=0A= retrieving revision 1.19=0A= diff -u -p -r1.19 nm-fbsd.h=0A= --- src/gdb/config/i386/nm-fbsd.h 20 Feb 2009 10:52:24 -0000 1.19=0A= +++ src/gdb/config/i386/nm-fbsd.h 12 Mar 2009 23:42:52 -0000=0A= @@ -21,34 +21,10 @@=0A= #ifndef NM_FBSD_H=0A= #define NM_FBSD_H=0A= =20=0A= -#ifdef HAVE_PT_GETDBREGS=0A= -#define I386_USE_GENERIC_WATCHPOINTS=0A= -#define I386_WATCHPOINTS_IN_TARGET_VECTOR=0A= -#endif=0A= -=0A= #include "i386/nm-i386.h"=0A= =20=0A= #ifdef HAVE_SYS_PARAM_H=0A= #include =0A= #endif=0A= =20=0A= -/* Provide access to the i386 hardware debugging registers. */=0A= -=0A= -#define I386_DR_LOW_SET_CONTROL(control) \=0A= - i386bsd_dr_set_control (control)=0A= -extern void i386bsd_dr_set_control (unsigned long control);=0A= -=0A= -#define I386_DR_LOW_SET_ADDR(regnum, addr) \=0A= - i386bsd_dr_set_addr (regnum, addr)=0A= -extern void i386bsd_dr_set_addr (int regnum, CORE_ADDR addr);=0A= -=0A= -#define I386_DR_LOW_RESET_ADDR(regnum) \=0A= - i386bsd_dr_reset_addr (regnum)=0A= -extern void i386bsd_dr_reset_addr (int regnum);=0A= -=0A= -#define I386_DR_LOW_GET_STATUS() \=0A= - i386bsd_dr_get_status ()=0A= -extern unsigned long i386bsd_dr_get_status (void);=0A= -=0C=0A= -=0A= #endif /* nm-fbsd.h */=0A= Index: src/gdb/config/i386/nm-go32.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/config/i386/nm-go32.h,v=0A= retrieving revision 1.9=0A= diff -u -p -r1.9 nm-go32.h=0A= --- src/gdb/config/i386/nm-go32.h 20 Feb 2009 10:52:24 -0000 1.9=0A= +++ src/gdb/config/i386/nm-go32.h 12 Mar 2009 23:42:52 -0000=0A= @@ -17,20 +17,5 @@=0A= You should have received a copy of the GNU General Public License=0A= along with this program. If not, see . = */=0A= =20=0A= -#define I386_USE_GENERIC_WATCHPOINTS=0A= -#define I386_WATCHPOINTS_IN_TARGET_VECTOR=0A= -=0A= #include "i386/nm-i386.h"=0A= =20=0A= -/* Support for hardware-assisted breakpoints and watchpoints. */=0A= -=0A= -#define I386_DR_LOW_SET_CONTROL(VAL) go32_set_dr7 (VAL)=0A= -extern void go32_set_dr7 (unsigned);=0A= -=0A= -#define I386_DR_LOW_SET_ADDR(N,ADDR) go32_set_dr (N,ADDR)=0A= -extern void go32_set_dr (int, CORE_ADDR);=0A= -=0A= -#define I386_DR_LOW_RESET_ADDR(N)=0A= -=0A= -#define I386_DR_LOW_GET_STATUS() go32_get_dr6 ()=0A= -extern unsigned go32_get_dr6 (void);=0A= Index: src/gdb/config/i386/nm-i386.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/config/i386/nm-i386.h,v=0A= retrieving revision 1.14=0A= diff -u -p -r1.14 nm-i386.h=0A= --- src/gdb/config/i386/nm-i386.h 3 Jan 2009 05:57:54 -0000 1.14=0A= +++ src/gdb/config/i386/nm-i386.h 12 Mar 2009 23:42:52 -0000=0A= @@ -19,107 +19,4 @@=0A= #ifndef NM_I386_H=0A= #define NM_I386_H 1=0A= =20=0A= -/* Hardware-assisted breakpoints and watchpoints. */=0A= -=0A= -/* Targets should define this to use the generic x86 watchpoint support. = */=0A= -#ifdef I386_USE_GENERIC_WATCHPOINTS=0A= -=0A= -/* Add watchpoint methods to the provided target_ops. Targets which call= =0A= - this should also define I386_WATCHPOINTS_IN_TARGET_VECTOR. */=0A= -struct target_ops;=0A= -void i386_use_watchpoints (struct target_ops *);=0A= -=0A= -/* Clear the reference counts and forget everything we knew about DRi. */= =0A= -extern void i386_cleanup_dregs (void);=0A= -=0A= -/* Insert a watchpoint to watch a memory region which starts at=0A= - address ADDR and whose length is LEN bytes. Watch memory accesses=0A= - of the type TYPE. Return 0 on success, -1 on failure. */=0A= -extern int i386_insert_watchpoint (CORE_ADDR addr, int len, int type);=0A= -=0A= -/* Remove a watchpoint that watched the memory region which starts at=0A= - address ADDR, whose length is LEN bytes, and for accesses of the=0A= - type TYPE. Return 0 on success, -1 on failure. */=0A= -extern int i386_remove_watchpoint (CORE_ADDR addr, int len, int type);=0A= -=0A= -/* Return non-zero if we can watch a memory region that starts at=0A= - address ADDR and whose length is LEN bytes. */=0A= -extern int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len);=0A= -=0A= -/* Return non-zero if the inferior has some break/watchpoint that=0A= - triggered. */=0A= -extern int i386_stopped_by_hwbp (void);=0A= -=0A= -/* If the inferior has some break/watchpoint that triggered, set=0A= - the address associated with that break/watchpoint and return=0A= - true. Otherwise, return false. */=0A= -extern int i386_stopped_data_address (struct target_ops *, CORE_ADDR *);= =0A= -=0A= -/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.=0A= - Return 0 on success, EBUSY on failure. */=0A= -struct bp_target_info;=0A= -extern int i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt);=0A= -=0A= -/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address.=0A= - Return 0 on success, -1 on failure. */=0A= -extern int i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt);=0A= -=0A= -extern int i386_stopped_by_watchpoint (void);=0A= -=0A= -#ifndef I386_WATCHPOINTS_IN_TARGET_VECTOR=0A= -=0A= -/* Returns the number of hardware watchpoints of type TYPE that we can=0A= - set. Value is positive if we can set CNT watchpoints, zero if=0A= - setting watchpoints of type TYPE is not supported, and negative if=0A= - CNT is more than the maximum number of watchpoints of type TYPE=0A= - that we can support. TYPE is one of bp_hardware_watchpoint,=0A= - bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_breakpoint.=0A= - CNT is the number of such watchpoints used so far (including this=0A= - one). OTHERTYPE is non-zero if other types of watchpoints are=0A= - currently enabled.=0A= -=0A= - We always return 1 here because we don't have enough information=0A= - about possible overlap of addresses that they want to watch. As an=0A= - extreme example, consider the case where all the watchpoints watch=0A= - the same address and the same region length: then we can handle a=0A= - virtually unlimited number of watchpoints, due to debug register=0A= - sharing implemented via reference counts in i386-nat.c. */=0A= -=0A= -#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1=0A= -=0A= -/* Returns non-zero if we can use hardware watchpoints to watch a=0A= - region whose address is ADDR and whose length is LEN. */=0A= -=0A= -#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) \=0A= - i386_region_ok_for_watchpoint (addr, len)=0A= -=0A= -/* After a watchpoint trap, the PC points to the instruction after the=0A= - one that caused the trap. Therefore we don't need to step over it.=0A= - But we do need to reset the status register to avoid another trap. */= =0A= -=0A= -#define HAVE_CONTINUABLE_WATCHPOINT 1=0A= -=0A= -#define STOPPED_BY_WATCHPOINT(W) (i386_stopped_by_watchpoint () !=3D= 0)=0A= -=0A= -#define target_stopped_data_address(target, x) \=0A= - i386_stopped_data_address(target, x)=0A= -=0A= -/* Use these macros for watchpoint insertion/removal. */=0A= -=0A= -#define target_insert_watchpoint(addr, len, type) \=0A= - i386_insert_watchpoint (addr, len, type)=0A= -=0A= -#define target_remove_watchpoint(addr, len, type) \=0A= - i386_remove_watchpoint (addr, len, type)=0A= -=0A= -#define target_insert_hw_breakpoint(bp_tgt) \=0A= - i386_insert_hw_breakpoint (bp_tgt)=0A= -=0A= -#define target_remove_hw_breakpoint(bp_tgt) \=0A= - i386_remove_hw_breakpoint (bp_tgt)=0A= -=0A= -#endif /* I386_WATCHPOINTS_IN_TARGET_VECTOR */=0A= -=0A= -#endif /* I386_USE_GENERIC_WATCHPOINTS */=0A= -=0A= #endif /* NM_I386_H */=0A= Index: src/gdb/config/i386/nm-linux.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/config/i386/nm-linux.h,v=0A= retrieving revision 1.29=0A= diff -u -p -r1.29 nm-linux.h=0A= --- src/gdb/config/i386/nm-linux.h 3 Jan 2009 05:57:54 -0000 1.29=0A= +++ src/gdb/config/i386/nm-linux.h 12 Mar 2009 23:42:52 -0000=0A= @@ -22,32 +22,9 @@=0A= #ifndef NM_LINUX_H=0A= #define NM_LINUX_H=0A= =20=0A= -/* GNU/Linux supports the i386 hardware debugging registers. */=0A= -#define I386_USE_GENERIC_WATCHPOINTS=0A= -#define I386_WATCHPOINTS_IN_TARGET_VECTOR=0A= -=0A= #include "i386/nm-i386.h"=0A= #include "config/nm-linux.h"=0A= =20=0A= -/* Provide access to the i386 hardware debugging registers. */=0A= -=0A= -extern void i386_linux_dr_set_control (unsigned long control);=0A= -#define I386_DR_LOW_SET_CONTROL(control) \=0A= - i386_linux_dr_set_control (control)=0A= -=0A= -extern void i386_linux_dr_set_addr (int regnum, CORE_ADDR addr);=0A= -#define I386_DR_LOW_SET_ADDR(regnum, addr) \=0A= - i386_linux_dr_set_addr (regnum, addr)=0A= -=0A= -extern void i386_linux_dr_reset_addr (int regnum);=0A= -#define I386_DR_LOW_RESET_ADDR(regnum) \=0A= - i386_linux_dr_reset_addr (regnum)=0A= -=0A= -extern unsigned long i386_linux_dr_get_status (void);=0A= -#define I386_DR_LOW_GET_STATUS() \=0A= - i386_linux_dr_get_status ()=0A= -=0C=0A= -=0A= #ifdef HAVE_PTRACE_GETFPXREGS=0A= /* Include register set support for the SSE registers. */=0A= #define FILL_FPXREGSET=0A= Index: src/gdb/config/i386/nm-linux64.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/config/i386/nm-linux64.h,v=0A= retrieving revision 1.9=0A= diff -u -p -r1.9 nm-linux64.h=0A= --- src/gdb/config/i386/nm-linux64.h 3 Jan 2009 05:57:54 -0000 1.9=0A= +++ src/gdb/config/i386/nm-linux64.h 12 Mar 2009 23:42:52 -0000=0A= @@ -23,32 +23,7 @@=0A= #ifndef NM_LINUX64_H=0A= #define NM_LINUX64_H=0A= =20=0A= -/* GNU/Linux supports the i386 hardware debugging registers. */=0A= -#define I386_USE_GENERIC_WATCHPOINTS=0A= -#define I386_WATCHPOINTS_IN_TARGET_VECTOR=0A= -=0A= #include "i386/nm-i386.h"=0A= #include "config/nm-linux.h"=0A= =20=0A= -/* Support for 8-byte wide hardware watchpoints. */=0A= -#define TARGET_HAS_DR_LEN_8 1=0A= -=0A= -/* Provide access to the i386 hardware debugging registers. */=0A= -=0A= -extern void amd64_linux_dr_set_control (unsigned long control);=0A= -#define I386_DR_LOW_SET_CONTROL(control) \=0A= - amd64_linux_dr_set_control (control)=0A= -=0A= -extern void amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr);=0A= -#define I386_DR_LOW_SET_ADDR(regnum, addr) \=0A= - amd64_linux_dr_set_addr (regnum, addr)=0A= -=0A= -extern void amd64_linux_dr_reset_addr (int regnum);=0A= -#define I386_DR_LOW_RESET_ADDR(regnum) \=0A= - amd64_linux_dr_reset_addr (regnum)=0A= -=0A= -extern unsigned long amd64_linux_dr_get_status (void);=0A= -#define I386_DR_LOW_GET_STATUS() \=0A= - amd64_linux_dr_get_status ()=0A= -=0A= #endif /* nm-linux64.h */=0A= ------=_NextPart_000_000A_01C9A37A.EB28D870--