diff options
author | bsd <bsd@FreeBSD.org> | 2001-07-11 03:15:25 +0000 |
---|---|---|
committer | bsd <bsd@FreeBSD.org> | 2001-07-11 03:15:25 +0000 |
commit | 17eb1bfcbf757a1739adfbf5d0fb91b10212a882 (patch) | |
tree | 52fdc5e25b5fc104fbb4ec3a396a3c44576aff14 /sys/ddb/db_watch.c | |
parent | 0d42a4ee81d7081c6b0b32ccde9c7a4ec2b90f50 (diff) | |
download | FreeBSD-src-17eb1bfcbf757a1739adfbf5d0fb91b10212a882.zip FreeBSD-src-17eb1bfcbf757a1739adfbf5d0fb91b10212a882.tar.gz |
Add 'hwatch' and 'dhwatch' ddb commands analogous to 'watch' and
'dwatch'. The new commands install hardware watchpoints if supported
by the architecture and if there are enough registers to cover the
desired memory area.
No objection by: audit@, hackers@
MFC after: 2 weeks
Diffstat (limited to 'sys/ddb/db_watch.c')
-rw-r--r-- | sys/ddb/db_watch.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/sys/ddb/db_watch.c b/sys/ddb/db_watch.c index 079013a..abfb853 100644 --- a/sys/ddb/db_watch.c +++ b/sys/ddb/db_watch.c @@ -67,6 +67,10 @@ static void db_list_watchpoints __P((void)); static void db_set_watchpoint __P((vm_map_t map, db_addr_t addr, vm_size_t size)); +int db_md_set_watchpoint __P((db_expr_t addr, db_expr_t size)); +int db_md_clr_watchpoint __P((db_expr_t addr, db_expr_t size)); +void db_md_list_watchpoints __P((void)); + db_watchpoint_t db_watchpoint_alloc() @@ -220,6 +224,7 @@ db_watchpoint_cmd(addr, have_addr, count, modif) DB_SHOW_COMMAND(watches, db_listwatch_cmd) { db_list_watchpoints(); + db_md_list_watchpoints(); } void @@ -282,3 +287,43 @@ db_find_watchpoint(map, addr, regs) return (FALSE); } #endif + + + +/* Delete hardware watchpoint */ +/*ARGSUSED*/ +void +db_deletehwatch_cmd(addr, have_addr, count, modif) + db_expr_t addr; + boolean_t have_addr; + db_expr_t count; + 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"); +} + +/* Set hardware watchpoint */ +/*ARGSUSED*/ +void +db_hwatchpoint_cmd(addr, have_addr, count, modif) + db_expr_t addr; + boolean_t have_addr; + db_expr_t count; + 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"); +} |