summaryrefslogtreecommitdiffstats
path: root/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
diff options
context:
space:
mode:
authorIlia K <ki.stfu@gmail.com>2015-02-11 04:58:41 +0000
committerIlia K <ki.stfu@gmail.com>2015-02-11 04:58:41 +0000
commit83bdf32cf4576bb97a7d828beb25e861895fd7e0 (patch)
tree8d14d361ef223b8e179eed9892dd416323a5d7dd /lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
parent98bdc6418fccdada985cb267935db0f6eae4cf9e (diff)
downloadbcm5719-llvm-83bdf32cf4576bb97a7d828beb25e861895fd7e0.tar.gz
bcm5719-llvm-83bdf32cf4576bb97a7d828beb25e861895fd7e0.zip
Fix segfault notification in lldb-mi
Summary: This patch adds system exception handling in lldb-mi + tests. All tests pass on OS X. Reviewers: zturner, abidh, clayborg Reviewed By: clayborg Subscribers: emaste, lldb-commits, zturner, clayborg, abidh Differential Revision: http://reviews.llvm.org/D7500 llvm-svn: 228803
Diffstat (limited to 'lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp')
-rw-r--r--lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp b/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
index 56423f6a7e7..8a09be21724 100644
--- a/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
+++ b/lldb/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
@@ -796,6 +796,7 @@ CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateStopped(bool &vwrbShouldB
break;
case lldb::eStopReasonException:
pEventType = "eStopReasonException";
+ bOk = HandleProcessEventStopException();
break;
case lldb::eStopReasonExec:
pEventType = "eStopReasonExec";
@@ -935,6 +936,44 @@ CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopSignal(bool &vwrbShouldBrk
}
//++ ------------------------------------------------------------------------------------
+// Details: Asynchronous event handler for LLDB Process stop exception.
+// Type: Method.
+// Args: None.
+// Return: MIstatus::success - Functional succeeded.
+// MIstatus::failure - Functional failed.
+// Throws: None.
+//--
+bool
+CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopException(void)
+{
+ const lldb::SBProcess sbProcess = CMICmnLLDBDebugSessionInfo::Instance().GetProcess();
+ lldb::SBThread sbThread = sbProcess.GetSelectedThread();
+ const size_t nStopDescriptionLen = sbThread.GetStopDescription(nullptr, 0);
+ std::shared_ptr<char> spStopDescription(new char[nStopDescriptionLen]);
+ sbThread.GetStopDescription(spStopDescription.get(), nStopDescriptionLen);
+
+ // MI print "*stopped,reason=\"exception-received\",exception=\"%s\",thread-id=\"%d\",stopped-threads=\"all\""
+ const CMICmnMIValueConst miValueConst("exception-received");
+ const CMICmnMIValueResult miValueResult("reason", miValueConst);
+ CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_Stopped, miValueResult);
+ const CMIUtilString strReason(spStopDescription.get());
+ const CMICmnMIValueConst miValueConst2(strReason);
+ const CMICmnMIValueResult miValueResult2("exception", miValueConst2);
+ bool bOk = miOutOfBandRecord.Add(miValueResult2);
+ const CMIUtilString strThreadId(CMIUtilString::Format("%d", sbThread.GetIndexID()));
+ const CMICmnMIValueConst miValueConst3(strThreadId);
+ const CMICmnMIValueResult miValueResult3("thread-id", miValueConst3);
+ bOk = bOk && miOutOfBandRecord.Add(miValueResult3);
+ const CMICmnMIValueConst miValueConst4("all");
+ const CMICmnMIValueResult miValueResult4("stopped-threads", miValueConst4);
+ bOk = bOk && miOutOfBandRecord.Add(miValueResult4);
+ bOk = bOk && MiOutOfBandRecordToStdout(miOutOfBandRecord);
+ bOk = bOk && TextToStdout("(gdb)");
+
+ return bOk;
+}
+
+//++ ------------------------------------------------------------------------------------
// Details: Form partial MI response in a MI value tuple object.
// Type: Method.
// Args: vwrMiValueTuple - (W) MI value tuple object.
OpenPOWER on IntegriCloud