* [RFC] Remove i386 low level debug register function from nm- header file.
@ 2009-05-10 14:54 Pierre Muller
2009-05-10 17:37 ` Eli Zaretskii
2009-05-12 13:02 ` Ulrich Weigand
0 siblings, 2 replies; 23+ messages in thread
From: Pierre Muller @ 2009-05-10 14:54 UTC (permalink / raw)
To: gdb-patches; +Cc: 'Pedro Alves', 'Eli Zaretskii'
Following my first RFC
http://sourceware.org/ml/gdb-patches/2009-03/msg00197.html
and the following answers, I resubmit
a new version where all i386 low level debug register
is contained in a single struct defined in the
new i386-nat.h header (to comply with DOS file name restrictions
as asked for by Eli).
Once again, the ChangeLog entry is one of the places
where I don't really know how to handle things exactly...
Pierre Muller
Pascal language support maintainer for GDB
PS: FreeBSD seems to have a amd64 version,
but nothing that add debug register support for
this... Is this a FreeBSD kernel restriction
or just something missing in GDB?
Any amd64 FreeBSD user around?
2009-05-10 Pierre Muller <muller.u-strasbg.fr>
Remove all i386 debug register low level macros in config tm files.
(I386_DR_LOW_SET_ADDR, I386_DR_LOW_RESET_ADDR): Remove.
(I386_DR_LOW_GET_STATUS, I386_DR_LOW_SET_CONTROL): Remove.
* i386-nat.h: New file (adapted from i386-nat.c).
(struct i386_dr_low_type): New type.
(i386_dr_low): New global variable.
(i386_set_debug_register_legth): New function.
* i386-nat.c (TARGET_HAS_DR_LEN_8): Update macro.
(i386_insert_aligned_watchpoint): Replace i386 dr low macros by
i386_dr_low struct variable fields.
(i386_remove_aligned_watchpoint): Likewise.
(i386_stopped_data_address): Likewise.
(i386_stopped_by_hwbp): Likewise.
(i386_set_debug_register_length): New function.
* amd64-linux-nat.c: Include "i386-nat.h".
(_initialize_amd64_linux_nat): Set i386_dr_low variable fields.
* go32-nat.c (init_go32_ops): Likewise.
* i386-linux-nat.c (_initialize_i386_linux_nat): Likewise.
* i386fbsd-nat.c (_initialize_i386fbsd_nat): Likewise.
* windows-nat.c: Include "i386-nat.h".
(cygwin_set_dr, cygwin_get_dr6, cygwin_set_dr7): Add prototypes.
(init_windows_ops): Set i386_dr_low function fields.
* amd64-windows-nat.c (_initialize_amd64_windows_nat): Call
i386_set_debug_register_length.
* i386-windows-nat.c (_initialize_i386_windows_nat): Likewise.
* config/i386/nm-cygwin.h: Remove all I386_DR_LOW* macros.
* config/i386/nm-cygwin64.h: Likewise.
* config/i386/nm-fbsd.h: Likewise.
* config/i386/nm-go32.h: Likewise.
* config/i386/nm-linux.h: Likewise.
* config/i386/nm-linux64.h: Likewise.
Index: src/gdb/i386-nat.h
===================================================================
RCS file: i386-nat.h
diff -N i386-nat.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/gdb/i386-nat.h 8 May 2009 13:30:51 -0000
@@ -0,0 +1,133 @@
+/* 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 <http://www.gnu.org/licenses/>.
*/
+
+#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
+
+/* Add watchpoint methods to the provided target_ops.
+ Targets defining I386_USE_GENERIC_WATCHPOINTS should call
+ this. */
+struct target_ops;
+extern 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);
+
+/* 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.
+
+ A target which wants to use these functions should define
+ I386_USE_GENERIC_WATCHPOINTS in its tm.h file.
+
+ In addition, each target should provide several low-level functions
+ regrouped into i386_dr_low_type struct below. These functions
+ that will be called to insert watchpoints and hardware breakpoints
+ into the inferior, remove them, and check their status. These
+ functions are:
+
+ set_control -- set the debug control (DR7)
+ register to a given value
+
+ set_addr -- put an address into one debug
+ register
+
+ reset_addr -- reset the address stored in
+ one debug register
+
+ get_status -- return the value of the debug
+ status (DR6) register.
+
+ Additionally, the native file should set the debug_register_length
+ field to 4 or 8 depending on the number of bytes used for
+ deubg registers. */
+
+struct i386_dr_low_type
+ {
+ void (*set_control) (unsigned);
+ void (*set_addr) (int, CORE_ADDR);
+ void (*reset_addr) (int);
+ unsigned (*get_status) (void);
+ int debug_register_length;
+ };
+
+struct i386_dr_low_type i386_dr_low;
+
+/* Use this function to set i386_dr_low debug_register_length field
+ rather than setting it directly to check that the length is only
+ set once. */
+
+extern void i386_set_debug_register_length (int len);
+
+#endif /* I386_USE_GENERIC_WATCHPOINTS */
+
+#endif /* I386_DR_NAT_H */
Index: src/gdb/amd64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-linux-nat.c,v
retrieving revision 1.25
diff -u -p -r1.25 amd64-linux-nat.c
--- src/gdb/amd64-linux-nat.c 17 Mar 2009 18:39:08 -0000 1.25
+++ src/gdb/amd64-linux-nat.c 8 May 2009 13:13:51 -0000
@@ -50,6 +50,7 @@
#include "amd64-tdep.h"
#include "i386-linux-tdep.h"
#include "amd64-nat.h"
+#include "i386-nat.h"
/* Mapping between the general-purpose registers in GNU/Linux x86-64
`struct user' format and GDB's register cache layout. */
@@ -667,6 +668,12 @@ _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;
+ i386_set_debug_register_length (8);
+
/* 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/amd64-windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-windows-nat.c,v
retrieving revision 1.3
diff -u -p -r1.3 amd64-windows-nat.c
--- src/gdb/amd64-windows-nat.c 13 Jan 2009 04:14:07 -0000 1.3
+++ src/gdb/amd64-windows-nat.c 8 May 2009 13:13:51 -0000
@@ -17,7 +17,7 @@
#include "defs.h"
#include "windows-nat.h"
-
+#include "i386-nat.h"
#include <windows.h>
#define context_offset(x) (offsetof (CONTEXT, x))
@@ -89,4 +89,5 @@ void
_initialize_amd64_windows_nat (void)
{
windows_set_context_register_offsets (mappings);
+ i386_set_debug_register_length (8);
}
Index: src/gdb/go32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/go32-nat.c,v
retrieving revision 1.74
diff -u -p -r1.74 go32-nat.c
--- src/gdb/go32-nat.c 4 May 2009 09:54:17 -0000 1.74
+++ src/gdb/go32-nat.c 8 May 2009 13:13:52 -0000
@@ -85,6 +85,7 @@
#include <fcntl.h>
#include "defs.h"
+#include "i386-nat.h"
#include "inferior.h"
#include "gdbthread.h"
#include "gdb_wait.h"
@@ -975,6 +976,13 @@ 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;
+ i386_set_debug_register_length (4);
+
go32_ops.to_magic = OPS_MAGIC;
/* Initialize child's cwd as empty to be initialized when starting
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 8 May 2009 13:13:53 -0000
@@ -19,6 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "defs.h"
+#include "i386-nat.h"
#include "inferior.h"
#include "gdbcore.h"
#include "regcache.h"
@@ -825,6 +826,12 @@ _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;
+ i386_set_debug_register_length (4);
+
/* 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.20
diff -u -p -r1.20 i386-nat.c
--- src/gdb/i386-nat.c 29 Apr 2009 22:25:17 -0000 1.20
+++ src/gdb/i386-nat.c 8 May 2009 13:13:53 -0000
@@ -18,11 +18,13 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "i386-nat.h"
#include "defs.h"
#include "breakpoint.h"
#include "command.h"
#include "gdbcmd.h"
#include "target.h"
+#include "gdb_assert.h"
/* Support for hardware watchpoints and breakpoints using the i386
debug registers.
@@ -32,29 +34,6 @@
more of the watchpoints triggered and at what address, checking
whether a given region can be watched, etc.
- A target which wants to use these functions should define several
- macros, such as `target_insert_watchpoint' and
- `target_stopped_data_address', listed in target.h, to call the
- appropriate functions below. It should also define
- I386_USE_GENERIC_WATCHPOINTS in its tm.h file.
-
- In addition, each target should provide several low-level macros
- that will be called to insert watchpoints and hardware breakpoints
- into the inferior, remove them, and check their status. These
- macros 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_RESET_ADDR -- reset the address stored in
- one debug register
-
- I386_DR_LOW_GET_STATUS -- return the value of the debug
- status (DR6) register.
-
The functions below implement debug registers sharing by reference
counts, and allow to watch regions up to 16 bytes long. */
@@ -62,7 +41,7 @@
/* Support for 8-byte wide hw watchpoints. */
#ifndef TARGET_HAS_DR_LEN_8
-#define TARGET_HAS_DR_LEN_8 0
+#define TARGET_HAS_DR_LEN_8 (i386_dr_low.debug_register_length == 8)
#endif
/* Debug registers' indices. */
@@ -330,6 +309,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). */
@@ -373,8 +355,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;
}
@@ -402,8 +384,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;
}
@@ -562,7 +545,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)
{
@@ -603,7 +586,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);
@@ -688,6 +671,14 @@ i386_use_watchpoints (struct target_ops
t->to_remove_hw_breakpoint = i386_remove_hw_breakpoint;
}
+void
+i386_set_debug_register_length (int len)
+{
+ /* This function should be called only once for each native target. */
+ gdb_assert (i386_dr_low.debug_register_length == 0);
+ i386_dr_low.debug_register_length = len;
+}
+
#endif /* I386_USE_GENERIC_WATCHPOINTS */
Index: src/gdb/i386-windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-windows-nat.c,v
retrieving revision 1.3
diff -u -p -r1.3 i386-windows-nat.c
--- src/gdb/i386-windows-nat.c 13 Jan 2009 04:14:07 -0000 1.3
+++ src/gdb/i386-windows-nat.c 8 May 2009 13:13:53 -0000
@@ -17,6 +17,7 @@
#include "defs.h"
#include "windows-nat.h"
+#include "i386-nat.h"
#include <windows.h>
@@ -73,4 +74,5 @@ void
_initialize_i386_windows_nat (void)
{
windows_set_context_register_offsets (mappings);
+ i386_set_debug_register_length (4);
}
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 8 May 2009 13:13:53 -0000
@@ -29,6 +29,7 @@
#include "fbsd-nat.h"
#include "i386-tdep.h"
+#include "i386-nat.h"
#include "i386bsd-nat.h"
/* Resume execution of the inferior process. If STEP is nonzero,
@@ -126,7 +127,19 @@ _initialize_i386fbsd_nat (void)
/* Add some extra features to the common *BSD/i386 target. */
t = i386bsd_target ();
+
+#ifdef I386_USE_GENERIC_WATCHPOINTS
+
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;
+ i386_set_debug_register_length (4);
+#endif /* I386_USE_GENERIC_WATCHPOINTS */
+
+
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: windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/windows-nat.c,v
retrieving revision 1.189
diff -u -p -r1.189 windows-nat.c
--- windows-nat.c 17 Apr 2009 15:44:28 -0000 1.189
+++ windows-nat.c 8 May 2009 14:02:25 -0000
@@ -63,6 +63,7 @@
#include "windows-tdep.h"
#include "windows-nat.h"
+#include "i386-nat.h"
#define AdjustTokenPrivileges dyn_AdjustTokenPrivileges
#define DebugActiveProcessStop dyn_DebugActiveProcessStop
@@ -140,6 +141,10 @@ static void windows_stop (ptid_t);
static int windows_thread_alive (struct target_ops *, ptid_t);
static void windows_kill_inferior (struct target_ops *);
+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 */
@@ -2166,8 +2171,22 @@ init_windows_ops (void)
windows_ops.to_has_execution = 1;
windows_ops.to_pid_to_exec_file = windows_pid_to_exec_file;
windows_ops.to_get_ada_task_ptid = windows_get_ada_task_ptid;
+
+#ifdef I386_USE_GENERIC_WATCHPOINTS
+
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 = NULL;
+ i386_dr_low.get_status = cygwin_get_dr6;
+
+ /* i386_dr_low.debug_register_length field is set by
+ calling i386_set_debug_register_length function
+ in processor windows specific native file. */
+
+#endif /* I386_USE_GENERIC_WATCHPOINTS */
+
windows_ops.to_magic = OPS_MAGIC;
}
@@ -2260,6 +2279,8 @@ Show whether to display kernel exception
deprecated_init_ui_hook = set_windows_aliases;
}
+#ifdef I386_USE_GENERIC_WATCHPOINTS
+
/* Hardware watchpoint support, adapted from go32-nat.c code. */
/* Pass the address ADDR to the inferior in the I'th debug register.
@@ -2296,6 +2317,8 @@ cygwin_get_dr6 (void)
return dr[6];
}
+#endif /* I386_USE_GENERIC_WATCHPOINTS */
+
/* Determine if the thread referenced by "ptid" is alive
by "polling" it. If WaitForSingleObject returns WAIT_OBJECT_0
it means that the thread has died. Otherwise it is assumed to be alive.
*/
Index: src/gdb/config/i386/nm-cygwin.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin.h,v
retrieving revision 1.10
diff -u -p -r1.10 nm-cygwin.h
--- src/gdb/config/i386/nm-cygwin.h 26 Mar 2009 00:18:46 -0000 1.10
+++ src/gdb/config/i386/nm-cygwin.h 8 May 2009 13:13:54 -0000
@@ -22,16 +22,3 @@ void dll_symbol_command (char *, int);
#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);
Index: src/gdb/config/i386/nm-cygwin64.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin64.h,v
retrieving revision 1.3
diff -u -p -r1.3 nm-cygwin64.h
--- src/gdb/config/i386/nm-cygwin64.h 26 Mar 2009 00:18:46 -0000 1.3
+++ src/gdb/config/i386/nm-cygwin64.h 8 May 2009 13:13:54 -0000
@@ -21,16 +21,3 @@ void dll_symbol_command (char *, int);
#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);
Index: src/gdb/config/i386/nm-fbsd.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-fbsd.h,v
retrieving revision 1.20
diff -u -p -r1.20 nm-fbsd.h
--- src/gdb/config/i386/nm-fbsd.h 26 Mar 2009 00:18:46 -0000 1.20
+++ src/gdb/config/i386/nm-fbsd.h 8 May 2009 13:13:54 -0000
@@ -31,23 +31,4 @@
#include <sys/param.h>
#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.10
diff -u -p -r1.10 nm-go32.h
--- src/gdb/config/i386/nm-go32.h 26 Mar 2009 00:18:46 -0000 1.10
+++ src/gdb/config/i386/nm-go32.h 8 May 2009 13:13:54 -0000
@@ -20,16 +20,3 @@
#define I386_USE_GENERIC_WATCHPOINTS
#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-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-linux.h,v
retrieving revision 1.30
diff -u -p -r1.30 nm-linux.h
--- src/gdb/config/i386/nm-linux.h 26 Mar 2009 00:18:46 -0000 1.30
+++ src/gdb/config/i386/nm-linux.h 8 May 2009 13:13:54 -0000
@@ -28,25 +28,6 @@
#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.10
diff -u -p -r1.10 nm-linux64.h
--- src/gdb/config/i386/nm-linux64.h 26 Mar 2009 00:18:46 -0000 1.10
+++ src/gdb/config/i386/nm-linux64.h 8 May 2009 13:13:54 -0000
@@ -29,25 +29,4 @@
#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 */
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC] Remove i386 low level debug register function from nm- header file.
2009-05-10 14:54 [RFC] Remove i386 low level debug register function from nm- header file Pierre Muller
@ 2009-05-10 17:37 ` Eli Zaretskii
2009-05-12 13:02 ` Ulrich Weigand
1 sibling, 0 replies; 23+ messages in thread
From: Eli Zaretskii @ 2009-05-10 17:37 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches, pedro
> From: "Pierre Muller" <muller@ics.u-strasbg.fr>
> Cc: "'Pedro Alves'" <pedro@codesourcery.com>, "'Eli Zaretskii'" <eliz@gnu.org>
> Date: Sun, 10 May 2009 16:54:13 +0200
>
> Following my first RFC
> http://sourceware.org/ml/gdb-patches/2009-03/msg00197.html
>
> and the following answers, I resubmit
> a new version where all i386 low level debug register
> is contained in a single struct defined in the
> new i386-nat.h header (to comply with DOS file name restrictions
> as asked for by Eli).
Looks good to me, thanks (although I didn't yet have a chance to apply
and compile).
> Once again, the ChangeLog entry is one of the places
> where I don't really know how to handle things exactly...
I don't see anything wrong with your entries here.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC] Remove i386 low level debug register function from nm- header file.
2009-05-10 14:54 [RFC] Remove i386 low level debug register function from nm- header file Pierre Muller
2009-05-10 17:37 ` Eli Zaretskii
@ 2009-05-12 13:02 ` Ulrich Weigand
2009-05-12 14:37 ` Pierre Muller
1 sibling, 1 reply; 23+ messages in thread
From: Ulrich Weigand @ 2009-05-12 13:02 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches, 'Pedro Alves', 'Eli Zaretskii'
Pierre Muller wrote:
> Following my first RFC
> http://sourceware.org/ml/gdb-patches/2009-03/msg00197.html
>
> and the following answers, I resubmit
> a new version where all i386 low level debug register
> is contained in a single struct defined in the
> new i386-nat.h header (to comply with DOS file name restrictions
> as asked for by Eli).
This looks good to me. However, now that you've moved the
prototypes to i386-nat.h, there is no longer any need for
the config/i386/nm-i386.h file -- please get rid of that file
(by removing the places where it is included into other nm-
files).
Also, it seems to me that now there is no need any more for
the I386_USE_GENERIC_WATCHPOINTS define -- targets that use
watchpoints call the i386_use_watchpoints routines, those
that don't, do not.
I think you should provide everything in i386-nat.c (and
the new i386-nat.h) unconditionally, and eliminate the
various definitions of I386_USE_GENERIC_WATCHPOINTS in the
nm- header files.
Note that in combination with removing nm-i386.h, this
actually makes several nm- files completely empty, so they
should be removed as well.
> 2009-05-10 Pierre Muller <muller.u-strasbg.fr>
>
> Remove all i386 debug register low level macros in config tm files.
Should read "nm" files, not tm.
> +/* Targets should define this to use the generic x86 watchpoint support.
> */
> +#ifdef I386_USE_GENERIC_WATCHPOINTS
As mentioned above, please get rid of this conditional ...
> +
> +/* Add watchpoint methods to the provided target_ops.
> + Targets defining I386_USE_GENERIC_WATCHPOINTS should call
> + this. */
... as well as the second sentence of the comment.
> /* Support for 8-byte wide hw watchpoints. */
> #ifndef TARGET_HAS_DR_LEN_8
> -#define TARGET_HAS_DR_LEN_8 0
> +#define TARGET_HAS_DR_LEN_8 (i386_dr_low.debug_register_length == 8)
> #endif
Nobody should be defining this any more, so please eliminate
the #ifndef ... conditional.
> Index: src/gdb/i386fbsd-nat.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/i386fbsd-nat.c,v
> retrieving revision 1.18
> @@ -126,7 +127,19 @@ _initialize_i386fbsd_nat (void)
>
> /* Add some extra features to the common *BSD/i386 target. */
> t = i386bsd_target ();
> +
> +#ifdef I386_USE_GENERIC_WATCHPOINTS
> +
> 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;
> + i386_set_debug_register_length (4);
> +#endif /* I386_USE_GENERIC_WATCHPOINTS */
In this case, because the header file currently conditionally defines
I386_USE_GENERIC_WATCHPOINTS:
#ifdef HAVE_PT_GETDBREGS
#define I386_USE_GENERIC_WATCHPOINTS
#endif
you should move that condition to the i386fbsd-nat.c file:
#ifdef HAVE_PT_GETDBREGS
i386_use_watchpoints (t);
...
#endif
> diff -u -p -r1.189 windows-nat.c
> --- windows-nat.c 17 Apr 2009 15:44:28 -0000 1.189
> +++ windows-nat.c 8 May 2009 14:02:25 -0000
> @@ -2166,8 +2171,22 @@ init_windows_ops (void)
> windows_ops.to_has_execution = 1;
> windows_ops.to_pid_to_exec_file = windows_pid_to_exec_file;
> windows_ops.to_get_ada_task_ptid = windows_get_ada_task_ptid;
> +
> +#ifdef I386_USE_GENERIC_WATCHPOINTS
> +
> 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 = NULL;
> + i386_dr_low.get_status = cygwin_get_dr6;
Here, it seems every user of windows-nat.c unconditionally
defines I386_USE_GENERIC_WATCHPOINTS, so there's no point in
adding the #ifdef's to this file ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: [RFC] Remove i386 low level debug register function from nm- header file.
2009-05-12 13:02 ` Ulrich Weigand
@ 2009-05-12 14:37 ` Pierre Muller
2009-05-12 15:00 ` Ulrich Weigand
2009-05-12 21:28 ` [RFC-v2] " Pierre Muller
0 siblings, 2 replies; 23+ messages in thread
From: Pierre Muller @ 2009-05-12 14:37 UTC (permalink / raw)
To: 'Ulrich Weigand'
Cc: gdb-patches, 'Pedro Alves', 'Eli Zaretskii'
Thanks for the feedback.
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Ulrich Weigand
> Envoyé : Tuesday, May 12, 2009 3:01 PM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org; 'Pedro Alves'; 'Eli Zaretskii'
> Objet : Re: [RFC] Remove i386 low level debug register function from
> nm- header file.
>
> Pierre Muller wrote:
>
> > Following my first RFC
> > http://sourceware.org/ml/gdb-patches/2009-03/msg00197.html
> >
> > and the following answers, I resubmit
> > a new version where all i386 low level debug register
> > is contained in a single struct defined in the
> > new i386-nat.h header (to comply with DOS file name restrictions
> > as asked for by Eli).
>
> This looks good to me. However, now that you've moved the
> prototypes to i386-nat.h, there is no longer any need for
> the config/i386/nm-i386.h file -- please get rid of that file
> (by removing the places where it is included into other nm-
> files).
OK, but how do I commit a file deletion?
I never did this before!
> Also, it seems to me that now there is no need any more for
> the I386_USE_GENERIC_WATCHPOINTS define -- targets that use
> watchpoints call the i386_use_watchpoints routines, those
> that don't, do not.
Seems reasonable indeed!
> I think you should provide everything in i386-nat.c (and
> the new i386-nat.h) unconditionally, and eliminate the
> various definitions of I386_USE_GENERIC_WATCHPOINTS in the
> nm- header files.
The only drawback is that "maint show-debug--regs" command
will then also appear on target that do not support
debug registers... Anyhow, it will just be a no-op in that case.
Is that a problem?
> Note that in combination with removing nm-i386.h, this
> actually makes several nm- files completely empty, so they
> should be removed as well.
>
> > 2009-05-10 Pierre Muller <muller.u-strasbg.fr>
> >
> > Remove all i386 debug register low level macros in config tm
> files.
>
> Should read "nm" files, not tm.
Yes of course, thanks for catching this!
> > +/* Targets should define this to use the generic x86 watchpoint
> support.
> > */
> > +#ifdef I386_USE_GENERIC_WATCHPOINTS
>
> As mentioned above, please get rid of this conditional ...
>
> > +
> > +/* Add watchpoint methods to the provided target_ops.
> > + Targets defining I386_USE_GENERIC_WATCHPOINTS should call
> > + this. */
>
> ... as well as the second sentence of the comment.
>
> > /* Support for 8-byte wide hw watchpoints. */
> > #ifndef TARGET_HAS_DR_LEN_8
> > -#define TARGET_HAS_DR_LEN_8 0
> > +#define TARGET_HAS_DR_LEN_8 (i386_dr_low.debug_register_length == 8)
> > #endif
>
> Nobody should be defining this any more, so please eliminate
> the #ifndef ... conditional.
OK, will do.
> > Index: src/gdb/i386fbsd-nat.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/i386fbsd-nat.c,v
> > retrieving revision 1.18
> > @@ -126,7 +127,19 @@ _initialize_i386fbsd_nat (void)
> >
> > /* Add some extra features to the common *BSD/i386 target. */
> > t = i386bsd_target ();
> > +
> > +#ifdef I386_USE_GENERIC_WATCHPOINTS
> > +
> > 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;
> > + i386_set_debug_register_length (4);
> > +#endif /* I386_USE_GENERIC_WATCHPOINTS */
>
>
> In this case, because the header file currently conditionally defines
> I386_USE_GENERIC_WATCHPOINTS:
>
> #ifdef HAVE_PT_GETDBREGS
> #define I386_USE_GENERIC_WATCHPOINTS
> #endif
>
> you should move that condition to the i386fbsd-nat.c file:
>
> #ifdef HAVE_PT_GETDBREGS
> i386_use_watchpoints (t);
>
> ...
> #endif
So freebsd with old kernels (not supporting PT_GETDBREGS),
will typically have the non-operational "maint show-debug-reg" command.
> > diff -u -p -r1.189 windows-nat.c
> > --- windows-nat.c 17 Apr 2009 15:44:28 -0000 1.189
> > +++ windows-nat.c 8 May 2009 14:02:25 -0000
> > @@ -2166,8 +2171,22 @@ init_windows_ops (void)
> > windows_ops.to_has_execution = 1;
> > windows_ops.to_pid_to_exec_file = windows_pid_to_exec_file;
> > windows_ops.to_get_ada_task_ptid = windows_get_ada_task_ptid;
> > +
> > +#ifdef I386_USE_GENERIC_WATCHPOINTS
> > +
> > 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 = NULL;
> > + i386_dr_low.get_status = cygwin_get_dr6;
>
> Here, it seems every user of windows-nat.c unconditionally
> defines I386_USE_GENERIC_WATCHPOINTS, so there's no point in
> adding the #ifdef's to this file ...
I don't know here, the problem is that windows-nat is full of i386
specific code that should be moved to i386-windows-nat and/or
amd64-windows-nat
so that supporting other processors will be easier.
Thanks Ulrich,
I will try to submit a new version promptly.
Pierre
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC] Remove i386 low level debug register function from nm- header file.
2009-05-12 14:37 ` Pierre Muller
@ 2009-05-12 15:00 ` Ulrich Weigand
2009-05-12 15:17 ` Eli Zaretskii
2009-05-12 21:28 ` [RFC-v2] " Pierre Muller
1 sibling, 1 reply; 23+ messages in thread
From: Ulrich Weigand @ 2009-05-12 15:00 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches, 'Pedro Alves', 'Eli Zaretskii'
Pierre Muller wrote:
> > This looks good to me. However, now that you've moved the
> > prototypes to i386-nat.h, there is no longer any need for
> > the config/i386/nm-i386.h file -- please get rid of that file
> > (by removing the places where it is included into other nm-
> > files).
>
> OK, but how do I commit a file deletion?
> I never did this before!
That's an easy three steps :-)
1. Delete the file in your local copy: "rm nm-i386.h"
2. Announce the deletion to CVS: "cvs remove nm-i386.h"
3. Commit the deletion (together with the rest of your changes): "cvs commit"
B.t.w. there'll be some follow-on changes, because some of the
other nm- files in config/i386 will become (nearly) empty.
If an nm- file after your changes is completely empty (e.g.
nm-go32.h), you should remove all references to it (e.g. remove
the line NAT_FILE= nm-go32.h from go32.mh) and delete the
file as well.
If an nm- file after your changes consists solely of including
some other file (e.g. nm-linux64.h which will consist solely
of including "config/nm-linux.h"), you should update the references
to this file to refer to that other file (e.g. change the line
NAT_FILE= nm-linux64.h to NAT_FILE= config/nm-linux.h in linux64.mh)
and then delete the file as well.
Your patch should bring us quite a bit closer to the goal of
completely eliminating all nm- header files! Thanks!
> > I think you should provide everything in i386-nat.c (and
> > the new i386-nat.h) unconditionally, and eliminate the
> > various definitions of I386_USE_GENERIC_WATCHPOINTS in the
> > nm- header files.
>
> The only drawback is that "maint show-debug--regs" command
> will then also appear on target that do not support
> debug registers... Anyhow, it will just be a no-op in that case.
> Is that a problem?
I don't think so. The command simply says: "whenever the hardware
debug registers are changed, display their contents". Being able
to set that flag on a system that happens to never use hardware
debug register should be fine, the condition just never occurs.
> > Here, it seems every user of windows-nat.c unconditionally
> > defines I386_USE_GENERIC_WATCHPOINTS, so there's no point in
> > adding the #ifdef's to this file ...
>
> I don't know here, the problem is that windows-nat is full of i386
> specific code that should be moved to i386-windows-nat and/or
> amd64-windows-nat so that supporting other processors will be easier.
Right. For now, this is not an issue as windows-nat.c is only used
by those three hosts:
./config/i386/mingw64.mh:NATDEPFILES= i386-nat.o windows-nat.o amd64-windows-nat.o
./config/i386/cygwin.mh:NATDEPFILES= i386-nat.o windows-nat.o i386-windows-nat.o
./config/i386/mingw.mh:NATDEPFILES= i386-nat.o windows-nat.o i386-windows-nat.o
which are all i386.
If we want to support non-i386 Windows at some point, I guess this
should be done similarly to how we support Linux hosts for different
platforms: Instead of having a global "windows_ops" structure, have
windows-nat.c provide a routine "windows_target ()" that allocates and
fills in a target structure, and passes it to its caller (which would
be i386-windows-nat.c etc.) for further customization. See how the
routine "linux_target ()" is used today ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC] Remove i386 low level debug register function from nm- header file.
2009-05-12 15:00 ` Ulrich Weigand
@ 2009-05-12 15:17 ` Eli Zaretskii
2009-05-12 15:45 ` Pierre Muller
0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2009-05-12 15:17 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: muller, gdb-patches, pedro
> Date: Tue, 12 May 2009 17:00:35 +0200 (CEST)
> From: "Ulrich Weigand" <uweigand@de.ibm.com>
> Cc: gdb-patches@sourceware.org, pedro@codesourcery.com ('Pedro Alves'),
> eliz@gnu.org ('Eli Zaretskii')
>
> > > I think you should provide everything in i386-nat.c (and
> > > the new i386-nat.h) unconditionally, and eliminate the
> > > various definitions of I386_USE_GENERIC_WATCHPOINTS in the
> > > nm- header files.
> >
> > The only drawback is that "maint show-debug--regs" command
> > will then also appear on target that do not support
> > debug registers... Anyhow, it will just be a no-op in that case.
> > Is that a problem?
>
> I don't think so. The command simply says: "whenever the hardware
> debug registers are changed, display their contents". Being able
> to set that flag on a system that happens to never use hardware
> debug register should be fine, the condition just never occurs.
I'd rather we displayed an error message when this command is used on
platforms where it has no effect. Silently doing nothing is not a
good UI. But that's me.
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: [RFC] Remove i386 low level debug register function from nm- header file.
2009-05-12 15:17 ` Eli Zaretskii
@ 2009-05-12 15:45 ` Pierre Muller
2009-05-12 16:06 ` Ulrich Weigand
0 siblings, 1 reply; 23+ messages in thread
From: Pierre Muller @ 2009-05-12 15:45 UTC (permalink / raw)
To: 'Eli Zaretskii', 'Ulrich Weigand'; +Cc: gdb-patches, pedro
What about something like this:
(once my main patch is accepted)
static void
maint_show_debug_regs (char * args, int from_tty)
{
if (i386_dr_low.set_addr && i386_dr_low.get_status &&
i386_dr_low.set_control)
{
}
else
{
error (_("x86 debug register cannot be used for that target"));
}
}
void
_initialize_i386_nat (void)
{
#ifdef I386_USE_GENERIC_WATCHPOINTS
/* A maintenance command to enable printing the internal DRi mirror
variables. */
add_cmd ("show-debug-regs", class_maintenance,
maint_show_debug_regs, _("\
Set whether to show variables that mirror the x86 debug registers.\n\
Use \"on\" to enable, \"off\" to disable.\n\
If enabled, the debug registers values are shown when GDB inserts\n\
or removes a hardware breakpoint or watchpoint, and when the inferior\n\
triggers a breakpoint or watchpoint."),
&maintenancelist);
#endif
This would also remove one of the ARI var_boolean warnings!
The problem is that I don't know what to use for the
parsing of args in the case where the command should be accepted,
and I also don't know what I should use instead of error here.
Can someone help me here?
Eli, is it OK if we do that as a separate patch?
Pierre
> -----Message d'origine-----
> De : Eli Zaretskii [mailto:eliz@gnu.org]
> Envoyé : Tuesday, May 12, 2009 5:16 PM
> À : Ulrich Weigand
> Cc : muller@ics.u-strasbg.fr; gdb-patches@sourceware.org;
> pedro@codesourcery.com
> Objet : Re: [RFC] Remove i386 low level debug register function from
> nm- header file.
>
> > Date: Tue, 12 May 2009 17:00:35 +0200 (CEST)
> > From: "Ulrich Weigand" <uweigand@de.ibm.com>
> > Cc: gdb-patches@sourceware.org, pedro@codesourcery.com ('Pedro
> Alves'),
> > eliz@gnu.org ('Eli Zaretskii')
> >
> > > > I think you should provide everything in i386-nat.c (and
> > > > the new i386-nat.h) unconditionally, and eliminate the
> > > > various definitions of I386_USE_GENERIC_WATCHPOINTS in the
> > > > nm- header files.
> > >
> > > The only drawback is that "maint show-debug--regs" command
> > > will then also appear on target that do not support
> > > debug registers... Anyhow, it will just be a no-op in that case.
> > > Is that a problem?
> >
> > I don't think so. The command simply says: "whenever the hardware
> > debug registers are changed, display their contents". Being able
> > to set that flag on a system that happens to never use hardware
> > debug register should be fine, the condition just never occurs.
>
> I'd rather we displayed an error message when this command is used on
> platforms where it has no effect. Silently doing nothing is not a
> good UI. But that's me.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC] Remove i386 low level debug register function from nm- header file.
2009-05-12 15:45 ` Pierre Muller
@ 2009-05-12 16:06 ` Ulrich Weigand
2009-05-12 16:19 ` Pedro Alves
0 siblings, 1 reply; 23+ messages in thread
From: Ulrich Weigand @ 2009-05-12 16:06 UTC (permalink / raw)
To: Pierre Muller; +Cc: 'Eli Zaretskii', gdb-patches, pedro
Pierre Muller wrote:
> What about something like this:
> (once my main patch is accepted)
>
> static void
> maint_show_debug_regs (char * args, int from_tty)
> {
> if (i386_dr_low.set_addr && i386_dr_low.get_status &&
> i386_dr_low.set_control)
> {
> }
> else
> {
> error (_("x86 debug register cannot be used for that target"));
> }
> }
>
> void
> _initialize_i386_nat (void)
> {
> #ifdef I386_USE_GENERIC_WATCHPOINTS
> /* A maintenance command to enable printing the internal DRi mirror
> variables. */
> add_cmd ("show-debug-regs", class_maintenance,
> maint_show_debug_regs, _("\
> Set whether to show variables that mirror the x86 debug registers.\n\
> Use \"on\" to enable, \"off\" to disable.\n\
> If enabled, the debug registers values are shown when GDB inserts\n\
> or removes a hardware breakpoint or watchpoint, and when the inferior\n\
> triggers a breakpoint or watchpoint."),
> &maintenancelist);
> #endif
Well, I guess a simpler way to have that effect would be to just
move installing the command into the i386_use_watchpoints routine;
on targets that do not use watchpoints the command then simply would
not be available, just as it is the case today.
> This would also remove one of the ARI var_boolean warnings!
You're right, but we should be using one of the new routines (probably
add_setshow_boolean_cmd) instead of the old deprecated_add_set_cmd.
That's a separate issue though.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC] Remove i386 low level debug register function from nm- header file.
2009-05-12 16:06 ` Ulrich Weigand
@ 2009-05-12 16:19 ` Pedro Alves
0 siblings, 0 replies; 23+ messages in thread
From: Pedro Alves @ 2009-05-12 16:19 UTC (permalink / raw)
To: gdb-patches; +Cc: Ulrich Weigand, Pierre Muller, 'Eli Zaretskii'
On Tuesday 12 May 2009 17:06:20, Ulrich Weigand wrote:
> > This would also remove one of the ARI var_boolean warnings!
>
> You're right, but we should be using one of the new routines (probably
> add_setshow_boolean_cmd) instead of the old deprecated_add_set_cmd.
> That's a separate issue though.
Argh, second time this comes up after I've done that already :-)
http://sourceware.org/ml/gdb-patches/2009-01/msg00119.html
I'll go take care of adding the NEWS entry Eli requested,
and put that one to sleep for good.
--
Pedro Alves
^ permalink raw reply [flat|nested] 23+ messages in thread
* [RFC-v2] Remove i386 low level debug register function from nm- header file.
2009-05-12 14:37 ` Pierre Muller
2009-05-12 15:00 ` Ulrich Weigand
@ 2009-05-12 21:28 ` Pierre Muller
2009-05-13 15:33 ` Ulrich Weigand
1 sibling, 1 reply; 23+ messages in thread
From: Pierre Muller @ 2009-05-12 21:28 UTC (permalink / raw)
To: 'Pierre Muller', 'Ulrich Weigand'
Cc: gdb-patches, 'Pedro Alves', 'Eli Zaretskii'
This is a new version of the patch.
I tried to take into account all remarks from Ulrich.
I also tested it on a amd64 linux machine,
and had to change two functions in amd64-linux-nat.c
to be able to compile it on that target.
Testsuite showed no significant difference.
I tried to handle Eli's request by
moving the show-debug-regs command addition to i386_use_watchpoints
function with a safeguard to avoid multiple additions.
Comments?
Pierre
ChangeLog entry:
2009-05-08 Pierre Muller <muller.u-strasbg.fr>
Remove all i386 debug register low level macros in config nm files.
(I386_DR_LOW_SET_ADDR, I386_DR_LOW_RESET_ADDR): Remove.
(I386_DR_LOW_GET_STATUS, I386_DR_LOW_SET_CONTROL): Remove.
(I386_USE_GENERIC_WATCHPOIINTS): Remove.
* i386-nat.h: New file (adapted from config/i386/nm-i386.h).
(struct i386_dr_low_type): New type.
(i386_dr_low): New global variable.
* i386-nat.c (TARGET_HAS_DR_LEN_8): Update macro.
(i386_insert_aligned_watchpoint): Replace i386 dr low macros by
i386_dr_low struct variable fields.
(i386_remove_aligned_watchpoint): Likewise.
(i386_stopped_data_address): Likewise.
(i386_stopped_by_hwbp): Likewise.
(show_debug_regs_command_added): New static variable.
(add_show_debug_regs_command): New static function.
(i386_use_watchpoints): Call add_show_debug_regs_command if not
done.
(i386_set_debug_register_length): New function.
(_initialize_i386_nat): Delete.
* amd64-linux-nat.c: Include "i386-nat.h".
(amd64_linux_dr_set_control): Change arg type to unsigned.
(amd64_linux_dr_get_status): Change return type to unsigned.
(_initialize_amd64_linux_nat): Set i386_dr_low variable fields.
* go32-nat.c (init_go32_ops): Likewise.
* i386-linux-nat.c (_initialize_i386_linux_nat): Likewise.
* i386fbsd-nat.c (_initialize_i386fbsd_nat): Likewise.
* windows-nat.c: Include "i386-nat.h".
(cygwin_set_dr, cygwin_get_dr6, cygwin_set_dr7): Add prototypes.
(init_windows_ops): Set i386_dr_low function fields.
* amd64-windows-nat.c (_initialize_amd64_windows_nat): Call
i386_set_debug_register_length.
* i386-windows-nat.c (_initialize_i386_windows_nat): Likewise.
* config/i386/nm-cygwin.h: Remove all I386_* macros.
* config/i386/nm-cygwin64.h: Likewise.
* config/i386/nm-fbsd.h: Likewise.
* config/i386/nm-linux.h: Likewise.
* config/i386/nm-i386.h: Remove completely.
* config/i386/nm-go32.h: Remove completely.
* config/i386/nm-linux64.h: Remove completely.
* config/i386/go32.mh (NAT_FILE): Remove entry.
* config/i386/linux64.h (NAT_FILE): Change to config/nm-linux.h.
Index: src/gdb/i386-nat.h
===================================================================
RCS file: i386-nat.h
diff -N i386-nat.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/gdb/i386-nat.h 12 May 2009 15:50:35 -0000
@@ -0,0 +1,125 @@
+/* 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 <http://www.gnu.org/licenses/>.
*/
+
+#include "config.h"
+#include "defs.h"
+#include "breakpoint.h"
+#include "command.h"
+#include "gdbcmd.h"
+
+#ifndef I386_NAT_H
+#define I386_NAT_H 1
+
+/* Hardware-assisted breakpoints and watchpoints. */
+
+/* Add watchpoint methods to the provided target_ops.
+ Targets using i386 family debug registers for watchpoints should call
+ this. */
+struct target_ops;
+extern 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);
+
+/* 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 several low-level functions
+ regrouped into i386_dr_low_type struct below. These functions
+ that will be called to insert watchpoints and hardware breakpoints
+ into the inferior, remove them, and check their status. These
+ functions are:
+
+ set_control -- set the debug control (DR7)
+ register to a given value
+
+ set_addr -- put an address into one debug
+ register
+
+ reset_addr -- reset the address stored in
+ one debug register
+
+ get_status -- return the value of the debug
+ status (DR6) register.
+
+ Additionally, the native file should set the debug_register_length
+ field to 4 or 8 depending on the number of bytes used for
+ deubg registers. */
+
+struct i386_dr_low_type
+ {
+ void (*set_control) (unsigned);
+ void (*set_addr) (int, CORE_ADDR);
+ void (*reset_addr) (int);
+ unsigned (*get_status) (void);
+ int debug_register_length;
+ };
+
+struct i386_dr_low_type i386_dr_low;
+
+/* Use this function to set i386_dr_low debug_register_length field
+ rather than setting it directly to check that the length is only
+ set once. */
+
+extern void i386_set_debug_register_length (int len);
+
+#endif /* I386_NAT_H */
Index: src/gdb/amd64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-linux-nat.c,v
retrieving revision 1.25
diff -u -p -r1.25 amd64-linux-nat.c
--- src/gdb/amd64-linux-nat.c 17 Mar 2009 18:39:08 -0000 1.25
+++ src/gdb/amd64-linux-nat.c 12 May 2009 14:07:00 -0000
@@ -50,6 +50,7 @@
#include "amd64-tdep.h"
#include "i386-linux-tdep.h"
#include "amd64-nat.h"
+#include "i386-nat.h"
/* Mapping between the general-purpose registers in GNU/Linux x86-64
`struct user' format and GDB's register cache layout. */
@@ -286,7 +287,7 @@ 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;
@@ -315,10 +316,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
@@ -667,6 +668,12 @@ _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;
+ i386_set_debug_register_length (8);
+
/* 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/amd64-windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-windows-nat.c,v
retrieving revision 1.3
diff -u -p -r1.3 amd64-windows-nat.c
--- src/gdb/amd64-windows-nat.c 13 Jan 2009 04:14:07 -0000 1.3
+++ src/gdb/amd64-windows-nat.c 12 May 2009 14:07:00 -0000
@@ -17,7 +17,7 @@
#include "defs.h"
#include "windows-nat.h"
-
+#include "i386-nat.h"
#include <windows.h>
#define context_offset(x) (offsetof (CONTEXT, x))
@@ -89,4 +89,5 @@ void
_initialize_amd64_windows_nat (void)
{
windows_set_context_register_offsets (mappings);
+ i386_set_debug_register_length (8);
}
Index: src/gdb/go32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/go32-nat.c,v
retrieving revision 1.74
diff -u -p -r1.74 go32-nat.c
--- src/gdb/go32-nat.c 4 May 2009 09:54:17 -0000 1.74
+++ src/gdb/go32-nat.c 12 May 2009 14:07:00 -0000
@@ -85,6 +85,7 @@
#include <fcntl.h>
#include "defs.h"
+#include "i386-nat.h"
#include "inferior.h"
#include "gdbthread.h"
#include "gdb_wait.h"
@@ -975,6 +976,13 @@ 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;
+ i386_set_debug_register_length (4);
+
go32_ops.to_magic = OPS_MAGIC;
/* Initialize child's cwd as empty to be initialized when starting
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 May 2009 14:07:01 -0000
@@ -19,6 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "defs.h"
+#include "i386-nat.h"
#include "inferior.h"
#include "gdbcore.h"
#include "regcache.h"
@@ -825,6 +826,12 @@ _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;
+ i386_set_debug_register_length (4);
+
/* 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.20
diff -u -p -r1.20 i386-nat.c
--- src/gdb/i386-nat.c 12 May 2009 16:51:12 -0000 1.21
+++ src/gdb/i386-nat.c 12 May 2009 14:07:01 -0000
@@ -18,11 +18,13 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "i386-nat.h"
#include "defs.h"
#include "breakpoint.h"
#include "command.h"
#include "gdbcmd.h"
#include "target.h"
+#include "gdb_assert.h"
/* Support for hardware watchpoints and breakpoints using the i386
debug registers.
@@ -32,38 +34,11 @@
more of the watchpoints triggered and at what address, checking
whether a given region can be watched, etc.
- A target which wants to use these functions should define several
- macros, such as `target_insert_watchpoint' and
- `target_stopped_data_address', listed in target.h, to call the
- appropriate functions below. It should also define
- I386_USE_GENERIC_WATCHPOINTS in its tm.h file.
-
- In addition, each target should provide several low-level macros
- that will be called to insert watchpoints and hardware breakpoints
- into the inferior, remove them, and check their status. These
- macros 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_RESET_ADDR -- reset the address stored in
- one debug register
-
- I386_DR_LOW_GET_STATUS -- return the value of the debug
- status (DR6) register.
-
The functions below implement debug registers sharing by reference
counts, and allow to watch regions up to 16 bytes long. */
-#ifdef I386_USE_GENERIC_WATCHPOINTS
-
/* Support for 8-byte wide hw watchpoints. */
-#ifndef TARGET_HAS_DR_LEN_8
-#define TARGET_HAS_DR_LEN_8 0
-#endif
+#define TARGET_HAS_DR_LEN_8 (i386_dr_low.debug_register_length == 8)
/* Debug registers' indices. */
#define DR_NADDR 4 /* The number of debug address registers.
*/
@@ -330,6 +305,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). */
@@ -373,8 +351,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;
}
@@ -402,8 +380,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;
}
@@ -562,7 +541,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)
{
@@ -603,7 +582,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);
@@ -670,6 +649,29 @@ i386_can_use_hw_breakpoint (int type, in
return 1;
}
+static int
+show_debug_regs_command_added = 0;
+
+static void
+add_show_debug_regs_command (void)
+{
+ /* A maintenance command to enable printing the internal DRi mirror
+ variables. */
+ add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
+ &maint_show_dr, _("\
+Set whether to show variables that mirror the x86 debug registers."), _("\
+Show whether to show variables that mirror the x86 debug registers."), _("\
+Use \"on\" to enable, \"off\" to disable.\n\
+If enabled, the debug registers values are shown when GDB inserts\n\
+or removes a hardware breakpoint or watchpoint, and when the inferior\n\
+triggers a breakpoint or watchpoint."),
+ NULL,
+ NULL,
+ &maintenance_set_cmdlist,
+ &maintenance_show_cmdlist);
+ show_debug_regs_command_added = 1;
+}
+
void
i386_use_watchpoints (struct target_ops *t)
{
@@ -686,31 +688,16 @@ i386_use_watchpoints (struct target_ops
t->to_remove_watchpoint = i386_remove_watchpoint;
t->to_insert_hw_breakpoint = i386_insert_hw_breakpoint;
t->to_remove_hw_breakpoint = i386_remove_hw_breakpoint;
+ if (!show_debug_regs_command_added)
+ add_show_debug_regs_command ();
}
-#endif /* I386_USE_GENERIC_WATCHPOINTS */
-
-
-/* Provide a prototype to silence -Wmissing-prototypes. */
-void _initialize_i386_nat (void);
-
void
-_initialize_i386_nat (void)
+i386_set_debug_register_length (int len)
{
-#ifdef I386_USE_GENERIC_WATCHPOINTS
- /* A maintenance command to enable printing the internal DRi mirror
- variables. */
- add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
- &maint_show_dr, _("\
-Set whether to show variables that mirror the x86 debug registers."), _("\
-Show whether to show variables that mirror the x86 debug registers."), _("\
-Use \"on\" to enable, \"off\" to disable.\n\
-If enabled, the debug registers values are shown when GDB inserts\n\
-or removes a hardware breakpoint or watchpoint, and when the inferior\n\
-triggers a breakpoint or watchpoint."),
- NULL,
- NULL,
- &maintenance_set_cmdlist,
- &maintenance_show_cmdlist);
-#endif
+ /* This function should be called only once for each native target. */
+ gdb_assert (i386_dr_low.debug_register_length == 0);
+ i386_dr_low.debug_register_length = len;
}
+
+
Index: src/gdb/i386-windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-windows-nat.c,v
retrieving revision 1.3
diff -u -p -r1.3 i386-windows-nat.c
--- src/gdb/i386-windows-nat.c 13 Jan 2009 04:14:07 -0000 1.3
+++ src/gdb/i386-windows-nat.c 12 May 2009 14:07:01 -0000
@@ -17,6 +17,7 @@
#include "defs.h"
#include "windows-nat.h"
+#include "i386-nat.h"
#include <windows.h>
@@ -73,4 +74,5 @@ void
_initialize_i386_windows_nat (void)
{
windows_set_context_register_offsets (mappings);
+ i386_set_debug_register_length (4);
}
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 May 2009 14:07:01 -0000
@@ -29,6 +29,7 @@
#include "fbsd-nat.h"
#include "i386-tdep.h"
+#include "i386-nat.h"
#include "i386bsd-nat.h"
/* Resume execution of the inferior process. If STEP is nonzero,
@@ -126,7 +127,20 @@ _initialize_i386fbsd_nat (void)
/* Add some extra features to the common *BSD/i386 target. */
t = i386bsd_target ();
+
+#ifdef HAVE_PT_GETDBREGS
+
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;
+ i386_set_debug_register_length (4);
+
+#endif /* HAVE_PT_GETDBREGS */
+
+
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.189
diff -u -p -r1.189 windows-nat.c
--- src/gdb/windows-nat.c 17 Apr 2009 15:44:28 -0000 1.189
+++ src/gdb/windows-nat.c 12 May 2009 14:07:01 -0000
@@ -63,6 +63,7 @@
#include "windows-tdep.h"
#include "windows-nat.h"
+#include "i386-nat.h"
#define AdjustTokenPrivileges dyn_AdjustTokenPrivileges
#define DebugActiveProcessStop dyn_DebugActiveProcessStop
@@ -140,6 +141,10 @@ static void windows_stop (ptid_t);
static int windows_thread_alive (struct target_ops *, ptid_t);
static void windows_kill_inferior (struct target_ops *);
+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 */
@@ -2166,8 +2171,18 @@ init_windows_ops (void)
windows_ops.to_has_execution = 1;
windows_ops.to_pid_to_exec_file = windows_pid_to_exec_file;
windows_ops.to_get_ada_task_ptid = windows_get_ada_task_ptid;
+
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 = NULL;
+ i386_dr_low.get_status = cygwin_get_dr6;
+
+ /* i386_dr_low.debug_register_length field is set by
+ calling i386_set_debug_register_length function
+ in processor windows specific native file. */
+
windows_ops.to_magic = OPS_MAGIC;
}
Index: src/gdb/config/i386/go32.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/go32.mh,v
retrieving revision 1.10
diff -u -p -r1.10 go32.mh
--- src/gdb/config/i386/go32.mh 19 Apr 2009 18:29:34 -0000 1.10
+++ src/gdb/config/i386/go32.mh 12 May 2009 15:20:18 -0000
@@ -3,7 +3,6 @@
# We include several header files from config/djgpp
MH_CFLAGS= -I$(srcdir)/config/djgpp
-NAT_FILE= nm-go32.h
NATDEPFILES= go32-nat.o i386-nat.o
HOST_IPC=
Index: src/gdb/config/i386/linux64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/linux64.mh,v
retrieving revision 1.7
diff -u -p -r1.7 linux64.mh
--- src/gdb/config/i386/linux64.mh 4 Jan 2006 19:33:11 -0000 1.7
+++ src/gdb/config/i386/linux64.mh 12 May 2009 15:20:18 -0000
@@ -2,7 +2,7 @@
NATDEPFILES= inf-ptrace.o fork-child.o \
i386-nat.o amd64-nat.o amd64-linux-nat.o linux-nat.o \
proc-service.o linux-thread-db.o gcore.o linux-fork.o
-NAT_FILE= nm-linux64.h
+NAT_FILE= config/nm-linux.h
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
Index: src/gdb/config/i386/nm-cygwin.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin.h,v
retrieving revision 1.10
diff -u -p -r1.10 nm-cygwin.h
--- src/gdb/config/i386/nm-cygwin.h 26 Mar 2009 00:18:46 -0000 1.10
+++ src/gdb/config/i386/nm-cygwin.h 12 May 2009 15:20:18 -0000
@@ -18,20 +18,3 @@
#define ADD_SHARED_SYMBOL_FILES dll_symbol_command
void dll_symbol_command (char *, int);
-
-#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);
Index: src/gdb/config/i386/nm-cygwin64.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin64.h,v
retrieving revision 1.3
diff -u -p -r1.3 nm-cygwin64.h
--- src/gdb/config/i386/nm-cygwin64.h 26 Mar 2009 00:18:46 -0000 1.3
+++ src/gdb/config/i386/nm-cygwin64.h 12 May 2009 15:20:18 -0000
@@ -17,20 +17,3 @@
#define ADD_SHARED_SYMBOL_FILES dll_symbol_command
void dll_symbol_command (char *, int);
-
-#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);
Index: src/gdb/config/i386/nm-fbsd.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-fbsd.h,v
retrieving revision 1.20
diff -u -p -r1.20 nm-fbsd.h
--- src/gdb/config/i386/nm-fbsd.h 26 Mar 2009 00:18:46 -0000 1.20
+++ src/gdb/config/i386/nm-fbsd.h 12 May 2009 15:20:18 -0000
@@ -21,33 +21,8 @@
#ifndef NM_FBSD_H
#define NM_FBSD_H
-#ifdef HAVE_PT_GETDBREGS
-#define I386_USE_GENERIC_WATCHPOINTS
-#endif
-
-#include "i386/nm-i386.h"
-
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#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: config/i386/nm-go32.h
diff -N config/i386/nm-go32.h
--- src/gdb/config/i386/nm-go32.h 26 Mar 2009 00:18:46 -0000 1.10
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,35 +0,0 @@
-/* Native definitions for Intel x86 running DJGPP.
- Copyright 1997, 1998, 1999, 2001, 2002, 2007, 2008, 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 <http://www.gnu.org/licenses/>.
*/
-
-#define I386_USE_GENERIC_WATCHPOINTS
-
-#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: config/i386/nm-i386.h
diff -N config/i386/nm-i386.h
--- src/gdb/config/i386/nm-i386.h 26 Mar 2009 00:18:46 -0000 1.15
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,72 +0,0 @@
-/* Native macro definitions for GDB on an Intel i[3456]86.
- Copyright 2001, 2004, 2007, 2008, 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 <http://www.gnu.org/licenses/>.
*/
-
-#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 define I386_USE_GENERIC_WATCHPOINTS must
- call this function. */
-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 */
-
-#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.30
diff -u -p -r1.30 nm-linux.h
--- src/gdb/config/i386/nm-linux.h 26 Mar 2009 00:18:46 -0000 1.30
+++ src/gdb/config/i386/nm-linux.h 12 May 2009 15:20:18 -0000
@@ -22,31 +22,8 @@
#ifndef NM_LINUX_H
#define NM_LINUX_H
-/* GNU/Linux supports the i386 hardware debugging registers. */
-#define I386_USE_GENERIC_WATCHPOINTS
-
-#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: config/i386/nm-linux64.h
diff -N config/i386/nm-linux64.h
--- src/gdb/config/i386/nm-linux64.h 26 Mar 2009 00:18:46 -0000 1.10
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,53 +0,0 @@
-/* Native support for GNU/Linux x86-64.
-
- Copyright 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
- Free Software Foundation, Inc.
-
- Contributed by Jiri Smid, SuSE Labs.
-
- 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 <http://www.gnu.org/licenses/>.
*/
-
-#ifndef NM_LINUX64_H
-#define NM_LINUX64_H
-
-/* GNU/Linux supports the i386 hardware debugging registers. */
-#define I386_USE_GENERIC_WATCHPOINTS
-
-#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 */
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC-v2] Remove i386 low level debug register function from nm- header file.
2009-05-12 21:28 ` [RFC-v2] " Pierre Muller
@ 2009-05-13 15:33 ` Ulrich Weigand
2009-05-13 18:09 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 23+ messages in thread
From: Ulrich Weigand @ 2009-05-13 15:33 UTC (permalink / raw)
To: Pierre Muller
Cc: 'Pierre Muller', gdb-patches, 'Pedro Alves',
'Eli Zaretskii'
Pierre Muller wrote:
> This is a new version of the patch.
>
> I tried to take into account all remarks from Ulrich.
Thanks! There's one additional thing I noticed: several of
the prototypes you've moved to the new i386-nat.h file
actually need no longer be exported at all; instead, they
can be made static functions in i386-nat.c.
Likewise, in most cases the callbacks used to implement
the i386_dr_low_type members can now be made static
functions to the file that defines them.
> I also tested it on a amd64 linux machine,
> and had to change two functions in amd64-linux-nat.c
> to be able to compile it on that target.
Hmm ... it seems there's a disconnect between using "unsigned"
and "unsigned long" as type for the DR6/7 contents. This affects
not only amd64-linux-nat.c, but apparently some other files as well:
i386bsd-nat.c:i386bsd_dr_set_control (unsigned long control)
i386-linux-nat.c:i386_linux_dr_set_control (unsigned long control)
amd64-linux-nat.c:amd64_linux_dr_set_control (unsigned long control)
... but ...
win32-nat.c:cygwin_set_dr7 (unsigned val)
go32-nat.c:go32_set_dr7 (unsigned val)
When you build on a 32-bit system, this probably won't result in
an error, even though it's strictly speaking still invalid C ...
I think these need to be fixed so they all agree. As far as I know,
those values are in fact 32-bit, so I guess "unsigned" (or preferably,
"unsigned int") should be OK to use.
> Index: src/gdb/i386-nat.h
> ===================================================================
> RCS file: i386-nat.h
> diff -N i386-nat.h
> +#include "config.h"
> +#include "defs.h"
> +#include "breakpoint.h"
> +#include "command.h"
> +#include "gdbcmd.h"
IMHO these shouldn't be in a common header file, but included as needed
by the source files ... The old config/i386/nm-i386.h didn't have such
includes either.
> +/* 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);
All these shouldn't be there, and the functions made static to
i386-nat.c.
> +struct i386_dr_low_type i386_dr_low;
You should not have a variable *definition* in a header file. Instead,
have an "extern" declaration in the header, and move the definition
into i386-nat.c.
> + 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;
These amd64_linux_... functions can now be made static.
> + 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;
Likewise those go32_... functions.
> + 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;
And those i386_linux_... functions.
> +static int
> +show_debug_regs_command_added = 0;
> +
> +static void
> +add_show_debug_regs_command (void)
> +{
> + /* A maintenance command to enable printing the internal DRi mirror
> + variables. */
> + add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
> + &maint_show_dr, _("\
> +Set whether to show variables that mirror the x86 debug registers."), _("\
> +Show whether to show variables that mirror the x86 debug registers."), _("\
> +Use \"on\" to enable, \"off\" to disable.\n\
> +If enabled, the debug registers values are shown when GDB inserts\n\
> +or removes a hardware breakpoint or watchpoint, and when the inferior\n\
> +triggers a breakpoint or watchpoint."),
> + NULL,
> + NULL,
> + &maintenance_set_cmdlist,
> + &maintenance_show_cmdlist);
> + show_debug_regs_command_added = 1;
> +}
This is just a minor nit, but I'd prefer to have the guard against
multiple calls be static inside the function, and do the test there.
> +i386_set_debug_register_length (int len)
> {
> + /* This function should be called only once for each native target. */
> + gdb_assert (i386_dr_low.debug_register_length == 0);
> + i386_dr_low.debug_register_length = len;
> }
In the alternative, you might actually move the call to *this* function,
which is already guarded to be called only once ...
> 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 May 2009 14:07:01 -0000
> @@ -29,6 +29,7 @@
>
> #include "fbsd-nat.h"
> #include "i386-tdep.h"
> +#include "i386-nat.h"
> #include "i386bsd-nat.h"
>
> /* Resume execution of the inferior process. If STEP is nonzero,
> @@ -126,7 +127,20 @@ _initialize_i386fbsd_nat (void)
>
> /* Add some extra features to the common *BSD/i386 target. */
> t = i386bsd_target ();
> +
> +#ifdef HAVE_PT_GETDBREGS
> +
> 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;
Have you tried building this? It seems you should be getting
warnings here as there's now no prototype for the functions;
note that they are defined in a *different* file.
I think the prototypes for those should move to i386bsd-nat.h.
> +void cygwin_set_dr (int i, CORE_ADDR addr);
> +void cygwin_set_dr7 (unsigned val);
> +unsigned cygwin_get_dr6 (void);
These should again be static.
As a side note, I think we should be able to get completely rid of
the remaining nm- header files you touched. (Note, I'm not suggesting
this needs to be done as part of this patch, but it's something that
could be done by follow-up patches ...)
> Index: src/gdb/config/i386/nm-cygwin.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin.h,v
> retrieving revision 1.10
> diff -u -p -r1.10 nm-cygwin.h
> --- src/gdb/config/i386/nm-cygwin.h 26 Mar 2009 00:18:46 -0000 1.10
> +++ src/gdb/config/i386/nm-cygwin.h 12 May 2009 15:20:18 -0000
> @@ -18,20 +18,3 @@
>
> #define ADD_SHARED_SYMBOL_FILES dll_symbol_command
> void dll_symbol_command (char *, int);
> Index: src/gdb/config/i386/nm-cygwin64.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin64.h,v
> retrieving revision 1.3
> diff -u -p -r1.3 nm-cygwin64.h
> --- src/gdb/config/i386/nm-cygwin64.h 26 Mar 2009 00:18:46 -0000 1.3
> +++ src/gdb/config/i386/nm-cygwin64.h 12 May 2009 15:20:18 -0000
> @@ -17,20 +17,3 @@
>
> #define ADD_SHARED_SYMBOL_FILES dll_symbol_command
> void dll_symbol_command (char *, int);
This hook simply registers an additional GDB command
"add-shared-symbol-files". Maybe registering this command
can simply move to windows-nat.c instead?
Or maybe this is the wrong place anyway: shouldn't the availability
of the command depend on whether the *target* is Windows, not the host?
> Index: src/gdb/config/i386/nm-fbsd.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/config/i386/nm-fbsd.h,v
> retrieving revision 1.20
> diff -u -p -r1.20 nm-fbsd.h
> --- src/gdb/config/i386/nm-fbsd.h 26 Mar 2009 00:18:46 -0000 1.20
> +++ src/gdb/config/i386/nm-fbsd.h 12 May 2009 15:20:18 -0000
> @@ -21,33 +21,8 @@
> #ifdef HAVE_SYS_PARAM_H
> #include <sys/param.h>
> #endif
This include was added in 2002 by David O'Brien:
http://sourceware.org/ml/gdb-patches/2002-06/msg00573.html
who in a follow-up message stated:
Some code I added to GDB 5.2 in the FreeBSD source tree needs it. That
code isn't ready to submit back yet. Since the include is benign but I
wanted to reduce the diffs where easy. I actually don't need it in
nm-fbsd.h any more.
As per the last sentence, I think this can go away ...
> Index: src/gdb/config/i386/nm-linux.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/config/i386/nm-linux.h,v
> retrieving revision 1.30
> diff -u -p -r1.30 nm-linux.h
> #ifdef HAVE_PTRACE_GETFPXREGS
> /* Include register set support for the SSE registers. */
> #define FILL_FPXREGSET
This is dead code now; the only use of FILL_FPXREGSET is in a conditional
section in gregset.h, but everything that's defined/declared there is no
longer used anyway ... This should simply go away.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC-v2] Remove i386 low level debug register function from nm- header file.
2009-05-13 15:33 ` Ulrich Weigand
@ 2009-05-13 18:09 ` Eli Zaretskii
2009-05-13 18:35 ` Ulrich Weigand
2009-05-13 18:25 ` Doug Evans
2009-05-13 23:39 ` [RFA-v3] " Pierre Muller
2 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2009-05-13 18:09 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: muller, muller, gdb-patches, pedro
> Date: Wed, 13 May 2009 17:33:38 +0200 (CEST)
> From: "Ulrich Weigand" <uweigand@de.ibm.com>
> Cc: muller@ics.u-strasbg.fr ('Pierre Muller'), gdb-patches@sourceware.org,
> pedro@codesourcery.com ('Pedro Alves'), eliz@gnu.org ('Eli Zaretskii')
>
> Hmm ... it seems there's a disconnect between using "unsigned"
> and "unsigned long" as type for the DR6/7 contents. This affects
> not only amd64-linux-nat.c, but apparently some other files as well:
>
> i386bsd-nat.c:i386bsd_dr_set_control (unsigned long control)
> i386-linux-nat.c:i386_linux_dr_set_control (unsigned long control)
> amd64-linux-nat.c:amd64_linux_dr_set_control (unsigned long control)
>
> ... but ...
>
> win32-nat.c:cygwin_set_dr7 (unsigned val)
> go32-nat.c:go32_set_dr7 (unsigned val)
I'm okay with changing the declarations in go32-nat.c to unsigned
long, if that is what's decided.
> When you build on a 32-bit system, this probably won't result in
> an error, even though it's strictly speaking still invalid C ...
What is invalid C?
> I think these need to be fixed so they all agree.
Yes, it would be good.
> As far as I know, those values are in fact 32-bit, so I guess
> "unsigned" (or preferably, "unsigned int") should be OK to use.
I see no need to add "int" to "unsigned", FWIW.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC-v2] Remove i386 low level debug register function from nm- header file.
2009-05-13 15:33 ` Ulrich Weigand
2009-05-13 18:09 ` Eli Zaretskii
@ 2009-05-13 18:25 ` Doug Evans
2009-05-13 18:38 ` Ulrich Weigand
2009-05-13 22:21 ` Pierre Muller
2009-05-13 23:39 ` [RFA-v3] " Pierre Muller
2 siblings, 2 replies; 23+ messages in thread
From: Doug Evans @ 2009-05-13 18:25 UTC (permalink / raw)
To: Ulrich Weigand, Pierre Muller, gdb-patches, Pedro Alves, Eli Zaretskii
On Wed, May 13, 2009 at 8:33 AM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> Pierre Muller wrote:
>
>> This is a new version of the patch.
>>
>> I tried to take into account all remarks from Ulrich.
>
> Thanks! [...]
OOC, is any of this effort going to have any bearing on
http://sourceware.org/ml/gdb-patches/2009-04/msg00804.html
[btw, "Ping."]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC-v2] Remove i386 low level debug register function from nm- header file.
2009-05-13 18:09 ` Eli Zaretskii
@ 2009-05-13 18:35 ` Ulrich Weigand
0 siblings, 0 replies; 23+ messages in thread
From: Ulrich Weigand @ 2009-05-13 18:35 UTC (permalink / raw)
To: eliz; +Cc: muller, gdb-patches, pedro
Eli Zaretskii wrote:
> > When you build on a 32-bit system, this probably won't result in
> > an error, even though it's strictly speaking still invalid C ...
>
> What is invalid C?
Assigning a function with prototype
void func (unsigned long arg);
to a function pointer with prototype
void (*ptr) (unsigned arg);
(even on platforms where "unsigned long" is the same size as
"unsigned").
> > As far as I know, those values are in fact 32-bit, so I guess
> > "unsigned" (or preferably, "unsigned int") should be OK to use.
>
> I see no need to add "int" to "unsigned", FWIW.
My comment was just for consistency with the rest of the code base.
I though we were not using plain "unsigned" anywhere else. However,
after checking the code base, it seems there's already a number of
places that do so. I don't really mind then, so I withdraw the
suggestion to use "unsigned int".
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC-v2] Remove i386 low level debug register function from nm- header file.
2009-05-13 18:25 ` Doug Evans
@ 2009-05-13 18:38 ` Ulrich Weigand
2009-05-13 22:21 ` Pierre Muller
1 sibling, 0 replies; 23+ messages in thread
From: Ulrich Weigand @ 2009-05-13 18:38 UTC (permalink / raw)
To: Doug Evans; +Cc: Pierre Muller, gdb-patches, Pedro Alves, Eli Zaretskii
Doug Evans wrote:
> On Wed, May 13, 2009 at 8:33 AM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> > Pierre Muller wrote:
> >
> >> This is a new version of the patch.
> >>
> >> I tried to take into account all remarks from Ulrich.
> >
> > Thanks! [...]
>
>
> OOC, is any of this effort going to have any bearing on
> http://sourceware.org/ml/gdb-patches/2009-04/msg00804.html
I don't think so; there's no actual change in behaviour in
Pierre's patch, it's just clean-up of the build process.
gdbserver should not be affected at all.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: [RFC-v2] Remove i386 low level debug register function from nm- header file.
2009-05-13 18:25 ` Doug Evans
2009-05-13 18:38 ` Ulrich Weigand
@ 2009-05-13 22:21 ` Pierre Muller
2009-05-13 23:16 ` Doug Evans
1 sibling, 1 reply; 23+ messages in thread
From: Pierre Muller @ 2009-05-13 22:21 UTC (permalink / raw)
To: 'Doug Evans', 'Ulrich Weigand',
gdb-patches, 'Pedro Alves', 'Eli Zaretskii'
Hi Doug,
I answered in
http://sourceware.org/ml/gdb-patches/2009-05/msg00006.html
but as there was a month change between the two emails...
they are not linked in the archives :(
Could you combine my suggested changes to your patch?
Pierre
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Doug Evans
> Envoyé : Wednesday, May 13, 2009 8:25 PM
> À : Ulrich Weigand; Pierre Muller; gdb-patches@sourceware.org; Pedro
> Alves; Eli Zaretskii
> Objet : Re: [RFC-v2] Remove i386 low level debug register function from
> nm- header file.
>
> On Wed, May 13, 2009 at 8:33 AM, Ulrich Weigand <uweigand@de.ibm.com>
> wrote:
> > Pierre Muller wrote:
> >
> >> This is a new version of the patch.
> >>
> >> I tried to take into account all remarks from Ulrich.
> >
> > Thanks! [...]
>
>
> OOC, is any of this effort going to have any bearing on
> http://sourceware.org/ml/gdb-patches/2009-04/msg00804.html
>
> [btw, "Ping."]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFC-v2] Remove i386 low level debug register function from nm- header file.
2009-05-13 22:21 ` Pierre Muller
@ 2009-05-13 23:16 ` Doug Evans
0 siblings, 0 replies; 23+ messages in thread
From: Doug Evans @ 2009-05-13 23:16 UTC (permalink / raw)
To: Pierre Muller; +Cc: Ulrich Weigand, gdb-patches, Pedro Alves, Eli Zaretskii
On Wed, May 13, 2009 at 3:19 PM, Pierre Muller <muller@ics.u-strasbg.fr> wrote:
> Hi Doug,
> I answered in
> http://sourceware.org/ml/gdb-patches/2009-05/msg00006.html
> but as there was a month change between the two emails...
> they are not linked in the archives :(
>
> Could you combine my suggested changes to your patch?
Ya. Sorry 'bout leaving that part out! At least I didn't forget its
ChangeLog entry, sigh. [It was in my sandbox at the time.] I can
resubmit but it's pretty straightforward - your version looks an awful
lot like mine. :-)
I'll certainly include that part when checked in. If I don't Pedro
can slap me again in irc. :-)
I still need an official "ok" to check it in.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [RFA-v3] Remove i386 low level debug register function from nm- header file.
2009-05-13 15:33 ` Ulrich Weigand
2009-05-13 18:09 ` Eli Zaretskii
2009-05-13 18:25 ` Doug Evans
@ 2009-05-13 23:39 ` Pierre Muller
2009-05-14 9:06 ` Ulrich Weigand
2 siblings, 1 reply; 23+ messages in thread
From: Pierre Muller @ 2009-05-13 23:39 UTC (permalink / raw)
To: 'Ulrich Weigand'
Cc: gdb-patches, 'Pedro Alves', 'Eli Zaretskii'
Thanks to everyone for the feeback.
I tried to handle all your remarks.
I tested compilation on
go32v2, i386 windows and amd64 linux.
All three went OK.
I saw nothing special on testsuite for
the two last ones.
Pierre
2009-05-13 Pierre Muller <muller.u-strasbg.fr>
Remove all i386 debug register low level macros in config nm files.
(I386_DR_LOW_SET_ADDR, I386_DR_LOW_RESET_ADDR): Remove.
(I386_DR_LOW_GET_STATUS, I386_DR_LOW_SET_CONTROL): Remove.
(I386_USE_GENERIC_WATCHPOIINTS): Remove.
* i386-nat.h: New file (adapted from config/i386/nm-i386.h).
(struct i386_dr_low_type): New type.
(i386_dr_low): New global variable.
* i386-nat.c (TARGET_HAS_DR_LEN_8): Update macro.
(i386_insert_aligned_watchpoint): Replace i386 dr low macros by
i386_dr_low struct variable fields.
(i386_remove_aligned_watchpoint): Likewise.
(i386_stopped_data_address): Likewise.
(i386_stopped_by_hwbp): Likewise.
(show_debug_regs_command_added): New static variable.
(add_show_debug_regs_command): New static function.
(i386_use_watchpoints): Call add_show_debug_regs_command if not
done.
(i386_set_debug_register_length): New function.
(_initialize_i386_nat): Delete.
* amd64-linux-nat.c: Include "i386-nat.h".
(amd64_linux_dr_set_control): Change to static.
(amd64_linux_dr_get_status): Change to static.
(amd64_linux_dr_set_addr,amd64_linux_dr_reset_addr): Likewise.
(_initialize_amd64_linux_nat): Set i386_dr_low variable fields.
* go32-nat.c: Include "i386-nat.h".
(go32_set_addr): Change to static.
(go32_set_dr7): Change to static. Change arg type to unisgned long.
(go32_get_dr6): Change to static. Change return type to unisnged
long.
(init_go32_ops): Set i386_dr_low variable fields.
* i386-linux-nat.c: Include "i386-nat.h".
(i386_linux_dr_set_control, i386_linux_dr_get_status): Change to
static.
(i386_linux_dr_set_addr, i386_linux_dr_reset_addr): Idem.
(_initialize_i386_linux_nat): Set i386_dr_low variable fields.
* i386bsd-nat.h: Declare functions used for
i386_dr_low fields in i386fbsd-nat.c.
* i386fbsd-nat.c: Include "i386-nat.h".
(_initialize_i386fbsd_nat): Set i386_dr_low variable fields.
* windows-nat.c: Include "i386-nat.h".
(cygwin_set_dr, cygwin_get_dr6, cygwin_set_dr7): Add prototypes.
Change to static.
(cygwin_get_dr6): Change return type to unisnged long.
(cygwin_set_dr7): Change arg type to unisgned long.
(init_windows_ops): Set i386_dr_low function fields.
* amd64-windows-nat.c (_initialize_amd64_windows_nat): Call
i386_set_debug_register_length.
* i386-windows-nat.c (_initialize_i386_windows_nat): Likewise.
* config/i386/nm-cygwin.h: Remove all I386_* macros.
* config/i386/nm-cygwin64.h: Likewise.
* config/i386/nm-fbsd.h: Likewise.
* config/i386/nm-linux.h: Likewise.
* config/i386/nm-i386.h: Remove completely.
* config/i386/nm-go32.h: Remove completely.
* config/i386/nm-linux64.h: Remove completely.
* config/i386/go32.mh (NAT_FILE): Remove entry.
* config/i386/linux64.h (NAT_FILE): Change to config/nm-linux.h.
Index: src/gdb/amd64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-linux-nat.c,v
retrieving revision 1.25
diff -u -p -r1.25 amd64-linux-nat.c
--- src/gdb/amd64-linux-nat.c 17 Mar 2009 18:39:08 -0000 1.25
+++ src/gdb/amd64-linux-nat.c 13 May 2009 22:06:49 -0000
@@ -50,6 +50,7 @@
#include "amd64-tdep.h"
#include "i386-linux-tdep.h"
#include "amd64-nat.h"
+#include "i386-nat.h"
/* Mapping between the general-purpose registers in GNU/Linux x86-64
`struct user' format and GDB's register cache layout. */
@@ -285,7 +286,7 @@ amd64_linux_dr_set (ptid_t ptid, int reg
perror_with_name (_("Couldn't write debug register"));
}
-void
+static void
amd64_linux_dr_set_control (unsigned long control)
{
struct lwp_info *lp;
@@ -296,7 +297,7 @@ amd64_linux_dr_set_control (unsigned lon
amd64_linux_dr_set (ptid, DR_CONTROL, control);
}
-void
+static void
amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr)
{
struct lwp_info *lp;
@@ -309,13 +310,13 @@ amd64_linux_dr_set_addr (int regnum, COR
amd64_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr);
}
-void
+static void
amd64_linux_dr_reset_addr (int regnum)
{
amd64_linux_dr_set_addr (regnum, 0);
}
-unsigned long
+static unsigned long
amd64_linux_dr_get_status (void)
{
return amd64_linux_dr_get (inferior_ptid, DR_STATUS);
@@ -667,6 +668,12 @@ _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;
+ i386_set_debug_register_length (8);
+
/* 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/amd64-windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-windows-nat.c,v
retrieving revision 1.3
diff -u -p -r1.3 amd64-windows-nat.c
--- src/gdb/amd64-windows-nat.c 13 Jan 2009 04:14:07 -0000 1.3
+++ src/gdb/amd64-windows-nat.c 13 May 2009 22:06:49 -0000
@@ -17,7 +17,7 @@
#include "defs.h"
#include "windows-nat.h"
-
+#include "i386-nat.h"
#include <windows.h>
#define context_offset(x) (offsetof (CONTEXT, x))
@@ -89,4 +89,5 @@ void
_initialize_amd64_windows_nat (void)
{
windows_set_context_register_offsets (mappings);
+ i386_set_debug_register_length (8);
}
Index: src/gdb/go32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/go32-nat.c,v
retrieving revision 1.74
diff -u -p -r1.74 go32-nat.c
--- src/gdb/go32-nat.c 4 May 2009 09:54:17 -0000 1.74
+++ src/gdb/go32-nat.c 13 May 2009 22:06:50 -0000
@@ -85,6 +85,7 @@
#include <fcntl.h>
#include "defs.h"
+#include "i386-nat.h"
#include "inferior.h"
#include "gdbthread.h"
#include "gdb_wait.h"
@@ -768,7 +769,7 @@ go32_can_run (void)
/* Pass the address ADDR to the inferior in the I'th debug register.
Here we just store the address in D_REGS, the watchpoint will be
actually set up when go32_wait runs the debuggee. */
-void
+static void
go32_set_dr (int i, CORE_ADDR addr)
{
if (i < 0 || i > 3)
@@ -780,8 +781,8 @@ go32_set_dr (int i, CORE_ADDR addr)
/* 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 when go32_wait runs the debuggee. */
-void
-go32_set_dr7 (unsigned val)
+static void
+go32_set_dr7 (unsigned long val)
{
CONTROL = val;
}
@@ -789,7 +790,7 @@ go32_set_dr7 (unsigned val)
/* 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
+static unsigned long
go32_get_dr6 (void)
{
return STATUS;
@@ -975,6 +976,13 @@ 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;
+ i386_set_debug_register_length (4);
+
go32_ops.to_magic = OPS_MAGIC;
/* Initialize child's cwd as empty to be initialized when starting
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 13 May 2009 22:06:50 -0000
@@ -19,6 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "defs.h"
+#include "i386-nat.h"
#include "inferior.h"
#include "gdbcore.h"
#include "regcache.h"
@@ -629,7 +630,7 @@ i386_linux_dr_set (ptid_t ptid, int regn
perror_with_name (_("Couldn't write debug register"));
}
-void
+static void
i386_linux_dr_set_control (unsigned long control)
{
struct lwp_info *lp;
@@ -640,7 +641,7 @@ i386_linux_dr_set_control (unsigned long
i386_linux_dr_set (ptid, DR_CONTROL, control);
}
-void
+static void
i386_linux_dr_set_addr (int regnum, CORE_ADDR addr)
{
struct lwp_info *lp;
@@ -653,13 +654,13 @@ i386_linux_dr_set_addr (int regnum, CORE
i386_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr);
}
-void
+static void
i386_linux_dr_reset_addr (int regnum)
{
i386_linux_dr_set_addr (regnum, 0);
}
-unsigned long
+static unsigned long
i386_linux_dr_get_status (void)
{
return i386_linux_dr_get (inferior_ptid, DR_STATUS);
@@ -825,6 +826,12 @@ _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;
+ i386_set_debug_register_length (4);
+
/* 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.21
diff -u -p -r1.21 i386-nat.c
--- src/gdb/i386-nat.c 12 May 2009 16:51:12 -0000 1.21
+++ src/gdb/i386-nat.c 13 May 2009 22:06:50 -0000
@@ -18,11 +18,13 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "i386-nat.h"
#include "defs.h"
#include "breakpoint.h"
#include "command.h"
#include "gdbcmd.h"
#include "target.h"
+#include "gdb_assert.h"
/* Support for hardware watchpoints and breakpoints using the i386
debug registers.
@@ -32,38 +34,14 @@
more of the watchpoints triggered and at what address, checking
whether a given region can be watched, etc.
- A target which wants to use these functions should define several
- macros, such as `target_insert_watchpoint' and
- `target_stopped_data_address', listed in target.h, to call the
- appropriate functions below. It should also define
- I386_USE_GENERIC_WATCHPOINTS in its tm.h file.
-
- In addition, each target should provide several low-level macros
- that will be called to insert watchpoints and hardware breakpoints
- into the inferior, remove them, and check their status. These
- macros 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_RESET_ADDR -- reset the address stored in
- one debug register
-
- I386_DR_LOW_GET_STATUS -- return the value of the debug
- status (DR6) register.
-
The functions below implement debug registers sharing by reference
counts, and allow to watch regions up to 16 bytes long. */
-#ifdef I386_USE_GENERIC_WATCHPOINTS
+struct i386_dr_low_type i386_dr_low;
+
/* Support for 8-byte wide hw watchpoints. */
-#ifndef TARGET_HAS_DR_LEN_8
-#define TARGET_HAS_DR_LEN_8 0
-#endif
+#define TARGET_HAS_DR_LEN_8 (i386_dr_low.debug_register_length == 8)
/* Debug registers' indices. */
#define DR_NADDR 4 /* The number of debug address registers.
*/
@@ -168,7 +146,7 @@
/* Mirror the inferior's DRi registers. We keep the status and
control registers separated because they don't hold addresses. */
static CORE_ADDR dr_mirror[DR_NADDR];
-static unsigned dr_status_mirror, dr_control_mirror;
+static unsigned long dr_status_mirror, dr_control_mirror;
/* Reference counts for each debug register. */
static int dr_ref_count[DR_NADDR];
@@ -256,8 +234,8 @@ i386_show_dr (const char *func, CORE_ADD
here. */
: "??unknown??"))));
puts_unfiltered (":\n");
- printf_unfiltered ("\tCONTROL (DR7): %08x STATUS (DR6): %08x\n",
- dr_control_mirror, dr_status_mirror);
+ printf_unfiltered ("\tCONTROL (DR7): %s STATUS (DR6): %s\n",
+ phex (dr_control_mirror, 8), phex (dr_status_mirror,
8));
ALL_DEBUG_REGISTERS(i)
{
printf_unfiltered ("\
@@ -330,6 +308,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). */
@@ -373,8 +354,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;
}
@@ -402,8 +383,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;
}
@@ -492,7 +474,7 @@ Invalid value %d of operation in i386_ha
address ADDR and whose length is LEN bytes. Watch memory accesses
of the type TYPE. Return 0 on success, -1 on failure. */
-int
+static int
i386_insert_watchpoint (CORE_ADDR addr, int len, int type)
{
int retval;
@@ -516,7 +498,7 @@ i386_insert_watchpoint (CORE_ADDR addr,
/* 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. */
-int
+static int
i386_remove_watchpoint (CORE_ADDR addr, int len, int type)
{
int retval;
@@ -540,7 +522,7 @@ i386_remove_watchpoint (CORE_ADDR addr,
/* Return non-zero if we can watch a memory region that starts at
address ADDR and whose length is LEN bytes. */
-int
+static int
i386_region_ok_for_watchpoint (CORE_ADDR addr, int len)
{
int nregs;
@@ -555,14 +537,14 @@ i386_region_ok_for_watchpoint (CORE_ADDR
address associated with that watchpoint and return non-zero.
Otherwise, return zero. */
-int
+static int
i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
{
CORE_ADDR addr = 0;
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)
{
@@ -588,7 +570,7 @@ i386_stopped_data_address (struct target
return rc;
}
-int
+static int
i386_stopped_by_watchpoint (void)
{
CORE_ADDR addr = 0;
@@ -598,12 +580,12 @@ i386_stopped_by_watchpoint (void)
/* Return non-zero if the inferior has some break/watchpoint that
triggered. */
-int
+static int
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);
@@ -618,7 +600,7 @@ i386_stopped_by_hwbp (void)
/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
Return 0 on success, EBUSY on failure. */
-int
+static int
i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt)
{
unsigned len_rw = i386_length_and_rw_bits (1, hw_execute);
@@ -634,7 +616,7 @@ i386_insert_hw_breakpoint (struct bp_tar
/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address.
Return 0 on success, -1 on failure. */
-int
+static int
i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt)
{
unsigned len_rw = i386_length_and_rw_bits (1, hw_execute);
@@ -670,6 +652,27 @@ i386_can_use_hw_breakpoint (int type, in
return 1;
}
+static void
+add_show_debug_regs_command (void)
+{
+ /* A maintenance command to enable printing the internal DRi mirror
+ variables. */
+ add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
+ &maint_show_dr, _("\
+Set whether to show variables that mirror the x86 debug registers."), _("\
+Show whether to show variables that mirror the x86 debug registers."), _("\
+Use \"on\" to enable, \"off\" to disable.\n\
+If enabled, the debug registers values are shown when GDB inserts\n\
+or removes a hardware breakpoint or watchpoint, and when the inferior\n\
+triggers a breakpoint or watchpoint."),
+ NULL,
+ NULL,
+ &maintenance_set_cmdlist,
+ &maintenance_show_cmdlist);
+}
+
+/* There are only two global functions left. */
+
void
i386_use_watchpoints (struct target_ops *t)
{
@@ -688,29 +691,12 @@ i386_use_watchpoints (struct target_ops
t->to_remove_hw_breakpoint = i386_remove_hw_breakpoint;
}
-#endif /* I386_USE_GENERIC_WATCHPOINTS */
-
-
-/* Provide a prototype to silence -Wmissing-prototypes. */
-void _initialize_i386_nat (void);
-
void
-_initialize_i386_nat (void)
+i386_set_debug_register_length (int len)
{
-#ifdef I386_USE_GENERIC_WATCHPOINTS
- /* A maintenance command to enable printing the internal DRi mirror
- variables. */
- add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
- &maint_show_dr, _("\
-Set whether to show variables that mirror the x86 debug registers."), _("\
-Show whether to show variables that mirror the x86 debug registers."), _("\
-Use \"on\" to enable, \"off\" to disable.\n\
-If enabled, the debug registers values are shown when GDB inserts\n\
-or removes a hardware breakpoint or watchpoint, and when the inferior\n\
-triggers a breakpoint or watchpoint."),
- NULL,
- NULL,
- &maintenance_set_cmdlist,
- &maintenance_show_cmdlist);
-#endif
+ /* This function should be called only once for each native target. */
+ gdb_assert (i386_dr_low.debug_register_length == 0);
+ gdb_assert (len == 4 || len == 8);
+ i386_dr_low.debug_register_length = len;
+ add_show_debug_regs_command ();
}
Index: src/gdb/i386-nat.h
===================================================================
RCS file: i386-nat.h
diff -N i386-nat.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/gdb/i386-nat.h 13 May 2009 22:06:51 -0000
@@ -0,0 +1,89 @@
+/* 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 <http://www.gnu.org/licenses/>.
*/
+
+#include "defs.h"
+
+#ifndef I386_NAT_H
+#define I386_NAT_H 1
+
+/* Hardware-assisted breakpoints and watchpoints. */
+
+/* Add watchpoint methods to the provided target_ops.
+ Targets using i386 family debug registers for watchpoints should call
+ this. */
+struct target_ops;
+extern void i386_use_watchpoints (struct target_ops *);
+
+/* 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 several low-level functions
+ regrouped into i386_dr_low_type struct below. These functions
+ that will be called to insert watchpoints and hardware breakpoints
+ into the inferior, remove them, and check their status. These
+ functions are:
+
+ set_control -- set the debug control (DR7)
+ register to a given value
+
+ set_addr -- put an address into one debug
+ register
+
+ reset_addr -- reset the address stored in
+ one debug register
+
+ get_status -- return the value of the debug
+ status (DR6) register.
+
+ Additionally, the native file should set the debug_register_length
+ field to 4 or 8 depending on the number of bytes used for
+ deubg registers. */
+
+struct i386_dr_low_type
+ {
+ void (*set_control) (unsigned long);
+ void (*set_addr) (int, CORE_ADDR);
+ void (*reset_addr) (int);
+ unsigned long (*get_status) (void);
+ int debug_register_length;
+ };
+
+extern struct i386_dr_low_type i386_dr_low;
+
+/* Use this function to set i386_dr_low debug_register_length field
+ rather than setting it directly to check that the length is only
+ set once. It also enables the 'maint set/show show-debug-regs'
+ command. */
+
+extern void i386_set_debug_register_length (int len);
+
+/* Use this function to reset the i386-nat.c debug register state. */
+
+extern void i386_cleanup_dregs (void);
+
+#endif /* I386_NAT_H */
Index: src/gdb/i386-windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-windows-nat.c,v
retrieving revision 1.3
diff -u -p -r1.3 i386-windows-nat.c
--- src/gdb/i386-windows-nat.c 13 Jan 2009 04:14:07 -0000 1.3
+++ src/gdb/i386-windows-nat.c 13 May 2009 22:06:51 -0000
@@ -17,6 +17,7 @@
#include "defs.h"
#include "windows-nat.h"
+#include "i386-nat.h"
#include <windows.h>
@@ -73,4 +74,5 @@ void
_initialize_i386_windows_nat (void)
{
windows_set_context_register_offsets (mappings);
+ i386_set_debug_register_length (4);
}
Index: src/gdb/i386bsd-nat.h
===================================================================
RCS file: /cvs/src/src/gdb/i386bsd-nat.h,v
retrieving revision 1.6
diff -u -p -r1.6 i386bsd-nat.h
--- src/gdb/i386bsd-nat.h 3 Jan 2009 05:57:52 -0000 1.6
+++ src/gdb/i386bsd-nat.h 13 May 2009 22:06:51 -0000
@@ -25,4 +25,14 @@
extern struct target_ops *i386bsd_target (void);
+/* low level i386 debug register functions used in i386fbsd-nat.c. */
+
+extern void i386bsd_dr_set_control (unsigned long control);
+
+extern void i386bsd_dr_set_addr (int regnum, CORE_ADDR addr);
+
+extern void i386bsd_dr_reset_addr (int regnum);
+
+extern unsigned long i386bsd_dr_get_status (void);
+
#endif /* i386bsd-nat.h */
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 13 May 2009 22:06:51 -0000
@@ -29,6 +29,7 @@
#include "fbsd-nat.h"
#include "i386-tdep.h"
+#include "i386-nat.h"
#include "i386bsd-nat.h"
/* Resume execution of the inferior process. If STEP is nonzero,
@@ -126,7 +127,20 @@ _initialize_i386fbsd_nat (void)
/* Add some extra features to the common *BSD/i386 target. */
t = i386bsd_target ();
+
+#ifdef HAVE_PT_GETDBREGS
+
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;
+ i386_set_debug_register_length (4);
+
+#endif /* HAVE_PT_GETDBREGS */
+
+
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.189
diff -u -p -r1.189 windows-nat.c
--- src/gdb/windows-nat.c 17 Apr 2009 15:44:28 -0000 1.189
+++ src/gdb/windows-nat.c 13 May 2009 22:06:52 -0000
@@ -63,6 +63,7 @@
#include "windows-tdep.h"
#include "windows-nat.h"
+#include "i386-nat.h"
#define AdjustTokenPrivileges dyn_AdjustTokenPrivileges
#define DebugActiveProcessStop dyn_DebugActiveProcessStop
@@ -140,6 +141,10 @@ static void windows_stop (ptid_t);
static int windows_thread_alive (struct target_ops *, ptid_t);
static void windows_kill_inferior (struct target_ops *);
+static void cygwin_set_dr (int i, CORE_ADDR addr);
+static void cygwin_set_dr7 (unsigned long val);
+static unsigned long cygwin_get_dr6 (void);
+
static enum target_signal last_sig = TARGET_SIGNAL_0;
/* Set if a signal was received from the debugged process */
@@ -2166,8 +2171,18 @@ init_windows_ops (void)
windows_ops.to_has_execution = 1;
windows_ops.to_pid_to_exec_file = windows_pid_to_exec_file;
windows_ops.to_get_ada_task_ptid = windows_get_ada_task_ptid;
+
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 = NULL;
+ i386_dr_low.get_status = cygwin_get_dr6;
+
+ /* i386_dr_low.debug_register_length field is set by
+ calling i386_set_debug_register_length function
+ in processor windows specific native file. */
+
windows_ops.to_magic = OPS_MAGIC;
}
@@ -2265,7 +2280,7 @@ Show whether to display kernel exception
/* 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 windows_continue is called. */
-void
+static void
cygwin_set_dr (int i, CORE_ADDR addr)
{
if (i < 0 || i > 3)
@@ -2279,10 +2294,10 @@ cygwin_set_dr (int i, CORE_ADDR addr)
/* 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 windows_wait. */
-void
-cygwin_set_dr7 (unsigned val)
+static void
+cygwin_set_dr7 (unsigned long val)
{
- dr[7] = val;
+ dr[7] = (CORE_ADDR) val;
debug_registers_changed = 1;
debug_registers_used = 1;
}
@@ -2290,10 +2305,10 @@ cygwin_set_dr7 (unsigned val)
/* Get the value of the DR6 debug status register from the inferior.
Here we just return the value stored in dr[6]
by the last call to thread_rec for current_event.dwThreadId id. */
-unsigned
+static unsigned long
cygwin_get_dr6 (void)
{
- return dr[6];
+ return (unsigned long) dr[6];
}
/* Determine if the thread referenced by "ptid" is alive
Index: src/gdb/config/i386/go32.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/go32.mh,v
retrieving revision 1.10
diff -u -p -r1.10 go32.mh
--- src/gdb/config/i386/go32.mh 19 Apr 2009 18:29:34 -0000 1.10
+++ src/gdb/config/i386/go32.mh 13 May 2009 22:06:52 -0000
@@ -3,7 +3,6 @@
# We include several header files from config/djgpp
MH_CFLAGS= -I$(srcdir)/config/djgpp
-NAT_FILE= nm-go32.h
NATDEPFILES= go32-nat.o i386-nat.o
HOST_IPC=
Index: src/gdb/config/i386/linux64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/linux64.mh,v
retrieving revision 1.7
diff -u -p -r1.7 linux64.mh
--- src/gdb/config/i386/linux64.mh 4 Jan 2006 19:33:11 -0000 1.7
+++ src/gdb/config/i386/linux64.mh 13 May 2009 22:06:52 -0000
@@ -2,7 +2,7 @@
NATDEPFILES= inf-ptrace.o fork-child.o \
i386-nat.o amd64-nat.o amd64-linux-nat.o linux-nat.o \
proc-service.o linux-thread-db.o gcore.o linux-fork.o
-NAT_FILE= nm-linux64.h
+NAT_FILE= config/nm-linux.h
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
Index: src/gdb/config/i386/nm-cygwin.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin.h,v
retrieving revision 1.10
diff -u -p -r1.10 nm-cygwin.h
--- src/gdb/config/i386/nm-cygwin.h 26 Mar 2009 00:18:46 -0000 1.10
+++ src/gdb/config/i386/nm-cygwin.h 13 May 2009 22:06:52 -0000
@@ -18,20 +18,3 @@
#define ADD_SHARED_SYMBOL_FILES dll_symbol_command
void dll_symbol_command (char *, int);
-
-#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);
Index: src/gdb/config/i386/nm-cygwin64.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-cygwin64.h,v
retrieving revision 1.3
diff -u -p -r1.3 nm-cygwin64.h
--- src/gdb/config/i386/nm-cygwin64.h 26 Mar 2009 00:18:46 -0000 1.3
+++ src/gdb/config/i386/nm-cygwin64.h 13 May 2009 22:06:52 -0000
@@ -17,20 +17,3 @@
#define ADD_SHARED_SYMBOL_FILES dll_symbol_command
void dll_symbol_command (char *, int);
-
-#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);
Index: src/gdb/config/i386/nm-fbsd.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-fbsd.h,v
retrieving revision 1.20
diff -u -p -r1.20 nm-fbsd.h
--- src/gdb/config/i386/nm-fbsd.h 26 Mar 2009 00:18:46 -0000 1.20
+++ src/gdb/config/i386/nm-fbsd.h 13 May 2009 22:06:52 -0000
@@ -21,33 +21,8 @@
#ifndef NM_FBSD_H
#define NM_FBSD_H
-#ifdef HAVE_PT_GETDBREGS
-#define I386_USE_GENERIC_WATCHPOINTS
-#endif
-
-#include "i386/nm-i386.h"
-
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#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: config/i386/nm-go32.h
diff -N config/i386/nm-go32.h
--- src/gdb/config/i386/nm-go32.h 26 Mar 2009 00:18:46 -0000 1.10
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,35 +0,0 @@
-/* Native definitions for Intel x86 running DJGPP.
- Copyright 1997, 1998, 1999, 2001, 2002, 2007, 2008, 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 <http://www.gnu.org/licenses/>.
*/
-
-#define I386_USE_GENERIC_WATCHPOINTS
-
-#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: config/i386/nm-i386.h
diff -N config/i386/nm-i386.h
--- src/gdb/config/i386/nm-i386.h 26 Mar 2009 00:18:46 -0000 1.15
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,72 +0,0 @@
-/* Native macro definitions for GDB on an Intel i[3456]86.
- Copyright 2001, 2004, 2007, 2008, 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 <http://www.gnu.org/licenses/>.
*/
-
-#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 define I386_USE_GENERIC_WATCHPOINTS must
- call this function. */
-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 */
-
-#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.30
diff -u -p -r1.30 nm-linux.h
--- src/gdb/config/i386/nm-linux.h 26 Mar 2009 00:18:46 -0000 1.30
+++ src/gdb/config/i386/nm-linux.h 13 May 2009 22:06:52 -0000
@@ -22,31 +22,8 @@
#ifndef NM_LINUX_H
#define NM_LINUX_H
-/* GNU/Linux supports the i386 hardware debugging registers. */
-#define I386_USE_GENERIC_WATCHPOINTS
-
-#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: config/i386/nm-linux64.h
diff -N config/i386/nm-linux64.h
--- src/gdb/config/i386/nm-linux64.h 26 Mar 2009 00:18:46 -0000 1.10
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,53 +0,0 @@
-/* Native support for GNU/Linux x86-64.
-
- Copyright 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
- Free Software Foundation, Inc.
-
- Contributed by Jiri Smid, SuSE Labs.
-
- 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 <http://www.gnu.org/licenses/>.
*/
-
-#ifndef NM_LINUX64_H
-#define NM_LINUX64_H
-
-/* GNU/Linux supports the i386 hardware debugging registers. */
-#define I386_USE_GENERIC_WATCHPOINTS
-
-#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 */
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA-v3] Remove i386 low level debug register function from nm- header file.
2009-05-13 23:39 ` [RFA-v3] " Pierre Muller
@ 2009-05-14 9:06 ` Ulrich Weigand
2009-05-14 9:10 ` Joel Brobecker
` (2 more replies)
0 siblings, 3 replies; 23+ messages in thread
From: Ulrich Weigand @ 2009-05-14 9:06 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches, 'Pedro Alves', 'Eli Zaretskii'
Pierre Muller wrote:
> Remove all i386 debug register low level macros in config nm files.
> (I386_DR_LOW_SET_ADDR, I386_DR_LOW_RESET_ADDR): Remove.
> (I386_DR_LOW_GET_STATUS, I386_DR_LOW_SET_CONTROL): Remove.
> (I386_USE_GENERIC_WATCHPOIINTS): Remove.
>
> * i386-nat.h: New file (adapted from config/i386/nm-i386.h).
> (struct i386_dr_low_type): New type.
> (i386_dr_low): New global variable.
> * i386-nat.c (TARGET_HAS_DR_LEN_8): Update macro.
> (i386_insert_aligned_watchpoint): Replace i386 dr low macros by
> i386_dr_low struct variable fields.
> (i386_remove_aligned_watchpoint): Likewise.
> (i386_stopped_data_address): Likewise.
> (i386_stopped_by_hwbp): Likewise.
> (show_debug_regs_command_added): New static variable.
> (add_show_debug_regs_command): New static function.
> (i386_use_watchpoints): Call add_show_debug_regs_command if not
> done.
> (i386_set_debug_register_length): New function.
> (_initialize_i386_nat): Delete.
>
> * amd64-linux-nat.c: Include "i386-nat.h".
> (amd64_linux_dr_set_control): Change to static.
> (amd64_linux_dr_get_status): Change to static.
> (amd64_linux_dr_set_addr,amd64_linux_dr_reset_addr): Likewise.
> (_initialize_amd64_linux_nat): Set i386_dr_low variable fields.
>
> * go32-nat.c: Include "i386-nat.h".
> (go32_set_addr): Change to static.
> (go32_set_dr7): Change to static. Change arg type to unisgned long.
> (go32_get_dr6): Change to static. Change return type to unisnged
> long.
> (init_go32_ops): Set i386_dr_low variable fields.
> * i386-linux-nat.c: Include "i386-nat.h".
> (i386_linux_dr_set_control, i386_linux_dr_get_status): Change to
> static.
> (i386_linux_dr_set_addr, i386_linux_dr_reset_addr): Idem.
> (_initialize_i386_linux_nat): Set i386_dr_low variable fields.
> * i386bsd-nat.h: Declare functions used for
> i386_dr_low fields in i386fbsd-nat.c.
> * i386fbsd-nat.c: Include "i386-nat.h".
> (_initialize_i386fbsd_nat): Set i386_dr_low variable fields.
> * windows-nat.c: Include "i386-nat.h".
> (cygwin_set_dr, cygwin_get_dr6, cygwin_set_dr7): Add prototypes.
> Change to static.
> (cygwin_get_dr6): Change return type to unisnged long.
> (cygwin_set_dr7): Change arg type to unisgned long.
> (init_windows_ops): Set i386_dr_low function fields.
>
> * amd64-windows-nat.c (_initialize_amd64_windows_nat): Call
> i386_set_debug_register_length.
> * i386-windows-nat.c (_initialize_i386_windows_nat): Likewise.
>
> * config/i386/nm-cygwin.h: Remove all I386_* macros.
> * config/i386/nm-cygwin64.h: Likewise.
> * config/i386/nm-fbsd.h: Likewise.
> * config/i386/nm-linux.h: Likewise.
> * config/i386/nm-i386.h: Remove completely.
> * config/i386/nm-go32.h: Remove completely.
> * config/i386/nm-linux64.h: Remove completely.
> * config/i386/go32.mh (NAT_FILE): Remove entry.
> * config/i386/linux64.h (NAT_FILE): Change to config/nm-linux.h.
This is OK.
Thanks for doing this cleanup work!
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA-v3] Remove i386 low level debug register function from nm- header file.
2009-05-14 9:06 ` Ulrich Weigand
@ 2009-05-14 9:10 ` Joel Brobecker
2009-05-14 9:40 ` Pierre Muller
2009-05-14 15:32 ` Macros in config files Pierre Muller
2 siblings, 0 replies; 23+ messages in thread
From: Joel Brobecker @ 2009-05-14 9:10 UTC (permalink / raw)
To: Ulrich Weigand
Cc: Pierre Muller, gdb-patches, 'Pedro Alves',
'Eli Zaretskii'
> Thanks for doing this cleanup work!
Yes, Thank You!
--
Joel
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: [RFA-v3] Remove i386 low level debug register function from nm- header file.
2009-05-14 9:06 ` Ulrich Weigand
2009-05-14 9:10 ` Joel Brobecker
@ 2009-05-14 9:40 ` Pierre Muller
2009-05-14 15:32 ` Macros in config files Pierre Muller
2 siblings, 0 replies; 23+ messages in thread
From: Pierre Muller @ 2009-05-14 9:40 UTC (permalink / raw)
To: 'Ulrich Weigand', 'Joel Brobecker'
Cc: gdb-patches, 'Pedro Alves', 'Eli Zaretskii'
> This is OK.
>
> Thanks for doing this cleanup work!
Patch committed.
Thanks to you, Eli and Joel for the feedback!
Pierre Muller
Pascal language support maintainer for GDB
^ permalink raw reply [flat|nested] 23+ messages in thread
* Macros in config files.
2009-05-14 9:06 ` Ulrich Weigand
2009-05-14 9:10 ` Joel Brobecker
2009-05-14 9:40 ` Pierre Muller
@ 2009-05-14 15:32 ` Pierre Muller
2009-05-14 18:31 ` Ulrich Weigand
2 siblings, 1 reply; 23+ messages in thread
From: Pierre Muller @ 2009-05-14 15:32 UTC (permalink / raw)
To: 'Ulrich Weigand'
Cc: gdb-patches, 'Pedro Alves', 'Eli Zaretskii'
Concerning the macros defined in config directory,
this patch changes the counts:
Before patch:
27 macros for a total of 57 occurrences
After the patch:
21 macros for a total of 26 occurrences.
This is the list of remaining defines in config files:
nm CODESET
nm ADD_SHARED_SYMBOL_FILES
nm CANNOT_STEP_HW_WATCHPOINTS
nm DEPRECATED_IBM6000_TARGET
nm FILL_FPXREGSET
nm GDB_FPREGSET_T
nm GDB_GREGSET_T
nm GET_THREAD_SIGNALS
nm PC_SOLIB
nm PROCFS_DONT_TRACE_FAULTS
nm PROCFS_NEED_CLEAR_CURSIG_FOR_KILL
nm REALTIME_HI
nm REALTIME_LO
nm SOLIB_ADD
nm SOLIB_CREATE_INFERIOR_HOOK
nm START_INFERIOR_TRAPS_EXPECTED
nm TARGET_HAS_HARDWARE_WATCHPOINTS
nm THREAD_STATE_CLEAR_TRACED
nm THREAD_STATE_FLAVOR
nm THREAD_STATE_SET_TRACED
nm THREAD_STATE_SIZE
I will try to narrow this list down further.
Anyone else interested?
Pierre Muller
Here is a list of all occurrences of these macros
(Chang* file pattern excluded)
>>>>>>>>>>>>>>>>>>
Macro CODESET
charset.c:819: auto_host_charset_name = nl_langinfo (CODESET);
config/djgpp/config.sed:28:# We have an emulation of nl_langinfo in
go32-nat.c that supports CODESET.
config/djgpp/langinfo.h:26: CODESET,
config/djgpp/langinfo.h:31:#define CODESET CODESET
config.in:192:/* Define if you have <langinfo.h> and nl_langinfo(CODESET).
*/
configure:15975: echo "$as_me:$LINENO: checking for nl_langinfo and
CODESET" >&5
configure:15976:echo $ECHO_N "checking for nl_langinfo and CODESET...
$ECHO_C" >&6
configure:15990:char* cs = nl_langinfo(CODESET);
go32-nat.c:1026: case CODESET:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro ADD_SHARED_SYMBOL_FILES
config/i386/nm-cygwin.h:19:#define ADD_SHARED_SYMBOL_FILES
dll_symbol_command
config/i386/nm-cygwin64.h:18:#define ADD_SHARED_SYMBOL_FILES
dll_symbol_command
symfile.c:2240:#ifdef ADD_SHARED_SYMBOL_FILES
symfile.c:2241: ADD_SHARED_SYMBOL_FILES (args, from_tty);
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro CANNOT_STEP_HW_WATCHPOINTS
config/i386/nm-i386sol2.h:31:#define CANNOT_STEP_HW_WATCHPOINTS
doc/gdbint.texinfo:789:@findex CANNOT_STEP_HW_WATCHPOINTS
doc/gdbint.texinfo:790:@item CANNOT_STEP_HW_WATCHPOINTS
infrun.c:178:#ifndef CANNOT_STEP_HW_WATCHPOINTS
infrun.c:179:#define CANNOT_STEP_HW_WATCHPOINTS 0
infrun.c:181:#undef CANNOT_STEP_HW_WATCHPOINTS
infrun.c:182:#define CANNOT_STEP_HW_WATCHPOINTS 1
infrun.c:1015: if (CANNOT_STEP_HW_WATCHPOINTS && step)
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro DEPRECATED_IBM6000_TARGET
config/rs6000/nm-rs6000.h:50:#define DEPRECATED_IBM6000_TARGET
doc/gdbint.texinfo:4696:@item DEPRECATED_IBM6000_TARGET
doc/gdbint.texinfo:4697:@findex DEPRECATED_IBM6000_TARGET
exec.c:243:#ifdef DEPRECATED_IBM6000_TARGET
exec.c:255:#endif /* DEPRECATED_IBM6000_TARGET */
symfile.c:2267:#ifdef DEPRECATED_IBM6000_TARGET
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro FILL_FPXREGSET
config/i386/nm-linux.h:29:#define FILL_FPXREGSET
gregset.h:59:#ifdef FILL_FPXREGSET
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro GDB_FPREGSET_T
config/nm-linux.h:30:#define GDB_FPREGSET_T elf_fpregset_t
config/sparc/nm-sol2.h:24:#define GDB_FPREGSET_T prfpregset_t
gregset.h:26:#ifndef GDB_FPREGSET_T
gregset.h:27:#define GDB_FPREGSET_T fpregset_t
gregset.h:31:typedef GDB_FPREGSET_T gdb_fpregset_t;
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro GDB_GREGSET_T
config/nm-linux.h:29:#define GDB_GREGSET_T elf_gregset_t
config/sparc/nm-sol2.h:23:#define GDB_GREGSET_T prgregset_t
gregset.h:22:#ifndef GDB_GREGSET_T
gregset.h:23:#define GDB_GREGSET_T gregset_t
gregset.h:30:typedef GDB_GREGSET_T gdb_gregset_t;
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro GET_THREAD_SIGNALS
config/nm-linux.h:24:#define GET_THREAD_SIGNALS(mask)
lin_thread_get_thread_signals (mask)
linux-thread-db.c:563:#ifdef GET_THREAD_SIGNALS
linux-thread-db.c:569: GET_THREAD_SIGNALS (&mask);
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro PC_SOLIB
breakpoint.c:4587:#ifdef PC_SOLIB
breakpoint.c:4588: && PC_SOLIB (loc->address)
config/rs6000/nm-rs6000.h:46:#define PC_SOLIB(PC)
xcoff_solib_address(PC)
gdbtk/generic/gdbtk-cmds.c:2220:#ifdef PC_SOLIB
gdbtk/generic/gdbtk-cmds.c:2222: Tcl_NewStringObj
(PC_SOLIB (pc), -1));
gdbtk/generic/gdbtk-stack.c:589:#ifdef PC_SOLIB
gdbtk/generic/gdbtk-stack.c:592: char *lib = PC_SOLIB (get_frame_pc
(fi));
stack.c:812:#ifdef PC_SOLIB
stack.c:813: char *lib = PC_SOLIB (get_frame_pc (frame));
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro PROCFS_DONT_TRACE_FAULTS
config/alpha/nm-osf3.h:31:#define PROCFS_DONT_TRACE_FAULTS
procfs.c:3482:#ifdef PROCFS_DONT_TRACE_FAULTS
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro PROCFS_NEED_CLEAR_CURSIG_FOR_KILL
config/alpha/nm-osf3.h:34:#define PROCFS_NEED_CLEAR_CURSIG_FOR_KILL
procfs.c:4711:#ifdef PROCFS_NEED_CLEAR_CURSIG_FOR_KILL
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro REALTIME_HI
common/signals.c:44:# define REALTIME_HI (__SIGRTMAX + 1)
common/signals.c:47:# define REALTIME_HI (SIGRTMAX + 1)
common/signals.c:497: if (hostsig >= REALTIME_LO && hostsig < REALTIME_HI)
common/signals.c:777: if (retsig >= REALTIME_LO && retsig <
REALTIME_HI)
config/nm-nto.h:27:#define REALTIME_HI 56
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro REALTIME_LO
common/signals.c:41:#ifndef REALTIME_LO
common/signals.c:43:# define REALTIME_LO __SIGRTMIN
common/signals.c:46:# define REALTIME_LO SIGRTMIN
common/signals.c:496:#if defined (REALTIME_LO)
common/signals.c:497: if (hostsig >= REALTIME_LO && hostsig < REALTIME_HI)
common/signals.c:753:#if defined (REALTIME_LO)
common/signals.c:777: if (retsig >= REALTIME_LO && retsig <
REALTIME_HI)
config/nm-nto.h:26:#define REALTIME_LO 41
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro SOLIB_ADD
breakpoint.c:7710: over a dlopen call and SOLIB_ADD is resetting the
breakpoints.
config/rs6000/nm-rs6000.h:32:#define SOLIB_ADD(a, b, c, d) \
doc/gdbint.texinfo:5445:@item SOLIB_ADD (@var{filename}, @var{from_tty},
@var{targ}, @var{readsyms})
doc/gdbint.texinfo:5446:@findex SOLIB_ADD
infcmd.c:406:#ifdef SOLIB_ADD
infcmd.c:407: SOLIB_ADD (NULL, from_tty, target, auto_solib_add);
infrun.c:2319: exec_ops to SOLIB_ADD. This is because current GDB is
infrun.c:2327:#ifdef SOLIB_ADD
infrun.c:2328: SOLIB_ADD (NULL, 0, ¤t_target, auto_solib_add);
infrun.c:3282: exec_ops to SOLIB_ADD. This is because current GDB is
infrun.c:3290:#ifdef SOLIB_ADD
infrun.c:3291: SOLIB_ADD (NULL, 0, ¤t_target, auto_solib_add);
infrun.c:3371:#if defined(SOLIB_ADD)
solib-frv.c:442: SOLIB_ADD. SOLIB_ADD eventually calls this this
function,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro SOLIB_CREATE_INFERIOR_HOOK
config/rs6000/nm-rs6000.h:24:#define SOLIB_CREATE_INFERIOR_HOOK(PID) \
doc/gdbint.texinfo:5452:@item SOLIB_CREATE_INFERIOR_HOOK
doc/gdbint.texinfo:5453:@findex SOLIB_CREATE_INFERIOR_HOOK
infcmd.c:417:#ifdef SOLIB_CREATE_INFERIOR_HOOK
infcmd.c:418: SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
infrun.c:401:#ifdef SOLIB_CREATE_INFERIOR_HOOK
infrun.c:402: SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
solib-frv.c:440: by SOLIB_CREATE_INFERIOR_HOOK(), however, in the case
of core
solib-frv.c:444: SOLIB_CREATE_INFERIOR_HOOK(). (See
post_create_inferior() in
solib-frv.c:952: SOLIB_CREATE_INFERIOR_HOOK.
solib-irix.c:385: SOLIB_CREATE_INFERIOR_HOOK.
solib-sunos.c:701: SOLIB_CREATE_INFERIOR_HOOK.
solib-svr4.c:1539: SOLIB_CREATE_INFERIOR_HOOK.
solib.c:943: SOLIB_CREATE_INFERIOR_HOOK. */
solib.c:1037:#ifdef SOLIB_CREATE_INFERIOR_HOOK
solib.c:1038: SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro START_INFERIOR_TRAPS_EXPECTED
config/alpha/nm-osf3.h:22:#define START_INFERIOR_TRAPS_EXPECTED 3
darwin-nat.c:923: startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
doc/gdbint.texinfo:5457:@item START_INFERIOR_TRAPS_EXPECTED
doc/gdbint.texinfo:5458:@findex START_INFERIOR_TRAPS_EXPECTED
inf-ptrace.c:160: /* START_INFERIOR_TRAPS_EXPECTED is defined in
inferior.h, and will
inf-ptrace.c:163: startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
inf-ttrace.c:656: /* START_INFERIOR_TRAPS_EXPECTED is defined in
inferior.h, and will
inf-ttrace.c:659: startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
inferior.h:383: START_INFERIOR_TRAPS_EXPECTED in tm.h. */
inferior.h:385:#if !defined(START_INFERIOR_TRAPS_EXPECTED)
inferior.h:386:#define START_INFERIOR_TRAPS_EXPECTED 2
procfs.c:4900: startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro TARGET_HAS_HARDWARE_WATCHPOINTS
config/i386/nm-i386sol2.h:21:#define TARGET_HAS_HARDWARE_WATCHPOINTS
config/mips/nm-irix5.h:21:#define TARGET_HAS_HARDWARE_WATCHPOINTS
config/sparc/nm-sol2.h:31:#define TARGET_HAS_HARDWARE_WATCHPOINTS
doc/gdbint.texinfo:697:@findex TARGET_HAS_HARDWARE_WATCHPOINTS
doc/gdbint.texinfo:698:@item TARGET_HAS_HARDWARE_WATCHPOINTS
doc/gdbint.texinfo:5000:@item TARGET_HAS_HARDWARE_WATCHPOINTS
procfs.c:2905:#if !defined (TARGET_HAS_HARDWARE_WATCHPOINTS)
procfs.c:5297:#ifndef TARGET_HAS_HARDWARE_WATCHPOINTS
procfs.c:6020:#ifdef TARGET_HAS_HARDWARE_WATCHPOINTS
remote.17to18.diff:400:< #ifdef TARGET_HAS_HARDWARE_WATCHPOINTS
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro THREAD_STATE_CLEAR_TRACED
config/i386/nm-i386gnu.h:35:#define THREAD_STATE_CLEAR_TRACED(state) \
gnu-nat.c:530: THREAD_STATE_CLEAR_TRACED (state);
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro THREAD_STATE_FLAVOR
config/i386/nm-i386gnu.h:31:#define THREAD_STATE_FLAVOR
i386_REGS_SEGS_STATE
gnu-nat.c:271: err = thread_set_state (proc->port, THREAD_STATE_FLAVOR,
gnu-nat.c:377: thread_get_state (proc->port, THREAD_STATE_FLAVOR,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro THREAD_STATE_SET_TRACED
config/i386/nm-i386gnu.h:33:#define THREAD_STATE_SET_TRACED(state) \
gnu-nat.c:527: THREAD_STATE_SET_TRACED (state);
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
Macro THREAD_STATE_SIZE
config/i386/nm-i386gnu.h:32:#define THREAD_STATE_SIZE
i386_THREAD_STATE_COUNT
gnu-nat.c:272: (thread_state_t) &proc->state,
THREAD_STATE_SIZE);
gnu-nat.c:375: mach_msg_type_number_t state_size = THREAD_STATE_SIZE;
>>>>>>>>>>>>>>>>>>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Macros in config files.
2009-05-14 15:32 ` Macros in config files Pierre Muller
@ 2009-05-14 18:31 ` Ulrich Weigand
0 siblings, 0 replies; 23+ messages in thread
From: Ulrich Weigand @ 2009-05-14 18:31 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches, 'Pedro Alves', 'Eli Zaretskii'
Pierre Muller wrote:
> nm CODESET
This seems a false positive.
> nm ADD_SHARED_SYMBOL_FILES
> nm FILL_FPXREGSET
> nm GET_THREAD_SIGNALS
> nm THREAD_STATE_CLEAR_TRACED
> nm THREAD_STATE_FLAVOR
> nm THREAD_STATE_SET_TRACED
> nm THREAD_STATE_SIZE
These should be easy to get rid of.
> nm GDB_FPREGSET_T
> nm GDB_GREGSET_T
> nm REALTIME_HI
> nm REALTIME_LO
These should probably be set via configure.
> nm START_INFERIOR_TRAPS_EXPECTED
> nm PROCFS_DONT_TRACE_FAULTS
> nm PROCFS_NEED_CLEAR_CURSIG_FOR_KILL
> nm TARGET_HAS_HARDWARE_WATCHPOINTS
> nm CANNOT_STEP_HW_WATCHPOINTS
That's the procfs targets ... The proper solution would
probably be to create real procfs "subtarget", as was done
for e.g. the Linux target. Not sure if this is worth the
effort ... a quick hack might be platform #ifdefs in procfs.
> nm DEPRECATED_IBM6000_TARGET
> nm PC_SOLIB
> nm SOLIB_ADD
> nm SOLIB_CREATE_INFERIOR_HOOK
That's difficult -- AIX shared library support needs to be
re-implemented from scratch in the new framework. I'd
already started to do that some time ago but got side-
tracked ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2009-05-14 18:31 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-10 14:54 [RFC] Remove i386 low level debug register function from nm- header file Pierre Muller
2009-05-10 17:37 ` Eli Zaretskii
2009-05-12 13:02 ` Ulrich Weigand
2009-05-12 14:37 ` Pierre Muller
2009-05-12 15:00 ` Ulrich Weigand
2009-05-12 15:17 ` Eli Zaretskii
2009-05-12 15:45 ` Pierre Muller
2009-05-12 16:06 ` Ulrich Weigand
2009-05-12 16:19 ` Pedro Alves
2009-05-12 21:28 ` [RFC-v2] " Pierre Muller
2009-05-13 15:33 ` Ulrich Weigand
2009-05-13 18:09 ` Eli Zaretskii
2009-05-13 18:35 ` Ulrich Weigand
2009-05-13 18:25 ` Doug Evans
2009-05-13 18:38 ` Ulrich Weigand
2009-05-13 22:21 ` Pierre Muller
2009-05-13 23:16 ` Doug Evans
2009-05-13 23:39 ` [RFA-v3] " Pierre Muller
2009-05-14 9:06 ` Ulrich Weigand
2009-05-14 9:10 ` Joel Brobecker
2009-05-14 9:40 ` Pierre Muller
2009-05-14 15:32 ` Macros in config files Pierre Muller
2009-05-14 18:31 ` Ulrich Weigand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox