This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Enable HW Breakpoint in gdbserver-linux-x86
- From: Michael Eager <eager at eagerm dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Cc: Daniel Jacobowitz <drow at false dot org>
- Date: Wed, 18 Jul 2012 11:14:18 -0700
- Subject: [PATCH] Enable HW Breakpoint in gdbserver-linux-x86
The code in gdbserver which supports hardware watchpoints on
x86 Linux can also support hardware breakpoints without modification.
The attached patch calls the insert/remove watchpoint routines
for hardware breakpoints as well as watchpoints. Most of the
changes are to add comments identifying the wp/bp type values.
2012-07-18 Michael Eager <eager@eagercon.com>
* gdbserver/i386-low.c (Z_packet_to_hw_type): Add Z_PACKET_HW_BP,
translate to hw_execute.
* gdbserver/linux-x86-low.c (x86_insert_point, x86_remove_point):
Call i386_low_insert_watchpoint, i386_low_remove_watchpoint to add/del
hardware breakpoint.
--
Michael Eager eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
Index: gdb/gdbserver/i386-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/i386-low.c,v
retrieving revision 1.10
diff -u -r1.10 i386-low.c
--- gdb/gdbserver/i386-low.c 4 Jan 2012 08:17:23 -0000 1.10
+++ gdb/gdbserver/i386-low.c 18 Jul 2012 17:59:13 -0000
@@ -410,6 +410,7 @@
return retval;
}
+#define Z_PACKET_HW_BP '1'
#define Z_PACKET_WRITE_WP '2'
#define Z_PACKET_READ_WP '3'
#define Z_PACKET_ACCESS_WP '4'
@@ -421,6 +422,8 @@
{
switch (type)
{
+ case Z_PACKET_HW_BP:
+ return hw_execute;
case Z_PACKET_WRITE_WP:
return hw_write;
case Z_PACKET_READ_WP:
Index: gdb/gdbserver/linux-x86-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-x86-low.c,v
retrieving revision 1.42
diff -u -r1.42 linux-x86-low.c
--- gdb/gdbserver/linux-x86-low.c 13 Apr 2012 14:39:41 -0000 1.42
+++ gdb/gdbserver/linux-x86-low.c 18 Jul 2012 17:59:13 -0000
@@ -561,7 +561,7 @@
struct process_info *proc = current_process ();
switch (type)
{
- case '0':
+ case '0': /* software-breakpoint */
{
int ret;
@@ -572,11 +572,13 @@
done_accessing_memory ();
return ret;
}
- case '2':
- case '3':
- case '4':
+ case '1': /* hardware-breakpoint */
+ case '2': /* write watchpoint */
+ case '3': /* read watchpoint */
+ case '4': /* access watchpoint */
return i386_low_insert_watchpoint (&proc->private->arch_private->debug_reg_state,
type, addr, len);
+
default:
/* Unsupported. */
return 1;
@@ -589,7 +591,7 @@
struct process_info *proc = current_process ();
switch (type)
{
- case '0':
+ case '0': /* software-breakpoint */
{
int ret;
@@ -600,9 +602,10 @@
done_accessing_memory ();
return ret;
}
- case '2':
- case '3':
- case '4':
+ case '1': /* hardware-breakpoint */
+ case '2': /* write watchpoint */
+ case '3': /* read watchpoint */
+ case '4': /* access watchpoint */
return i386_low_remove_watchpoint (&proc->private->arch_private->debug_reg_state,
type, addr, len);
default: