================
@@ -77,19 +77,27 @@ static void DescribeAddressBriefly(Stream &strm, const
Address &addr,
strm.Printf(".\n");
}
+std::optional<addr_t> StopInfoMachException::GetTagFaultAddress() const {
+ bool bad_access =
+ (m_value == 1 || m_value == 12); // EXC_BAD_ACCESS or EXC_GUARD
+ bool tag_fault = (m_exc_code == 0x106); // EXC_ARM_MTE_TAG_FAULT
+ bool has_fault_addr = (m_exc_data_count >= 2); // m_exc_subcode -> fault addr
+
+ if (bad_access && tag_fault && has_fault_addr)
+ return m_exc_subcode; // Fault address
+
+ return std::nullopt;
+}
+
static constexpr uint8_t g_mte_tag_shift = 64 - 8;
static constexpr addr_t g_mte_tag_mask = (addr_t)0x0f << g_mte_tag_shift;
-bool StopInfoMachException::DetermineTagMismatch(ExecutionContext &exe_ctx) {
- const bool IsBadAccess = m_value == 1; // EXC_BAD_ACCESS
- const bool IsMTETagFault = (m_exc_code == 0x106); // EXC_ARM_MTE_TAG_FAULT
- if (!IsBadAccess || !IsMTETagFault)
- return false;
-
- if (m_exc_data_count < 2)
+bool StopInfoMachException::DetermineTagMismatch() {
+ auto fault_address = GetTagFaultAddress();
----------------
JDevlieghere wrote:
The type isn't obvious from the RHS.
```suggestion
std::optional<addr_t> fault_address = GetTagFaultAddress();
```
https://github.com/llvm/llvm-project/pull/172579
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits