Flags must watch reads, writes, or both.
Flags must specify GDB or CPU but not both.
Flags must not contain extraneous bits.

Signed-off-by: Richard Henderson <[email protected]>
---
 system/watchpoint.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/system/watchpoint.c b/system/watchpoint.c
index 183b194403..fbaebba7cf 100644
--- a/system/watchpoint.c
+++ b/system/watchpoint.c
@@ -33,6 +33,9 @@ CPUWatchpoint *cpu_watchpoint_insert(CPUState *cpu, vaddr 
addr, vaddr len,
 
     assert(len != 0);
     assert(last >= addr);
+    assert(flags & BP_MEM_ACCESS);
+    assert(ctpop32(flags & BP_ANY) == 1);
+    assert(!(flags & ~(BP_ANY | BP_MEM_ACCESS | BP_STOP_BEFORE_ACCESS)));
 
     wp = g_new0(CPUWatchpoint, 1);
 
-- 
2.43.0


Reply via email to