--- Gnu-Mach/ddb/db_watch.c 2020/09/02 04:43:17 1.1.1.2 +++ Gnu-Mach/ddb/db_watch.c 2020/09/02 04:45:49 1.1.1.3 @@ -28,7 +28,6 @@ * Date: 10/90 */ -#include "mach_kdb.h" #if MACH_KDB #include @@ -38,9 +37,14 @@ #include #include +#include +#include #include #include #include +#include +#include +#include #include #include @@ -147,7 +151,7 @@ db_delete_watchpoint(task, addr) } void -db_list_watchpoints() +db_list_watchpoints(void) { register db_watchpoint_t watch; int task_id; @@ -257,13 +261,18 @@ db_listwatch_cmd() } void -db_set_watchpoints() +db_set_watchpoints(void) { register db_watchpoint_t watch; vm_map_t map; + unsigned hw_idx = 0; if (!db_watchpoints_inserted) { for (watch = db_watchpoint_list; watch != 0; watch = watch->link) { + if (db_set_hw_watchpoint(watch, hw_idx)) { + hw_idx++; + continue; + } map = (watch->task)? watch->task->map: kernel_map; pmap_protect(map->pmap, trunc_page(watch->loaddr), @@ -275,8 +284,13 @@ db_set_watchpoints() } void -db_clear_watchpoints() +db_clear_watchpoints(void) { + unsigned hw_idx = 0; + + while (db_clear_hw_watchpoint(hw_idx)) + hw_idx++; + db_watchpoints_inserted = FALSE; }