projecttype:gdb email:muller@ics.u-strasbg.fr revision:HEAD Index: src/gdb/amd64-linux-nat.c =================================================================== RCS file: /cvs/src/src/gdb/amd64-linux-nat.c,v retrieving revision 1.24 diff -u -p -r1.24 amd64-linux-nat.c --- src/gdb/amd64-linux-nat.c 23 Feb 2009 00:03:48 -0000 1.24 +++ src/gdb/amd64-linux-nat.c 12 Mar 2009 23:42:40 -0000 @@ -25,6 +25,7 @@ #include "regcache.h" #include "linux-nat.h" #include "amd64-linux-tdep.h" +#include "i386-dr-nat.h" #include "gdb_assert.h" #include "gdb_string.h" @@ -286,14 +287,15 @@ amd64_linux_dr_set (ptid_t ptid, int reg } void -amd64_linux_dr_set_control (unsigned long control) +amd64_linux_dr_set_control (unsigned control) { struct lwp_info *lp; ptid_t ptid; + unsigned long ctrl = control; - amd64_linux_dr[DR_CONTROL] = control; + amd64_linux_dr[DR_CONTROL] = ctrl; ALL_LWPS (lp, ptid) - amd64_linux_dr_set (ptid, DR_CONTROL, control); + amd64_linux_dr_set (ptid, DR_CONTROL, ctrl); } void @@ -315,10 +317,10 @@ amd64_linux_dr_reset_addr (int regnum) amd64_linux_dr_set_addr (regnum, 0); } -unsigned long +unsigned amd64_linux_dr_get_status (void) { - return amd64_linux_dr_get (inferior_ptid, DR_STATUS); + return (unsigned) amd64_linux_dr_get (inferior_ptid, DR_STATUS); } static void @@ -658,6 +660,11 @@ _initialize_amd64_linux_nat (void) i386_use_watchpoints (t); + i386_dr_low_set_control = amd64_linux_dr_set_control; + i386_dr_low_set_addr = amd64_linux_dr_set_addr; + i386_dr_low_reset_addr = amd64_linux_dr_reset_addr; + i386_dr_low_get_status = amd64_linux_dr_get_status; + /* Override the GNU/Linux inferior startup hook. */ super_post_startup_inferior = t->to_post_startup_inferior; t->to_post_startup_inferior = amd64_linux_child_post_startup_inferior; Index: src/gdb/config.in =================================================================== RCS file: /cvs/src/src/gdb/config.in,v retrieving revision 1.105 diff -u -p -r1.105 config.in --- src/gdb/config.in 28 Jan 2009 15:01:00 -0000 1.105 +++ src/gdb/config.in 12 Mar 2009 23:42:40 -0000 @@ -561,6 +561,9 @@ /* Define to 1 if you have the `_mcleanup' function. */ #undef HAVE__MCLEANUP +/* Defined if i386 native port supports debug registers */ +#undef I386_USE_GENERIC_WATCHPOINTS + /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST @@ -662,6 +665,9 @@ moved. */ #undef SYSTEM_GDBINIT_RELOCATABLE +/* Defined if i386 debug registers are 8 bytes long */ +#undef TARGET_HAS_DR_LEN_8 + /* Define if has the TD_NOTALLOC error code. */ #undef THREAD_DB_HAS_TD_NOTALLOC Index: src/gdb/configure =================================================================== RCS file: /cvs/src/src/gdb/configure,v retrieving revision 1.266 diff -u -p -r1.266 configure --- src/gdb/configure 2 Feb 2009 23:18:04 -0000 1.266 +++ src/gdb/configure 12 Mar 2009 23:42:49 -0000 @@ -20773,6 +20773,36 @@ done ac_config_links="$ac_config_links $ac_config_links_1" +# Set I386_USE_GENERIC_WATCHPOINTS if native host supports it +if test "${gdb_host_cpu}" == "i386"; then +if test "${gdb_use_i386_dr}" != ""; then + i386_use_generic_watchpoints=1 + # for FreeBSD, we need to know if HAVE_PT_GETDBREGS is set + # this test is done above + # and stored in gdb_cv_have_pt_getdbregs variable + if test "${gdb_host}" == "fbsd"; then + if test $gdb_cv_have_pt_getdbregs = no; then + i386_use_generic_watchpoints=0 + fi + fi + + if test "${i386_use_generic_watchpoints}" == "1"; then + +cat >>confdefs.h <<\_ACEOF +#define I386_USE_GENERIC_WATCHPOINTS 1 +_ACEOF + + fi + if test "${gdb_use_i386_dr}" == "8"; then + +cat >>confdefs.h <<\_ACEOF +#define TARGET_HAS_DR_LEN_8 1 +_ACEOF + + fi +fi +fi + Index: src/gdb/configure.ac =================================================================== RCS file: /cvs/src/src/gdb/configure.ac,v retrieving revision 1.86 diff -u -p -r1.86 configure.ac --- src/gdb/configure.ac 2 Feb 2009 23:18:05 -0000 1.86 +++ src/gdb/configure.ac 12 Mar 2009 23:42:50 -0000 @@ -1926,6 +1926,31 @@ AC_SUBST(nm_h) AC_LINK_FILES($files, $links) +# Set I386_USE_GENERIC_WATCHPOINTS if native host supports it +if test "${gdb_host_cpu}" == "i386"; then +dnl Check if native supports generic watchpoints +if test "${gdb_use_i386_dr}" != ""; then + i386_use_generic_watchpoints=1 + # for FreeBSD, we need to know if HAVE_PT_GETDBREGS is set + # this test is done above + # and stored in gdb_cv_have_pt_getdbregs variable + if test "${gdb_host}" == "fbsd"; then + if test $gdb_cv_have_pt_getdbregs = no; then + i386_use_generic_watchpoints=0 + fi + fi + + if test "${i386_use_generic_watchpoints}" == "1"; then + AC_DEFINE(I386_USE_GENERIC_WATCHPOINTS, 1, + [Defined if i386 native port supports debug registers]) + fi + if test "${gdb_use_i386_dr}" == "8"; then + AC_DEFINE(TARGET_HAS_DR_LEN_8, 1, + [Defined if i386 debug registers are 8 bytes long]) + fi +fi +fi + dnl Check for exe extension set on certain hosts (e.g. Win32) AC_EXEEXT Index: src/gdb/configure.host =================================================================== RCS file: /cvs/src/src/gdb/configure.host,v retrieving revision 1.103 diff -u -p -r1.103 configure.host --- src/gdb/configure.host 11 Jan 2009 13:15:56 -0000 1.103 +++ src/gdb/configure.host 12 Mar 2009 23:42:50 -0000 @@ -85,16 +85,21 @@ hppa*-*-netbsd*) gdb_host=nbsd ;; hppa*-*-openbsd*) gdb_host=obsd ;; i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu) - gdb_host=fbsd ;; + gdb_host=fbsd + gdb_use_i386_dr=4 ;; i[34567]86-*-netbsdelf* | i[34567]86-*-knetbsd*-gnu) gdb_host=nbsdelf ;; i[34567]86-*-netbsd*) gdb_host=nbsdaout ;; -i[34567]86-*-go32*) gdb_host=go32 ;; +i[34567]86-*-go32*) gdb_host=go32 + gdb_use_i386_dr=4 ;; i[34567]86-*-mingw32*) gdb_host=mingw + gdb_use_i386_dr=4 gdb_host_obs=mingw-hdep.o ;; -i[34567]86-*-msdosdjgpp*) gdb_host=go32 ;; -i[34567]86-*-linux*) gdb_host=linux ;; +i[34567]86-*-msdosdjgpp*) gdb_host=go32 + gdb_use_i386_dr=4 ;; +i[34567]86-*-linux*) gdb_host=linux + gdb_use_i386_dr=4 ;; i[34567]86-*-gnu*) gdb_host=i386gnu ;; i[3456]86-*-nto*) gdb_host=nto ;; i[34567]86-*-openbsd[0-2].* | i[34567]86-*-openbsd3.[0-3]) @@ -102,7 +107,8 @@ i[34567]86-*-openbsd[0-2].* | i[34567]86 i[34567]86-*-openbsd*) gdb_host=obsd ;; i[34567]86-*-solaris2.1[0-9]*) gdb_host=sol2-64 ;; i[34567]86-*-solaris*) gdb_host=i386sol2 ;; -i[34567]86-*-cygwin*) gdb_host=cygwin ;; +i[34567]86-*-cygwin*) gdb_host=cygwin + gdb_use_i386_dr=4 ;; ia64-*-linux*) gdb_host=linux ;; @@ -165,13 +171,16 @@ vax-*-netbsd*) gdb_host=nbsdaout ;; vax-*-openbsd*) gdb_host=obsd ;; vax-*-ultrix*) gdb_host=vax ;; -x86_64-*-linux*) gdb_host=linux64 ;; +x86_64-*-linux*) gdb_host=linux64 + gdb_use_i386_dr=8 ;; x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) - gdb_host=fbsd64 ;; + gdb_host=fbsd64 + gdb_use_i386_dr=8 ;; x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu) gdb_host=nbsd64 ;; x86_64-*-openbsd*) gdb_host=obsd64 ;; x86_64-*-mingw*) gdb_host=mingw64 + gdb_use_i386_dr=8 gdb_host_obs=mingw-hdep.o ;; m32r*-*-linux*) gdb_host=linux ;; @@ -180,8 +189,6 @@ xtensa*-*-linux*) gdb_host=linux ;; esac - - # Map the host/cpu onto the floatformat correspondong to C's "float", # "double" and "long double" types. Index: src/gdb/go32-nat.c =================================================================== RCS file: /cvs/src/src/gdb/go32-nat.c,v retrieving revision 1.65 diff -u -p -r1.65 go32-nat.c --- src/gdb/go32-nat.c 23 Feb 2009 00:03:49 -0000 1.65 +++ src/gdb/go32-nat.c 12 Mar 2009 23:42:51 -0000 @@ -31,6 +31,7 @@ #include "buildsym.h" #include "i387-tdep.h" #include "i386-tdep.h" +#include "i386-dr-nat.h" #include "value.h" #include "regcache.h" #include "gdb_string.h" @@ -919,6 +920,12 @@ init_go32_ops (void) i386_use_watchpoints (&go32_ops); + + i386_dr_low_set_control = go32_set_dr7; + i386_dr_low_set_addr = go32_set_dr; + i386_dr_low_reset_addr = NULL; + i386_dr_low_get_status = go32_get_dr6; + go32_ops.to_magic = OPS_MAGIC; /* Initialize child's cwd as empty to be initialized when starting Index: src/gdb/i386-dr-nat.h =================================================================== RCS file: src/gdb/i386-dr-nat.h diff -N src/gdb/i386-dr-nat.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/gdb/i386-dr-nat.h 12 Mar 2009 23:42:51 -0000 @@ -0,0 +1,123 @@ +/* Native-dependent code for the i386. + + Low level functions to implement Oeprating System specific + code to manipulate I386 debug registers. + + Copyright (C) 2009 + 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 3 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, see . */ + +#include "config.h" +#include "defs.h" +#include "breakpoint.h" +#include "command.h" +#include "gdbcmd.h" + +#ifndef I386_DR_NAT_H +#define I386_DR_NAT_H 1 + +/* Hardware-assisted breakpoints and watchpoints. */ + +/* Targets should define this to use the generic x86 watchpoint support. */ +#ifdef I386_USE_GENERIC_WATCHPOINTS + +/* Support for hardware watchpoints and breakpoints using the i386 + debug registers. + + This provides several functions for inserting and removing + hardware-assisted breakpoints and watchpoints, testing if one or + more of the watchpoints triggered and at what address, checking + whether a given region can be watched, etc. + + In addition, each target should provide three (or four) low-level functions + that will be called to insert watchpoints and hardware breakpoints + into the inferior, remove them, and check their status. These + functions variables are: + + i386_dr_low_set_control -- set the debug control (DR7) + register to a given value + + i386_dr_low_set_addr -- put an address into one debug + register + + i386_dr_low_get_status -- return the value of the debug + status (DR6) register. + + i386_dr_low_reset_addr -- reset the address stored in + one debug register + This last function is optional, and will only be called if set.² + + + The functions below implement debug registers sharing by reference + counts, and allow to watch regions up to 16 bytes long + (32 bytes on amd64). */ + + +/* Add watchpoint methods to the provided target_ops. + Targets defining I386_USE_GENERIC_WATCHPOINTS should call + this function in the init function defining the target vector. */ +struct target_ops; +void i386_use_watchpoints (struct target_ops *); + +/* Clear the reference counts and forget everything we knew about DRi. */ +extern void i386_cleanup_dregs (void); + +/* Insert a watchpoint to watch a memory region which starts at + address ADDR and whose length is LEN bytes. Watch memory accesses + of the type TYPE. Return 0 on success, -1 on failure. */ +extern int i386_insert_watchpoint (CORE_ADDR addr, int len, int type); + +/* Remove a watchpoint that watched the memory region which starts at + address ADDR, whose length is LEN bytes, and for accesses of the + type TYPE. Return 0 on success, -1 on failure. */ +extern int i386_remove_watchpoint (CORE_ADDR addr, int len, int type); + +/* Return non-zero if we can watch a memory region that starts at + address ADDR and whose length is LEN bytes. */ +extern int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len); + +/* Return non-zero if the inferior has some break/watchpoint that + triggered. */ +extern int i386_stopped_by_hwbp (void); + +/* If the inferior has some break/watchpoint that triggered, set + the address associated with that break/watchpoint and return + true. Otherwise, return false. */ +extern int i386_stopped_data_address (struct target_ops *, CORE_ADDR *); + +/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address. + Return 0 on success, EBUSY on failure. */ +struct bp_target_info; +extern int i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt); + +/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address. + Return 0 on success, -1 on failure. */ +extern int i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt); + +extern int i386_stopped_by_watchpoint (void); + +#endif /* I386_USE_GENERIC_WATCHPOINTS */ + +void (*i386_dr_low_set_control)(unsigned); + +void (*i386_dr_low_set_addr)(int, CORE_ADDR); + +void (*i386_dr_low_reset_addr)(int); + +unsigned (*i386_dr_low_get_status)(void); + +#endif /* I386_DR_NAT_H */ Index: src/gdb/i386-linux-nat.c =================================================================== RCS file: /cvs/src/src/gdb/i386-linux-nat.c,v retrieving revision 1.90 diff -u -p -r1.90 i386-linux-nat.c --- src/gdb/i386-linux-nat.c 23 Feb 2009 00:42:06 -0000 1.90 +++ src/gdb/i386-linux-nat.c 12 Mar 2009 23:42:51 -0000 @@ -64,6 +64,7 @@ #include "i387-tdep.h" #include "i386-tdep.h" +#include "i386-dr-nat.h" #include "i386-linux-tdep.h" /* Defines ps_err_e, struct ps_prochandle. */ @@ -825,6 +826,11 @@ _initialize_i386_linux_nat (void) i386_use_watchpoints (t); + i386_dr_low_set_control = i386_linux_dr_set_control; + i386_dr_low_set_addr = i386_linux_dr_set_addr; + i386_dr_low_reset_addr = i386_linux_dr_reset_addr; + i386_dr_low_get_status = i386_linux_dr_get_status; + /* Override the default ptrace resume method. */ t->to_resume = i386_linux_resume; Index: src/gdb/i386-nat.c =================================================================== RCS file: /cvs/src/src/gdb/i386-nat.c,v retrieving revision 1.19 diff -u -p -r1.19 i386-nat.c --- src/gdb/i386-nat.c 3 Jan 2009 05:57:51 -0000 1.19 +++ src/gdb/i386-nat.c 12 Mar 2009 23:42:51 -0000 @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "i386-dr-nat.h" #include "defs.h" #include "breakpoint.h" #include "command.h" @@ -60,6 +61,15 @@ #ifdef I386_USE_GENERIC_WATCHPOINTS +#undef I386_DR_LOW_SET_CONTROL +#undef I386_DR_LOW_SET_ADDR +#undef I386_DR_LOW_RESET_ADDR +#undef I386_DR_LOW_GET_STATUS +#define I386_DR_LOW_SET_CONTROL generate_compile_error() +#define I386_DR_LOW_SET_ADDR generate_compile_error() +#define I386_DR_LOW_RESET_ADDR generate_compile_error() +#define I386_DR_LOW_GET_STATUS generate_compile_error() + /* Support for 8-byte wide hw watchpoints. */ #ifndef TARGET_HAS_DR_LEN_8 #define TARGET_HAS_DR_LEN_8 0 @@ -339,6 +349,9 @@ i386_insert_aligned_watchpoint (CORE_ADD { int i; + if (!i386_dr_low_set_addr || !i386_dr_low_set_control) + return -1; + /* First, look for an occupied debug register with the same address and the same RW and LEN definitions. If we find one, we can reuse it for this watchpoint as well (and save a register). */ @@ -382,8 +395,8 @@ i386_insert_aligned_watchpoint (CORE_ADD dr_control_mirror &= I386_DR_CONTROL_MASK; /* Finally, actually pass the info to the inferior. */ - I386_DR_LOW_SET_ADDR (i, addr); - I386_DR_LOW_SET_CONTROL (dr_control_mirror); + i386_dr_low_set_addr (i, addr); + i386_dr_low_set_control (dr_control_mirror); return 0; } @@ -411,8 +424,9 @@ i386_remove_aligned_watchpoint (CORE_ADD dr_mirror[i] = 0; I386_DR_DISABLE (i); /* Reset it in the inferior. */ - I386_DR_LOW_SET_CONTROL (dr_control_mirror); - I386_DR_LOW_RESET_ADDR (i); + i386_dr_low_set_control (dr_control_mirror); + if (i386_dr_low_reset_addr) + i386_dr_low_reset_addr (i); } retval = 0; } @@ -571,7 +585,7 @@ i386_stopped_data_address (struct target int i; int rc = 0; - dr_status_mirror = I386_DR_LOW_GET_STATUS (); + dr_status_mirror = i386_dr_low_get_status (); ALL_DEBUG_REGISTERS(i) { @@ -612,7 +626,7 @@ i386_stopped_by_hwbp (void) { int i; - dr_status_mirror = I386_DR_LOW_GET_STATUS (); + dr_status_mirror = i386_dr_low_get_status (); if (maint_show_dr) i386_show_dr ("stopped_by_hwbp", 0, 0, hw_execute); Index: src/gdb/i386fbsd-nat.c =================================================================== RCS file: /cvs/src/src/gdb/i386fbsd-nat.c,v retrieving revision 1.18 diff -u -p -r1.18 i386fbsd-nat.c --- src/gdb/i386fbsd-nat.c 23 Feb 2009 00:03:49 -0000 1.18 +++ src/gdb/i386fbsd-nat.c 12 Mar 2009 23:42:51 -0000 @@ -30,6 +30,7 @@ #include "fbsd-nat.h" #include "i386-tdep.h" #include "i386bsd-nat.h" +#include "i386-dr-nat.h" /* Resume execution of the inferior process. If STEP is nonzero, single-step it. If SIGNAL is nonzero, give it that signal. */ @@ -127,6 +128,13 @@ _initialize_i386fbsd_nat (void) /* Add some extra features to the common *BSD/i386 target. */ t = i386bsd_target (); i386_use_watchpoints (t); + + i386_dr_low_set_control = i386bsd_dr_set_control; + i386_dr_low_set_addr = i386bsd_dr_set_addr; + i386_dr_low_reset_addr = i386bsd_dr_reset_addr; + i386_dr_low_get_status = i386bsd_dr_get_status; + + t->to_resume = i386fbsd_resume; t->to_pid_to_exec_file = fbsd_pid_to_exec_file; t->to_find_memory_regions = fbsd_find_memory_regions; Index: src/gdb/windows-nat.c =================================================================== RCS file: /cvs/src/src/gdb/windows-nat.c,v retrieving revision 1.183 diff -u -p -r1.183 windows-nat.c --- src/gdb/windows-nat.c 8 Mar 2009 21:01:52 -0000 1.183 +++ src/gdb/windows-nat.c 12 Mar 2009 23:42:52 -0000 @@ -59,6 +59,7 @@ #include "i386-tdep.h" #include "i387-tdep.h" +#include "i386-dr-nat.h" #include "windows-tdep.h" #include "windows-nat.h" @@ -116,6 +117,10 @@ static void windows_stop (ptid_t); static int windows_thread_alive (struct target_ops *, ptid_t); static void windows_kill_inferior (void); +void cygwin_set_dr (int i, CORE_ADDR addr); +void cygwin_set_dr7 (unsigned val); +unsigned cygwin_get_dr6 (void); + static enum target_signal last_sig = TARGET_SIGNAL_0; /* Set if a signal was received from the debugged process */ @@ -2171,6 +2176,11 @@ init_windows_ops (void) windows_ops.to_pid_to_exec_file = windows_pid_to_exec_file; i386_use_watchpoints (&windows_ops); + i386_dr_low_set_control = cygwin_set_dr7; + i386_dr_low_set_addr = cygwin_set_dr; + // i386_dr_low_reset_addr = cygwin_reset_addr; + i386_dr_low_get_status = cygwin_get_dr6; + windows_ops.to_magic = OPS_MAGIC; } Index: src/gdb/config/i386/nm-cygwin.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin.h,v retrieving revision 1.9 diff -u -p -r1.9 nm-cygwin.h --- src/gdb/config/i386/nm-cygwin.h 20 Feb 2009 10:52:24 -0000 1.9 +++ src/gdb/config/i386/nm-cygwin.h 12 Mar 2009 23:42:52 -0000 @@ -18,21 +18,3 @@ #define ADD_SHARED_SYMBOL_FILES dll_symbol_command void dll_symbol_command (char *, int); - -#define I386_USE_GENERIC_WATCHPOINTS -#define I386_WATCHPOINTS_IN_TARGET_VECTOR - -#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); Index: src/gdb/config/i386/nm-cygwin64.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin64.h,v retrieving revision 1.2 diff -u -p -r1.2 nm-cygwin64.h --- src/gdb/config/i386/nm-cygwin64.h 20 Feb 2009 10:52:24 -0000 1.2 +++ src/gdb/config/i386/nm-cygwin64.h 12 Mar 2009 23:42:52 -0000 @@ -17,21 +17,3 @@ #define ADD_SHARED_SYMBOL_FILES dll_symbol_command void dll_symbol_command (char *, int); - -#define I386_USE_GENERIC_WATCHPOINTS -#define I386_WATCHPOINTS_IN_TARGET_VECTOR - -#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); Index: src/gdb/config/i386/nm-fbsd.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/nm-fbsd.h,v retrieving revision 1.19 diff -u -p -r1.19 nm-fbsd.h --- src/gdb/config/i386/nm-fbsd.h 20 Feb 2009 10:52:24 -0000 1.19 +++ src/gdb/config/i386/nm-fbsd.h 12 Mar 2009 23:42:52 -0000 @@ -21,34 +21,10 @@ #ifndef NM_FBSD_H #define NM_FBSD_H -#ifdef HAVE_PT_GETDBREGS -#define I386_USE_GENERIC_WATCHPOINTS -#define I386_WATCHPOINTS_IN_TARGET_VECTOR -#endif - #include "i386/nm-i386.h" #ifdef HAVE_SYS_PARAM_H #include #endif -/* Provide access to the i386 hardware debugging registers. */ - -#define I386_DR_LOW_SET_CONTROL(control) \ - i386bsd_dr_set_control (control) -extern void i386bsd_dr_set_control (unsigned long control); - -#define I386_DR_LOW_SET_ADDR(regnum, addr) \ - i386bsd_dr_set_addr (regnum, addr) -extern void i386bsd_dr_set_addr (int regnum, CORE_ADDR addr); - -#define I386_DR_LOW_RESET_ADDR(regnum) \ - i386bsd_dr_reset_addr (regnum) -extern void i386bsd_dr_reset_addr (int regnum); - -#define I386_DR_LOW_GET_STATUS() \ - i386bsd_dr_get_status () -extern unsigned long i386bsd_dr_get_status (void); - - #endif /* nm-fbsd.h */ Index: src/gdb/config/i386/nm-go32.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/nm-go32.h,v retrieving revision 1.9 diff -u -p -r1.9 nm-go32.h --- src/gdb/config/i386/nm-go32.h 20 Feb 2009 10:52:24 -0000 1.9 +++ src/gdb/config/i386/nm-go32.h 12 Mar 2009 23:42:52 -0000 @@ -17,20 +17,5 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#define I386_USE_GENERIC_WATCHPOINTS -#define I386_WATCHPOINTS_IN_TARGET_VECTOR - #include "i386/nm-i386.h" -/* Support for hardware-assisted breakpoints and watchpoints. */ - -#define I386_DR_LOW_SET_CONTROL(VAL) go32_set_dr7 (VAL) -extern void go32_set_dr7 (unsigned); - -#define I386_DR_LOW_SET_ADDR(N,ADDR) go32_set_dr (N,ADDR) -extern void go32_set_dr (int, CORE_ADDR); - -#define I386_DR_LOW_RESET_ADDR(N) - -#define I386_DR_LOW_GET_STATUS() go32_get_dr6 () -extern unsigned go32_get_dr6 (void); Index: src/gdb/config/i386/nm-i386.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/nm-i386.h,v retrieving revision 1.14 diff -u -p -r1.14 nm-i386.h --- src/gdb/config/i386/nm-i386.h 3 Jan 2009 05:57:54 -0000 1.14 +++ src/gdb/config/i386/nm-i386.h 12 Mar 2009 23:42:52 -0000 @@ -19,107 +19,4 @@ #ifndef NM_I386_H #define NM_I386_H 1 -/* Hardware-assisted breakpoints and watchpoints. */ - -/* Targets should define this to use the generic x86 watchpoint support. */ -#ifdef I386_USE_GENERIC_WATCHPOINTS - -/* Add watchpoint methods to the provided target_ops. Targets which call - this should also define I386_WATCHPOINTS_IN_TARGET_VECTOR. */ -struct target_ops; -void i386_use_watchpoints (struct target_ops *); - -/* Clear the reference counts and forget everything we knew about DRi. */ -extern void i386_cleanup_dregs (void); - -/* Insert a watchpoint to watch a memory region which starts at - address ADDR and whose length is LEN bytes. Watch memory accesses - of the type TYPE. Return 0 on success, -1 on failure. */ -extern int i386_insert_watchpoint (CORE_ADDR addr, int len, int type); - -/* Remove a watchpoint that watched the memory region which starts at - address ADDR, whose length is LEN bytes, and for accesses of the - type TYPE. Return 0 on success, -1 on failure. */ -extern int i386_remove_watchpoint (CORE_ADDR addr, int len, int type); - -/* Return non-zero if we can watch a memory region that starts at - address ADDR and whose length is LEN bytes. */ -extern int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len); - -/* Return non-zero if the inferior has some break/watchpoint that - triggered. */ -extern int i386_stopped_by_hwbp (void); - -/* If the inferior has some break/watchpoint that triggered, set - the address associated with that break/watchpoint and return - true. Otherwise, return false. */ -extern int i386_stopped_data_address (struct target_ops *, CORE_ADDR *); - -/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address. - Return 0 on success, EBUSY on failure. */ -struct bp_target_info; -extern int i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt); - -/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address. - Return 0 on success, -1 on failure. */ -extern int i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt); - -extern int i386_stopped_by_watchpoint (void); - -#ifndef I386_WATCHPOINTS_IN_TARGET_VECTOR - -/* Returns the number of hardware watchpoints of type TYPE that we can - set. Value is positive if we can set CNT watchpoints, zero if - setting watchpoints of type TYPE is not supported, and negative if - CNT is more than the maximum number of watchpoints of type TYPE - that we can support. TYPE is one of bp_hardware_watchpoint, - bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_breakpoint. - CNT is the number of such watchpoints used so far (including this - one). OTHERTYPE is non-zero if other types of watchpoints are - currently enabled. - - We always return 1 here because we don't have enough information - about possible overlap of addresses that they want to watch. As an - extreme example, consider the case where all the watchpoints watch - the same address and the same region length: then we can handle a - virtually unlimited number of watchpoints, due to debug register - sharing implemented via reference counts in i386-nat.c. */ - -#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1 - -/* Returns non-zero if we can use hardware watchpoints to watch a - region whose address is ADDR and whose length is LEN. */ - -#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) \ - i386_region_ok_for_watchpoint (addr, len) - -/* After a watchpoint trap, the PC points to the instruction after the - one that caused the trap. Therefore we don't need to step over it. - But we do need to reset the status register to avoid another trap. */ - -#define HAVE_CONTINUABLE_WATCHPOINT 1 - -#define STOPPED_BY_WATCHPOINT(W) (i386_stopped_by_watchpoint () != 0) - -#define target_stopped_data_address(target, x) \ - i386_stopped_data_address(target, x) - -/* Use these macros for watchpoint insertion/removal. */ - -#define target_insert_watchpoint(addr, len, type) \ - i386_insert_watchpoint (addr, len, type) - -#define target_remove_watchpoint(addr, len, type) \ - i386_remove_watchpoint (addr, len, type) - -#define target_insert_hw_breakpoint(bp_tgt) \ - i386_insert_hw_breakpoint (bp_tgt) - -#define target_remove_hw_breakpoint(bp_tgt) \ - i386_remove_hw_breakpoint (bp_tgt) - -#endif /* I386_WATCHPOINTS_IN_TARGET_VECTOR */ - -#endif /* I386_USE_GENERIC_WATCHPOINTS */ - #endif /* NM_I386_H */ Index: src/gdb/config/i386/nm-linux.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/nm-linux.h,v retrieving revision 1.29 diff -u -p -r1.29 nm-linux.h --- src/gdb/config/i386/nm-linux.h 3 Jan 2009 05:57:54 -0000 1.29 +++ src/gdb/config/i386/nm-linux.h 12 Mar 2009 23:42:52 -0000 @@ -22,32 +22,9 @@ #ifndef NM_LINUX_H #define NM_LINUX_H -/* GNU/Linux supports the i386 hardware debugging registers. */ -#define I386_USE_GENERIC_WATCHPOINTS -#define I386_WATCHPOINTS_IN_TARGET_VECTOR - #include "i386/nm-i386.h" #include "config/nm-linux.h" -/* Provide access to the i386 hardware debugging registers. */ - -extern void i386_linux_dr_set_control (unsigned long control); -#define I386_DR_LOW_SET_CONTROL(control) \ - i386_linux_dr_set_control (control) - -extern void i386_linux_dr_set_addr (int regnum, CORE_ADDR addr); -#define I386_DR_LOW_SET_ADDR(regnum, addr) \ - i386_linux_dr_set_addr (regnum, addr) - -extern void i386_linux_dr_reset_addr (int regnum); -#define I386_DR_LOW_RESET_ADDR(regnum) \ - i386_linux_dr_reset_addr (regnum) - -extern unsigned long i386_linux_dr_get_status (void); -#define I386_DR_LOW_GET_STATUS() \ - i386_linux_dr_get_status () - - #ifdef HAVE_PTRACE_GETFPXREGS /* Include register set support for the SSE registers. */ #define FILL_FPXREGSET Index: src/gdb/config/i386/nm-linux64.h =================================================================== RCS file: /cvs/src/src/gdb/config/i386/nm-linux64.h,v retrieving revision 1.9 diff -u -p -r1.9 nm-linux64.h --- src/gdb/config/i386/nm-linux64.h 3 Jan 2009 05:57:54 -0000 1.9 +++ src/gdb/config/i386/nm-linux64.h 12 Mar 2009 23:42:52 -0000 @@ -23,32 +23,7 @@ #ifndef NM_LINUX64_H #define NM_LINUX64_H -/* GNU/Linux supports the i386 hardware debugging registers. */ -#define I386_USE_GENERIC_WATCHPOINTS -#define I386_WATCHPOINTS_IN_TARGET_VECTOR - #include "i386/nm-i386.h" #include "config/nm-linux.h" -/* Support for 8-byte wide hardware watchpoints. */ -#define TARGET_HAS_DR_LEN_8 1 - -/* Provide access to the i386 hardware debugging registers. */ - -extern void amd64_linux_dr_set_control (unsigned long control); -#define I386_DR_LOW_SET_CONTROL(control) \ - amd64_linux_dr_set_control (control) - -extern void amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr); -#define I386_DR_LOW_SET_ADDR(regnum, addr) \ - amd64_linux_dr_set_addr (regnum, addr) - -extern void amd64_linux_dr_reset_addr (int regnum); -#define I386_DR_LOW_RESET_ADDR(regnum) \ - amd64_linux_dr_reset_addr (regnum) - -extern unsigned long amd64_linux_dr_get_status (void); -#define I386_DR_LOW_GET_STATUS() \ - amd64_linux_dr_get_status () - #endif /* nm-linux64.h */