From af38530ee29c285f3827e33a41edf27c9c3a6767 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Thu, 9 Mar 2023 14:32:52 +0000 Subject: [lldb] Refactor CrashReason So that there is only one function that NativeThreads call, which takes a siginfo. Everything else is an internal detail. Reviewed By: labath, JDevlieghere Differential Revision: https://reviews.llvm.org/D146043 --- lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp') diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp index 9b9dfe521460..b62e9f643fa7 100644 --- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp @@ -294,19 +294,19 @@ void NativeThreadLinux::SetStoppedBySignal(uint32_t signo, case SIGBUS: case SIGFPE: case SIGILL: - const auto reason = GetCrashReason(*info); - m_stop_description = GetCrashReasonString(reason, *info); - - if (reason == CrashReason::eSyncTagCheckFault) { - AnnotateSyncTagCheckFault(info); - } - + m_stop_description = GetCrashReasonString(*info); +#ifndef SEGV_MTESERR +#define SEGV_MTESERR 9 +#endif + if (info->si_signo == SIGSEGV && info->si_code == SEGV_MTESERR) + AnnotateSyncTagCheckFault( + reinterpret_cast(info->si_addr)); break; } } } -void NativeThreadLinux::AnnotateSyncTagCheckFault(const siginfo_t *info) { +void NativeThreadLinux::AnnotateSyncTagCheckFault(lldb::addr_t fault_addr) { int32_t allocation_tag_type = 0; switch (GetProcess().GetArchitecture().GetMachine()) { // aarch64_32 deliberately not here because there's no 32 bit MTE @@ -331,7 +331,6 @@ void NativeThreadLinux::AnnotateSyncTagCheckFault(const siginfo_t *info) { m_stop_description.pop_back(); std::stringstream ss; - lldb::addr_t fault_addr = reinterpret_cast(info->si_addr); std::unique_ptr manager(std::move(details->manager)); ss << " logical tag: 0x" << std::hex << manager->GetLogicalTag(fault_addr); -- cgit v1.2.3