diff options
author | emaste <emaste@FreeBSD.org> | 2015-02-09 01:44:09 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2015-02-09 01:44:09 +0000 |
commit | d61b076ede88b56f3372a55e7d1eac6a9d717120 (patch) | |
tree | a8f4b3abea3e6937e60728991c736e6e3d322fc1 /tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp | |
parent | 0c2019f4ca6b2dc6d710f6bb16a0e3ed10271531 (diff) | |
download | FreeBSD-src-d61b076ede88b56f3372a55e7d1eac6a9d717120.zip FreeBSD-src-d61b076ede88b56f3372a55e7d1eac6a9d717120.tar.gz |
Import LLDB as of upstream SVN 228549 (git 39760838)
Diffstat (limited to 'tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp')
-rw-r--r-- | tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp | 87 |
1 files changed, 45 insertions, 42 deletions
diff --git a/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp b/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp index b375611..50049e6 100644 --- a/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp +++ b/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp @@ -20,13 +20,13 @@ //-- // Third party headers: -#include <lldb/API/SBEvent.h> -#include <lldb/API/SBProcess.h> -#include <lldb/API/SBBreakpoint.h> -#include <lldb/API/SBStream.h> -#include <lldb/API/SBThread.h> -#include <lldb/API/SBCommandInterpreter.h> -#include <lldb/API/SBCommandReturnObject.h> +#include "lldb/API/SBEvent.h" +#include "lldb/API/SBProcess.h" +#include "lldb/API/SBBreakpoint.h" +#include "lldb/API/SBStream.h" +#include "lldb/API/SBThread.h" +#include "lldb/API/SBCommandInterpreter.h" +#include "lldb/API/SBCommandReturnObject.h" #ifdef _WIN32 #include <io.h> // For the ::_access() #else @@ -722,9 +722,9 @@ CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateSuspended(const lldb::SBE return MIstatus::success; bool bOk = MIstatus::success; - lldb::SBDebugger &rDebugger = CMICmnLLDBDebugSessionInfo::Instance().m_rLldbDebugger; - lldb::SBProcess &rProcess = CMICmnLLDBDebugSessionInfo::Instance().m_lldbProcess; - lldb::SBTarget target = rProcess.GetTarget(); + lldb::SBDebugger &rDebugger = CMICmnLLDBDebugSessionInfo::Instance().GetDebugger(); + lldb::SBProcess sbProcess = CMICmnLLDBDebugSessionInfo::Instance().GetProcess(); + lldb::SBTarget target = sbProcess.GetTarget(); if (rDebugger.GetSelectedTarget() == target) { if (!UpdateSelectedThread()) @@ -768,8 +768,8 @@ CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateStopped(bool &vwrbShouldB const MIchar *pEventType = ""; bool bOk = MIstatus::success; - lldb::SBProcess &rProcess = CMICmnLLDBDebugSessionInfo::Instance().m_lldbProcess; - const lldb::StopReason eStoppedReason = rProcess.GetSelectedThread().GetStopReason(); + lldb::SBProcess sbProcess = CMICmnLLDBDebugSessionInfo::Instance().GetProcess(); + const lldb::StopReason eStoppedReason = sbProcess.GetSelectedThread().GetStopReason(); switch (eStoppedReason) { case lldb::eStopReasonInvalid: @@ -807,6 +807,9 @@ CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateStopped(bool &vwrbShouldB case lldb::eStopReasonThreadExiting: pEventType = "eStopReasonThreadExiting"; break; + case lldb::eStopReasonInstrumentation: + pEventType = "eStopReasonInstrumentation"; + break; } // ToDo: Remove when finished coding application @@ -828,8 +831,8 @@ CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopSignal(bool &vwrbShouldBrk { bool bOk = MIstatus::success; - lldb::SBProcess &rProcess = CMICmnLLDBDebugSessionInfo::Instance().m_lldbProcess; - const MIuint64 nStopReason = rProcess.GetSelectedThread().GetStopReasonDataAtIndex(0); + lldb::SBProcess sbProcess = CMICmnLLDBDebugSessionInfo::Instance().GetProcess(); + const MIuint64 nStopReason = sbProcess.GetSelectedThread().GetStopReasonDataAtIndex(0); switch (nStopReason) { case 2: // Terminal interrupt signal. SIGINT @@ -865,7 +868,7 @@ CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopSignal(bool &vwrbShouldBrk const CMICmnMIValueConst miValueConst3("Segmentation fault"); const CMICmnMIValueResult miValueResult3("signal-meaning", miValueConst3); bOk = bOk && miOutOfBandRecord.Add(miValueResult3); - const CMIUtilString strThreadId(CMIUtilString::Format("%d", rProcess.GetSelectedThread().GetIndexID())); + const CMIUtilString strThreadId(CMIUtilString::Format("%d", sbProcess.GetSelectedThread().GetIndexID())); const CMICmnMIValueConst miValueConst4(strThreadId); const CMICmnMIValueResult miValueResult4("thread-id", miValueConst4); bOk = bOk && miOutOfBandRecord.Add(miValueResult4); @@ -878,12 +881,12 @@ CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopSignal(bool &vwrbShouldBrk } break; case 19: - if (rProcess.IsValid()) - rProcess.Continue(); + if (sbProcess.IsValid()) + sbProcess.Continue(); break; case 5: // Trace/breakpoint trap. SIGTRAP { - lldb::SBThread thread = rProcess.GetSelectedThread(); + lldb::SBThread thread = sbProcess.GetSelectedThread(); const MIuint nFrames = thread.GetNumFrames(); if (nFrames > 0) { @@ -896,9 +899,9 @@ CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopSignal(bool &vwrbShouldBrk if (CMIUtilString::Compare(threadCloneFn, fnName)) { - if (rProcess.IsValid()) + if (sbProcess.IsValid()) { - rProcess.Continue(); + sbProcess.Continue(); vwrbShouldBrk = true; break; } @@ -939,8 +942,8 @@ bool CMICmnLLDBDebuggerHandleEvents::MiHelpGetCurrentThreadFrame(CMICmnMIValueTuple &vwrMiValueTuple) { CMIUtilString strThreadFrame; - lldb::SBProcess &rProcess = CMICmnLLDBDebugSessionInfo::Instance().m_lldbProcess; - lldb::SBThread thread = rProcess.GetSelectedThread(); + lldb::SBProcess sbProcess = CMICmnLLDBDebugSessionInfo::Instance().GetProcess(); + lldb::SBThread thread = sbProcess.GetSelectedThread(); const MIuint nFrame = thread.GetNumFrames(); if (nFrame == 0) { @@ -994,9 +997,9 @@ CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopReasonBreakpoint(void) return MIstatus::failure; } - lldb::SBProcess &rProcess = CMICmnLLDBDebugSessionInfo::Instance().m_lldbProcess; - const MIuint64 brkPtId = rProcess.GetSelectedThread().GetStopReasonDataAtIndex(0); - lldb::SBBreakpoint brkPt = CMICmnLLDBDebugSessionInfo::Instance().m_lldbTarget.GetBreakpointAtIndex((MIuint)brkPtId); + lldb::SBProcess sbProcess = CMICmnLLDBDebugSessionInfo::Instance().GetProcess(); + const MIuint64 brkPtId = sbProcess.GetSelectedThread().GetStopReasonDataAtIndex(0); + lldb::SBBreakpoint brkPt = CMICmnLLDBDebugSessionInfo::Instance().GetTarget().GetBreakpointAtIndex((MIuint)brkPtId); return MiStoppedAtBreakPoint(brkPtId, brkPt); } @@ -1015,8 +1018,8 @@ CMICmnLLDBDebuggerHandleEvents::MiStoppedAtBreakPoint(const MIuint64 vBrkPtId, c { bool bOk = MIstatus::success; - lldb::SBProcess &rProcess = CMICmnLLDBDebugSessionInfo::Instance().m_lldbProcess; - lldb::SBThread thread = rProcess.GetSelectedThread(); + lldb::SBProcess sbProcess = CMICmnLLDBDebugSessionInfo::Instance().GetProcess(); + lldb::SBThread thread = sbProcess.GetSelectedThread(); const MIuint nFrame = thread.GetNumFrames(); if (nFrame == 0) { @@ -1078,7 +1081,7 @@ CMICmnLLDBDebuggerHandleEvents::MiStoppedAtBreakPoint(const MIuint64 vBrkPtId, c { CMICmnMIValueList miValueList(true); const MIuint maskVarTypes = CMICmnLLDBDebugSessionInfo::eVariableType_Arguments; - bOk = rSession.MIResponseFormVariableInfo2(frame, maskVarTypes, miValueList); + bOk = rSession.MIResponseFormVariableInfo2(frame, maskVarTypes, CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues, miValueList); CMICmnMIValueTuple miValueTuple; bOk = bOk && rSession.MIResponseFormFrameInfo2(pc, miValueList.GetString(), fnName, fileName, path, nLine, miValueTuple); @@ -1118,8 +1121,8 @@ bool CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopReasonTrace(void) { bool bOk = true; - lldb::SBProcess &rProcess = CMICmnLLDBDebugSessionInfo::Instance().m_lldbProcess; - lldb::SBThread thread = rProcess.GetSelectedThread(); + lldb::SBProcess sbProcess = CMICmnLLDBDebugSessionInfo::Instance().GetProcess(); + lldb::SBThread thread = sbProcess.GetSelectedThread(); const MIuint nFrame = thread.GetNumFrames(); if (nFrame == 0) { @@ -1154,7 +1157,7 @@ CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopReasonTrace(void) // Function args CMICmnMIValueList miValueList(true); const MIuint maskVarTypes = CMICmnLLDBDebugSessionInfo::eVariableType_Arguments; - if (!rSession.MIResponseFormVariableInfo2(frame, maskVarTypes, miValueList)) + if (!rSession.MIResponseFormVariableInfo2(frame, maskVarTypes, CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues, miValueList)) return MIstatus::failure; CMICmnMIValueTuple miValueTuple; if (!rSession.MIResponseFormFrameInfo2(pc, miValueList.GetString(), fnName, fileName, path, nLine, miValueTuple)) @@ -1197,7 +1200,7 @@ CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopReasonTrace(void) bool CMICmnLLDBDebuggerHandleEvents::UpdateSelectedThread(void) { - lldb::SBProcess process = CMICmnLLDBDebugSessionInfo::Instance().m_rLldbDebugger.GetSelectedTarget().GetProcess(); + lldb::SBProcess process = CMICmnLLDBDebugSessionInfo::Instance().GetDebugger().GetSelectedTarget().GetProcess(); if (!process.IsValid()) return MIstatus::success; @@ -1339,7 +1342,7 @@ CMICmnLLDBDebuggerHandleEvents::GetProcessStdout(void) char c; size_t nBytes = 0; CMIUtilString text; - lldb::SBProcess process = CMICmnLLDBDebugSessionInfo::Instance().m_rLldbDebugger.GetSelectedTarget().GetProcess(); + lldb::SBProcess process = CMICmnLLDBDebugSessionInfo::Instance().GetDebugger().GetSelectedTarget().GetProcess(); while (process.GetSTDOUT(&c, 1) > 0) { CMIUtilString str; @@ -1374,7 +1377,7 @@ CMICmnLLDBDebuggerHandleEvents::GetProcessStderr(void) char c; size_t nBytes = 0; CMIUtilString text; - lldb::SBProcess process = CMICmnLLDBDebugSessionInfo::Instance().m_rLldbDebugger.GetSelectedTarget().GetProcess(); + lldb::SBProcess process = CMICmnLLDBDebugSessionInfo::Instance().GetDebugger().GetSelectedTarget().GetProcess(); while (process.GetSTDERR(&c, 1) > 0) { CMIUtilString str; @@ -1448,22 +1451,22 @@ CMICmnLLDBDebuggerHandleEvents::ConvertPrintfCtrlCodeToString(const MIchar vCtrl bool CMICmnLLDBDebuggerHandleEvents::ChkForStateChanges(void) { - lldb::SBProcess &rProcess = CMICmnLLDBDebugSessionInfo::Instance().m_lldbProcess; - if (!rProcess.IsValid()) + lldb::SBProcess sbProcess = CMICmnLLDBDebugSessionInfo::Instance().GetProcess(); + if (!sbProcess.IsValid()) return MIstatus::success; - lldb::SBTarget &rTarget = CMICmnLLDBDebugSessionInfo::Instance().m_lldbTarget; - if (!rTarget.IsValid()) + lldb::SBTarget sbTarget = CMICmnLLDBDebugSessionInfo::Instance().GetTarget(); + if (!sbTarget.IsValid()) return MIstatus::success; bool bOk = MIstatus::success; // Check for created threads - const MIuint nThread = rProcess.GetNumThreads(); + const MIuint nThread = sbProcess.GetNumThreads(); for (MIuint i = 0; i < nThread; i++) { // GetThreadAtIndex() uses a base 0 index // GetThreadByIndexID() uses a base 1 index - lldb::SBThread thread = rProcess.GetThreadAtIndex(i); + lldb::SBThread thread = sbProcess.GetThreadAtIndex(i); if (!thread.IsValid()) continue; @@ -1500,7 +1503,7 @@ CMICmnLLDBDebuggerHandleEvents::ChkForStateChanges(void) } } - lldb::SBThread currentThread = rProcess.GetSelectedThread(); + lldb::SBThread currentThread = sbProcess.GetSelectedThread(); if (currentThread.IsValid()) { const MIuint threadId = currentThread.GetIndexID(); @@ -1523,7 +1526,7 @@ CMICmnLLDBDebuggerHandleEvents::ChkForStateChanges(void) while (it != CMICmnLLDBDebugSessionInfo::Instance().m_vecActiveThreadId.end()) { const MIuint nThreadId = *it; - lldb::SBThread thread = rProcess.GetThreadAtIndex(nThreadId); + lldb::SBThread thread = sbProcess.GetThreadAtIndex(nThreadId); if (!thread.IsValid()) { // Form MI "=thread-exited,id=\"%ld\",group-id=\"i1\"" |