--- Gnu-Mach/ddb/db_watch.c 2020/09/02 04:36:57 1.1.1.1 +++ Gnu-Mach/ddb/db_watch.c 2020/09/02 04:45:49 1.1.1.3 @@ -1,25 +1,25 @@ -/* +/* * Mach Operating System * Copyright (c) 1991,1990 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ @@ -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; @@ -202,7 +206,7 @@ db_get_task(modif, taskp, addr) } } if (!DB_VALID_ADDRESS(addr, user_space)) { - db_printf("Address %#X is not in %s space\n", addr, + db_printf("Address %#X is not in %s space\n", addr, (user_space)? "user": "kernel"); return(-1); } @@ -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; } @@ -315,4 +329,4 @@ db_find_watchpoint(map, addr, regs) return (FALSE); } -#endif MACH_KDB +#endif /* MACH_KDB */