Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F101969571
D29156.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D29156.diff
View Options
diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c
--- a/sys/amd64/amd64/db_trace.c
+++ b/sys/amd64/amd64/db_trace.c
@@ -385,21 +385,6 @@
ctx->pcb_rip, ctx->pcb_rsp, count));
}
-int
-db_md_set_watchpoint(db_expr_t addr, db_expr_t size)
-{
-
- return (dbreg_set_watchpoint((vm_offset_t)addr, (vm_size_t)size,
- DBREG_DR7_WRONLY));
-}
-
-int
-db_md_clr_watchpoint(db_expr_t addr, db_expr_t size)
-{
-
- return (dbreg_clr_watchpoint((vm_offset_t)addr, (vm_size_t)size));
-}
-
void
db_md_list_watchpoints(void)
{
diff --git a/sys/arm/arm/db_trace.c b/sys/arm/arm/db_trace.c
--- a/sys/arm/arm/db_trace.c
+++ b/sys/arm/arm/db_trace.c
@@ -134,20 +134,6 @@
dbg_show_watchpoint();
}
-int
-db_md_clr_watchpoint(db_expr_t addr, db_expr_t size)
-{
-
- return (dbg_remove_watchpoint(addr, size));
-}
-
-int
-db_md_set_watchpoint(db_expr_t addr, db_expr_t size)
-{
-
- return (dbg_setup_watchpoint(addr, size, HW_WATCHPOINT_RW));
-}
-
int
db_trace_thread(struct thread *thr, int count)
{
diff --git a/sys/arm64/arm64/db_trace.c b/sys/arm64/arm64/db_trace.c
--- a/sys/arm64/arm64/db_trace.c
+++ b/sys/arm64/arm64/db_trace.c
@@ -57,20 +57,6 @@
dbg_show_watchpoint();
}
-int
-db_md_clr_watchpoint(db_expr_t addr, db_expr_t size)
-{
-
- return (dbg_remove_watchpoint(NULL, addr, size));
-}
-
-int
-db_md_set_watchpoint(db_expr_t addr, db_expr_t size)
-{
-
- return (dbg_setup_watchpoint(NULL, addr, size, HW_BREAKPOINT_RW));
-}
-
static void
db_stack_trace_cmd(struct thread *td, struct unwind_state *frame)
{
diff --git a/sys/ddb/db_watch.c b/sys/ddb/db_watch.c
--- a/sys/ddb/db_watch.c
+++ b/sys/ddb/db_watch.c
@@ -34,6 +34,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/proc.h>
@@ -42,6 +43,8 @@
#include <vm/pmap.h>
#include <vm/vm_map.h>
+#include <machine/kdb.h>
+
#include <ddb/ddb.h>
#include <ddb/db_watch.h>
@@ -278,33 +281,57 @@
#endif
/* Delete hardware watchpoint */
-/*ARGSUSED*/
void
-db_deletehwatch_cmd(db_expr_t addr, bool have_addr, db_expr_t count,
+db_deletehwatch_cmd(db_expr_t addr, bool have_addr, db_expr_t size,
char *modif)
{
int rc;
- if (count < 0)
- count = 4;
-
- rc = db_md_clr_watchpoint(addr, count);
- if (rc < 0)
- db_printf("hardware watchpoint could not be deleted\n");
+ if (size < 0)
+ size = 4;
+
+ rc = kdb_cpu_clr_watchpoint((vm_offset_t)addr, (vm_size_t)size);
+ switch (rc) {
+ case ENXIO:
+ /* Not supported, ignored. */
+ break;
+ case EINVAL:
+ db_printf("Invalid watchpoint address or size.\n");
+ break;
+ default:
+ if (rc != 0)
+ db_printf("Hardware watchpoint could not be deleted, "
+ "status=%d\n", rc);
+ break;
+ }
}
/* Set hardware watchpoint */
-/*ARGSUSED*/
void
-db_hwatchpoint_cmd(db_expr_t addr, bool have_addr, db_expr_t count,
+db_hwatchpoint_cmd(db_expr_t addr, bool have_addr, db_expr_t size,
char *modif)
{
int rc;
- if (count < 0)
- count = 4;
-
- rc = db_md_set_watchpoint(addr, count);
- if (rc < 0)
- db_printf("hardware watchpoint could not be set\n");
+ if (size < 0)
+ size = 4;
+
+ rc = kdb_cpu_set_watchpoint((vm_offset_t)addr, (vm_size_t)size,
+ KDB_DBG_ACCESS_W);
+
+ switch (rc) {
+ case EINVAL:
+ db_printf("Invalid watchpoint size or address.\n");
+ break;
+ case EBUSY:
+ db_printf("No hardware watchpoints available.\n");
+ break;
+ case ENXIO:
+ db_printf("Hardware watchpoints are not supported on this platform.\n");
+ break;
+ default:
+ if (rc != 0)
+ db_printf("Could not set hardware watchpoint, "
+ "status=%d\n", rc);
+ }
}
diff --git a/sys/ddb/ddb.h b/sys/ddb/ddb.h
--- a/sys/ddb/ddb.h
+++ b/sys/ddb/ddb.h
@@ -205,8 +205,6 @@
struct vm_map *db_map_addr(vm_offset_t);
bool db_map_current(struct vm_map *);
bool db_map_equal(struct vm_map *, struct vm_map *);
-int db_md_set_watchpoint(db_expr_t addr, db_expr_t size);
-int db_md_clr_watchpoint(db_expr_t addr, db_expr_t size);
void db_md_list_watchpoints(void);
void db_print_loc_and_inst(db_addr_t loc);
void db_print_thread(void);
diff --git a/sys/i386/i386/db_trace.c b/sys/i386/i386/db_trace.c
--- a/sys/i386/i386/db_trace.c
+++ b/sys/i386/i386/db_trace.c
@@ -612,20 +612,6 @@
ctx->pcb_eip, ctx->pcb_esp, count));
}
-int
-db_md_set_watchpoint(db_expr_t addr, db_expr_t size)
-{
-
- return (dbreg_set_watchpoint((vm_offset_t)addr, (vm_size_t)size));
-}
-
-int
-db_md_clr_watchpoint(db_expr_t addr, db_expr_t size)
-{
-
- return (dbreg_clr_watchpoint((vm_offset_t)addr, (vm_size_t)size));
-}
-
void
db_md_list_watchpoints(void)
{
diff --git a/sys/mips/mips/db_trace.c b/sys/mips/mips/db_trace.c
--- a/sys/mips/mips/db_trace.c
+++ b/sys/mips/mips/db_trace.c
@@ -395,20 +395,6 @@
}
}
-int
-db_md_set_watchpoint(db_expr_t addr, db_expr_t size)
-{
-
- return(0);
-}
-
-int
-db_md_clr_watchpoint(db_expr_t addr, db_expr_t size)
-{
-
- return(0);
-}
-
void
db_md_list_watchpoints()
{
diff --git a/sys/powerpc/powerpc/db_hwwatch.c b/sys/powerpc/powerpc/db_hwwatch.c
--- a/sys/powerpc/powerpc/db_hwwatch.c
+++ b/sys/powerpc/powerpc/db_hwwatch.c
@@ -36,20 +36,6 @@
#include <ddb/db_variables.h>
#include <ddb/db_watch.h>
-int
-db_md_set_watchpoint(db_expr_t addr, db_expr_t size)
-{
-
- return (0);
-}
-
-int
-db_md_clr_watchpoint(db_expr_t addr, db_expr_t size)
-{
-
- return (0);
-}
-
void
db_md_list_watchpoints(void)
{
diff --git a/sys/riscv/riscv/db_trace.c b/sys/riscv/riscv/db_trace.c
--- a/sys/riscv/riscv/db_trace.c
+++ b/sys/riscv/riscv/db_trace.c
@@ -58,20 +58,6 @@
}
-int
-db_md_clr_watchpoint(db_expr_t addr, db_expr_t size)
-{
-
- return (0);
-}
-
-int
-db_md_set_watchpoint(db_expr_t addr, db_expr_t size)
-{
-
- return (0);
-}
-
static void
db_stack_trace_cmd(struct thread *td, struct unwind_state *frame)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 6, 11:11 PM (21 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14501510
Default Alt Text
D29156.diff (5 KB)
Attached To
Mode
D29156: ddb: replace watchpoint set/clear functions
Attached
Detach File
Event Timeline
Log In to Comment