Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156744610
D29173.id85440.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D29173.id85440.diff
View Options
Index: sys/conf/files.arm
===================================================================
--- sys/conf/files.arm
+++ sys/conf/files.arm
@@ -19,8 +19,7 @@
arm/arm/db_disasm.c optional ddb
arm/arm/db_interface.c optional ddb
arm/arm/db_trace.c optional ddb
-arm/arm/debug_monitor.c optional ddb armv6
-arm/arm/debug_monitor.c optional ddb armv7
+arm/arm/debug_monitor.c optional ddb | gdb
arm/arm/disassem.c optional ddb
arm/arm/dump_machdep.c standard
arm/arm/elf_machdep.c standard
Index: sys/conf/files.x86
===================================================================
--- sys/conf/files.x86
+++ sys/conf/files.x86
@@ -320,7 +320,7 @@
x86/x86/busdma_bounce.c standard
x86/x86/busdma_machdep.c standard
x86/x86/cpu_machdep.c standard
-x86/x86/dbreg.c optional ddb
+x86/x86/dbreg.c optional ddb | gdb
x86/x86/dump_machdep.c standard
x86/x86/fdt_machdep.c optional fdt
x86/x86/identcpu.c standard
Index: sys/gdb/gdb_main.c
===================================================================
--- sys/gdb/gdb_main.c
+++ sys/gdb/gdb_main.c
@@ -618,6 +618,104 @@
#endif
}
+/*
+ * Handle a 'Z' packet: set a breakpoint or watchpoint.
+ *
+ * Currently, only watchpoints are supported.
+ */
+static void
+gdb_z_insert(void)
+{
+ intmax_t addr, length;
+ char ztype;
+ int error;
+
+ ztype = gdb_rx_char();
+ if (gdb_rx_char() != ',' || gdb_rx_varhex(&addr) ||
+ gdb_rx_char() != ',' || gdb_rx_varhex(&length)) {
+ error = EINVAL;
+ goto fail;
+ }
+
+ switch (ztype) {
+ case '2': /* write watchpoint */
+ error = kdb_cpu_set_watchpoint((vm_offset_t)addr,
+ (vm_size_t)length, KDB_DBG_ACCESS_W);
+ if (error != 0)
+ goto fail;
+ break;
+ case '3': /* read watchpoint */
+ error = kdb_cpu_set_watchpoint((vm_offset_t)addr,
+ (vm_size_t)length, KDB_DBG_ACCESS_R);
+ if (error != 0)
+ goto fail;
+ break;
+ case '4': /* access (RW) watchpoint */
+ error = kdb_cpu_set_watchpoint((vm_offset_t)addr,
+ (vm_size_t)length, KDB_DBG_ACCESS_RW);
+ if (error != 0)
+ goto fail;
+ break;
+ case '1': /* hardware breakpoint */
+ case '0': /* software breakpoint */
+ /* Not implemented. */
+ gdb_tx_empty();
+ return;
+ default:
+ error = EINVAL;
+ goto fail;
+ }
+ gdb_tx_ok();
+ return;
+fail:
+ gdb_tx_err(error);
+ return;
+}
+
+/*
+ * Handle a 'z' packet; clear a breakpoint or watchpoint.
+ *
+ * Currently, only watchpoints are supported.
+ */
+static void
+gdb_z_remove(void)
+{
+ intmax_t addr, length;
+ char ztype;
+ int error;
+
+ ztype = gdb_rx_char();
+ if (gdb_rx_char() != ',' || gdb_rx_varhex(&addr) ||
+ gdb_rx_char() != ',' || gdb_rx_varhex(&length)) {
+ error = EINVAL;
+ goto fail;
+ }
+
+ switch (ztype) {
+ case '2': /* write watchpoint */
+ case '3': /* read watchpoint */
+ case '4': /* access (RW) watchpoint */
+ error = kdb_cpu_clr_watchpoint((vm_offset_t)addr,
+ (vm_size_t)length);
+ if (error != 0)
+ goto fail;
+ break;
+ case '1': /* hardware breakpoint */
+ case '0': /* software breakpoint */
+ /* Not implemented. */
+ gdb_tx_empty();
+ return;
+ default:
+ error = EINVAL;
+ goto fail;
+ }
+ gdb_tx_ok();
+ return;
+fail:
+ gdb_tx_err(error);
+ return;
+}
+
static int
gdb_trap(int type, int code)
{
@@ -868,6 +966,14 @@
gdb_tx_err(ENOENT);
break;
}
+ case 'z': { /* Remove watchpoint. */
+ gdb_z_remove();
+ break;
+ }
+ case 'Z': { /* Set watchpoint. */
+ gdb_z_insert();
+ break;
+ }
case EOF:
/* Empty command. Treat as unknown command. */
/* FALLTHROUGH */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 17, 1:47 AM (19 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33165976
Default Alt Text
D29173.id85440.diff (3 KB)
Attached To
Mode
D29173: gdb: allow setting/removing hardware watchpoints
Attached
Detach File
Event Timeline
Log In to Comment