[Lldb-commits] [PATCH] D25362: Fix build failure on lldb-amd64-ninja-freebsd11 error caused by rL283474
Valentina Giusti via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 7 03:59:37 PDT 2016
valentinagiusti created this revision.
valentinagiusti added reviewers: zturner, labath.
valentinagiusti added subscribers: lldb-commits, emaste.
https://reviews.llvm.org/D25362
Files:
source/Plugins/Process/POSIX/CrashReason.cpp
source/Plugins/Process/POSIX/CrashReason.h
Index: source/Plugins/Process/POSIX/CrashReason.h
===================================================================
--- source/Plugins/Process/POSIX/CrashReason.h
+++ source/Plugins/Process/POSIX/CrashReason.h
@@ -50,6 +50,7 @@
eFloatSubscriptRange
};
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr);
std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info);
const char *CrashReasonAsString(CrashReason reason);
Index: source/Plugins/Process/POSIX/CrashReason.cpp
===================================================================
--- source/Plugins/Process/POSIX/CrashReason.cpp
+++ source/Plugins/Process/POSIX/CrashReason.cpp
@@ -136,27 +136,40 @@
std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info) {
std::string str;
+ if (reason == CrashReason::eBoundViolation) {
+// make sure that siginfo_t has the bound fields available.
+#if defined(si_lower) && defined(si_upper)
+ str = "signal SIGSEGV";
+ AppendBounds(str, reinterpret_cast<lldb::addr_t>(info.si_lower),
+ reinterpret_cast<lldb::addr_t>(info.si_upper),
+ reinterpret_cast<lldb::addr_t>(info.si_addr));
+#else
+ str = GetCrashReasonString(reason, reinterpret_cast<lldb::addr_t>(info.si_addr));
+#endif
+ } else {
+ str = GetCrashReasonString(reason, reinterpret_cast<lldb::addr_t>(info.si_addr));
+ }
+ return str;
+}
+
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr) {
+ std::string str;
+
switch (reason) {
default:
assert(false && "invalid CrashReason");
break;
case CrashReason::eInvalidAddress:
str = "signal SIGSEGV: invalid address";
- AppendFaultAddr(str, reinterpret_cast<lldb::addr_t>(info.si_addr));
+ AppendFaultAddr(str, fault_addr);
break;
case CrashReason::ePrivilegedAddress:
str = "signal SIGSEGV: address access protected";
- AppendFaultAddr(str, reinterpret_cast<lldb::addr_t>(info.si_addr));
+ AppendFaultAddr(str, fault_addr);
break;
case CrashReason::eBoundViolation:
- str = "signal SIGSEGV";
-// Make sure that siginfo_t has the bound fields available.
-#if defined(si_lower) && defined(si_upper)
- AppendBounds(str, reinterpret_cast<lldb::addr_t>(info.si_lower),
- reinterpret_cast<lldb::addr_t>(info.si_upper),
- reinterpret_cast<lldb::addr_t>(info.si_addr));
-#endif
+ str = "signal SIGSEGV: bound violation";
break;
case CrashReason::eIllegalOpcode:
str = "signal SIGILL: illegal instruction";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25362.73905.patch
Type: text/x-patch
Size: 2587 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20161007/a8cf3b4c/attachment.bin>
More information about the lldb-commits
mailing list