aboutsummaryrefslogtreecommitdiff
path: root/riscv/triggers.cc
diff options
context:
space:
mode:
authorYenHaoChen <howard25336284@gmail.com>2023-01-16 21:07:47 +0800
committerYenHaoChen <howard25336284@gmail.com>2023-01-30 21:15:15 +0800
commit4fb1389b17ee42452bb5d9dbf0118ec8f73518d2 (patch)
treed3fad925d454b083c67c4a5564b7314b12448544 /riscv/triggers.cc
parent46b4fd7177324fd82ccbb260b76ed2b1333ea564 (diff)
downloadriscv-isa-sim-4fb1389b17ee42452bb5d9dbf0118ec8f73518d2.zip
riscv-isa-sim-4fb1389b17ee42452bb5d9dbf0118ec8f73518d2.tar.gz
riscv-isa-sim-4fb1389b17ee42452bb5d9dbf0118ec8f73518d2.tar.bz2
triggers: if match triggers with both breakpoint exception and entering D-mode, then enter D-mode and ignore breakpoint exception
Diffstat (limited to 'riscv/triggers.cc')
-rw-r--r--riscv/triggers.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/riscv/triggers.cc b/riscv/triggers.cc
index 8397cb6..13c1a58 100644
--- a/riscv/triggers.cc
+++ b/riscv/triggers.cc
@@ -474,6 +474,7 @@ std::optional<match_result_t> module_t::detect_memory_access_match(operation_t o
bool chain_ok = true;
+ std::optional<match_result_t> ret = std::nullopt;
for (auto trigger: triggers) {
if (!chain_ok) {
chain_ok = !trigger->get_chain();
@@ -487,12 +488,12 @@ std::optional<match_result_t> module_t::detect_memory_access_match(operation_t o
* trigger in the chain will never get `hit` set unless the entire chain
* matches. */
auto result = trigger->detect_memory_access_match(proc, operation, address, data);
- if (result.has_value() && !trigger->get_chain())
- return result;
+ if (result.has_value() && !trigger->get_chain() && (!ret.has_value() || ret->action < result->action))
+ ret = result;
chain_ok = result.has_value() || !trigger->get_chain();
}
- return std::nullopt;
+ return ret;
}
std::optional<match_result_t> module_t::detect_trap_match(const trap_t& t) noexcept
@@ -501,12 +502,13 @@ std::optional<match_result_t> module_t::detect_trap_match(const trap_t& t) noexc
if (state->debug_mode)
return std::nullopt;
+ std::optional<match_result_t> ret = std::nullopt;
for (auto trigger: triggers) {
auto result = trigger->detect_trap_match(proc, t);
- if (result.has_value())
- return result;
+ if (result.has_value() && (!ret.has_value() || ret->action < result->action))
+ ret = result;
}
- return std::nullopt;
+ return ret;
}
reg_t module_t::tinfo_read(unsigned UNUSED index) const noexcept