trigger_common_match() has some warning log messages in it for
unsupported triggers. Don't call it in BP/WP checking except for
mcontrol/mcontrol6 triggers applicable to BP/WPs.

Signed-off-by: Nicholas Piggin <[email protected]>
---
 target/riscv/debug.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/target/riscv/debug.c b/target/riscv/debug.c
index 5664466749..4273ab7a8d 100644
--- a/target/riscv/debug.c
+++ b/target/riscv/debug.c
@@ -952,6 +952,14 @@ bool riscv_cpu_debug_check_breakpoint(CPUState *cs)
         for (i = 0; i < RV_MAX_TRIGGERS; i++) {
             trigger_type = get_trigger_type(env, i);
 
+            switch (trigger_type) {
+            case TRIGGER_TYPE_AD_MATCH:
+            case TRIGGER_TYPE_AD_MATCH6:
+                break;
+            default:
+                continue; /* No other types match breakpoint */
+            }
+
             if (!trigger_common_match(env, trigger_type, i)) {
                 continue;
             }
@@ -976,8 +984,7 @@ bool riscv_cpu_debug_check_breakpoint(CPUState *cs)
                 }
                 break;
             default:
-                /* other trigger types are not supported or irrelevant */
-                break;
+                g_assert_not_reached();
             }
         }
     }
@@ -998,6 +1005,14 @@ bool riscv_cpu_debug_check_watchpoint(CPUState *cs, 
CPUWatchpoint *wp)
     for (i = 0; i < RV_MAX_TRIGGERS; i++) {
         trigger_type = get_trigger_type(env, i);
 
+        switch (trigger_type) {
+        case TRIGGER_TYPE_AD_MATCH:
+        case TRIGGER_TYPE_AD_MATCH6:
+            break;
+        default:
+            continue; /* No other types match watchpoint */
+        }
+
         if (!trigger_common_match(env, trigger_type, i)) {
             continue;
         }
@@ -1036,8 +1051,7 @@ bool riscv_cpu_debug_check_watchpoint(CPUState *cs, 
CPUWatchpoint *wp)
             }
             break;
         default:
-            /* other trigger types are not supported */
-            break;
+            g_assert_not_reached();
         }
     }
 
-- 
2.51.0


Reply via email to