aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--riscv/execute.cc6
-rw-r--r--riscv/triggers.cc6
-rw-r--r--riscv/triggers.h2
3 files changed, 7 insertions, 7 deletions
diff --git a/riscv/execute.cc b/riscv/execute.cc
index 1426d2d..3c627a4 100644
--- a/riscv/execute.cc
+++ b/riscv/execute.cc
@@ -302,9 +302,9 @@ void processor_t::step(size_t n)
n = instret;
// Trigger action takes priority over single step
- triggers::match_result_t match = TM.detect_trap_match(t);
- if (match.fire)
- take_trigger_action(match.action, 0, state.pc);
+ auto match = TM.detect_trap_match(t);
+ if (match.has_value())
+ take_trigger_action(match->action, 0, state.pc);
else if (unlikely(state.single_step == state.STEP_STEPPED)) {
state.single_step = state.STEP_NONE;
enter_debug_mode(DCSR_CAUSE_STEP);
diff --git a/riscv/triggers.cc b/riscv/triggers.cc
index 073ea58..0839acf 100644
--- a/riscv/triggers.cc
+++ b/riscv/triggers.cc
@@ -360,18 +360,18 @@ std::optional<match_result_t> module_t::detect_memory_access_match(operation_t o
return std::nullopt;
}
-match_result_t module_t::detect_trap_match(const trap_t& t) noexcept
+std::optional<match_result_t> module_t::detect_trap_match(const trap_t& t) noexcept
{
state_t * const state = proc->get_state();
if (state->debug_mode)
- return match_result_t(false);
+ return std::nullopt;
for (auto trigger: triggers) {
match_result_t result = trigger->detect_trap_match(proc, t);
if (result.fire)
return result;
}
- return match_result_t(false);
+ return std::nullopt;
}
reg_t module_t::tinfo_read(UNUSED const processor_t * const proc, unsigned UNUSED index) const noexcept
diff --git a/riscv/triggers.h b/riscv/triggers.h
index 365dbe2..a782acc 100644
--- a/riscv/triggers.h
+++ b/riscv/triggers.h
@@ -187,7 +187,7 @@ public:
unsigned count() const { return triggers.size(); }
std::optional<match_result_t> detect_memory_access_match(operation_t operation, reg_t address, std::optional<reg_t> data) noexcept;
- match_result_t detect_trap_match(const trap_t& t) noexcept;
+ std::optional<match_result_t> detect_trap_match(const trap_t& t) noexcept;
processor_t *proc;
private: