Hi abidh, clayborg,
This patch fixes execution of CLI commands in MI mode. The CLI commands are
executed using "-interpreter-exec" command. The bug was in the
CMICmnLLDBDebugSessionInfo class which contained the following members:
SBProcess, SBTarget, SBDebugger and SBListener, but CLI commands don't affect
to them and they aren't updated. Therefore some members can contain incorrect
(or obsolete) reference and it can cause an error. My patch removes these
members and uses getters that provides the updated instance every time it is
used.
For example (before fix):
```
$ bin/lldb-mi --interpreter
(gdb)
-interpreter-exec command "target create ~/p/hello"
Current executable set to '~/p/hello' (x86_64).
Current executable set to '~/p/hello' (x86_64).
^done
-break-insert -f main
^done,bkpt={number="0",type="breakpoint",disp="keep",enabled="y",addr="0xffffffff",func="??",file="??",fullname="??/??",line="0",pending=["main"],times="0",original-location="main"}
-exec-run
^error,msg="Command 'exec-run'. Invalid process during debug session"
```
As I said, my patch fixes this example (and many others):
```
$ bin/lldb-mi --interpreter
(gdb)
-interpreter-exec command "target create ~/p/hello"
Current executable set to '~/p/hello' (x86_64).
Current executable set to '~/p/hello' (x86_64).
^done
-break-insert -f main
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0xffffffff",func="main",file="hello.cpp",fullname="/Users/IliaK/p/hello.cpp",line="4",pending=["main"],times="0",original-location="main"}
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0xffffffff",func="main",file="hello.cpp",fullname="/Users/IliaK/p/hello.cpp",line="4",pending=["main"],times="1",original-location="main"}
-exec-run
^running
=thread-group-started,id="i1",pid="56624"
=thread-created,id="1",group-id="i1"
=thread-selected,id="1"
(gdb)
*running,thread-id="all"
(gdb)
(gdb)
*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x1036d6e74",func="main",args=[{name="argc",value="1"},{name="argv",value="0x00007fff5c529f28"}],file="hello.cpp",fullname="/Users//IliaK/p/hello.cpp",line="4"},thread-id="1",stopped-threads="all"
(gdb)
quit
MI: Program exited OK
```
REPOSITORY
rL LLVM
http://reviews.llvm.org/D7357
Files:
tools/lldb-mi/MICmdCmdBreak.cpp
tools/lldb-mi/MICmdCmdData.cpp
tools/lldb-mi/MICmdCmdData.h
tools/lldb-mi/MICmdCmdExec.cpp
tools/lldb-mi/MICmdCmdFile.cpp
tools/lldb-mi/MICmdCmdGdbInfo.cpp
tools/lldb-mi/MICmdCmdMiscellanous.cpp
tools/lldb-mi/MICmdCmdStack.cpp
tools/lldb-mi/MICmdCmdTarget.cpp
tools/lldb-mi/MICmdCmdThread.cpp
tools/lldb-mi/MICmdCmdVar.cpp
tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
tools/lldb-mi/MICmnLLDBDebugSessionInfo.h
tools/lldb-mi/MICmnLLDBDebugger.cpp
tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
tools/lldb-mi/MICmnLLDBProxySBValue.cpp
tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
Index: tools/lldb-mi/MICmdCmdBreak.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdBreak.cpp
+++ tools/lldb-mi/MICmdCmdBreak.cpp
@@ -232,20 +232,20 @@
// Ask LLDB to create a breakpoint
bool bOk = MIstatus::success;
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBTarget &rTarget = rSessionInfo.m_lldbTarget;
+ lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
switch (eBrkPtType)
{
case eBreakPoint_ByAddress:
- m_brkPt = rTarget.BreakpointCreateByAddress(nAddress);
+ m_brkPt = sbTarget.BreakpointCreateByAddress(nAddress);
break;
case eBreakPoint_ByFileFn:
- m_brkPt = rTarget.BreakpointCreateByName(strFileFn.c_str(), fileName.c_str());
+ m_brkPt = sbTarget.BreakpointCreateByName(strFileFn.c_str(), fileName.c_str());
break;
case eBreakPoint_ByFileLine:
- m_brkPt = rTarget.BreakpointCreateByLocation(fileName.c_str(), nFileLine);
+ m_brkPt = sbTarget.BreakpointCreateByLocation(fileName.c_str(), nFileLine);
break;
case eBreakPoint_ByName:
- m_brkPt = rTarget.BreakpointCreateByName(m_brkName.c_str(), rTarget.GetExecutable().GetFilename());
+ m_brkPt = sbTarget.BreakpointCreateByName(m_brkName.c_str(), sbTarget.GetExecutable().GetFilename());
break;
case eBreakPoint_count:
case eBreakPoint_NotDefineYet:
@@ -440,7 +440,7 @@
}
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- const bool bBrkPt = rSessionInfo.m_lldbTarget.BreakpointDelete(static_cast<lldb::break_id_t>(nBrk));
+ const bool bBrkPt = rSessionInfo.GetTarget().BreakpointDelete(static_cast<lldb::break_id_t>(nBrk));
if (!bBrkPt)
{
const CMIUtilString strBrkNum(CMIUtilString::Format("%d", nBrk));
@@ -560,7 +560,7 @@
}
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBBreakpoint brkPt = rSessionInfo.m_lldbTarget.FindBreakpointByID(static_cast<lldb::break_id_t>(nBrk));
+ lldb::SBBreakpoint brkPt = rSessionInfo.GetTarget().FindBreakpointByID(static_cast<lldb::break_id_t>(nBrk));
if (brkPt.IsValid())
{
m_bBrkPtDisabledOk = true;
@@ -700,7 +700,7 @@
}
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBBreakpoint brkPt = rSessionInfo.m_lldbTarget.FindBreakpointByID(static_cast<lldb::break_id_t>(nBrk));
+ lldb::SBBreakpoint brkPt = rSessionInfo.GetTarget().FindBreakpointByID(static_cast<lldb::break_id_t>(nBrk));
if (brkPt.IsValid())
{
m_bBrkPtEnabledOk = true;
@@ -837,7 +837,7 @@
m_nBrkPtCount = pArgCount->GetValue();
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBBreakpoint brkPt = rSessionInfo.m_lldbTarget.FindBreakpointByID(static_cast<lldb::break_id_t>(m_nBrkPtId));
+ lldb::SBBreakpoint brkPt = rSessionInfo.GetTarget().FindBreakpointByID(static_cast<lldb::break_id_t>(m_nBrkPtId));
if (brkPt.IsValid())
{
brkPt.SetIgnoreCount(m_nBrkPtCount);
@@ -972,7 +972,7 @@
m_strBrkPtExpr += GetRestOfExpressionNotSurroundedInQuotes();
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBBreakpoint brkPt = rSessionInfo.m_lldbTarget.FindBreakpointByID(static_cast<lldb::break_id_t>(m_nBrkPtId));
+ lldb::SBBreakpoint brkPt = rSessionInfo.GetTarget().FindBreakpointByID(static_cast<lldb::break_id_t>(m_nBrkPtId));
if (brkPt.IsValid())
{
brkPt.SetCondition(m_strBrkPtExpr.c_str());
Index: tools/lldb-mi/MICmdCmdData.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdData.cpp
+++ tools/lldb-mi/MICmdCmdData.cpp
@@ -122,8 +122,8 @@
const CMIUtilString &rExpression(pArgExpr->GetValue());
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess &rProcess = rSessionInfo.m_lldbProcess;
- lldb::SBThread thread = rProcess.GetSelectedThread();
+ lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
+ lldb::SBThread thread = sbProcess.GetSelectedThread();
m_bExpressionValid = (thread.GetNumFrames() > 0);
if (!m_bExpressionValid)
return MIstatus::success;
@@ -410,22 +410,22 @@
const MIuint nDisasmMode = pArgMode->GetValue();
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBTarget &rTarget = rSessionInfo.m_lldbTarget;
+ lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
lldb::addr_t lldbStartAddr = static_cast<lldb::addr_t>(nAddrStart);
- lldb::SBInstructionList instructions = rTarget.ReadInstructions(lldb::SBAddress(lldbStartAddr, rTarget), nAddrEnd - nAddrStart);
+ lldb::SBInstructionList instructions = sbTarget.ReadInstructions(lldb::SBAddress(lldbStartAddr, sbTarget), nAddrEnd - nAddrStart);
const MIuint nInstructions = instructions.GetSize();
for (size_t i = 0; i < nInstructions; i++)
{
const MIchar *pUnknown = "??";
lldb::SBInstruction instrt = instructions.GetInstructionAtIndex(i);
- const MIchar *pStrMnemonic = instrt.GetMnemonic(rTarget);
+ const MIchar *pStrMnemonic = instrt.GetMnemonic(sbTarget);
pStrMnemonic = (pStrMnemonic != nullptr) ? pStrMnemonic : pUnknown;
lldb::SBAddress address = instrt.GetAddress();
- lldb::addr_t addr = address.GetLoadAddress(rTarget);
+ lldb::addr_t addr = address.GetLoadAddress(sbTarget);
const MIchar *pFnName = address.GetFunction().GetName();
pFnName = (pFnName != nullptr) ? pFnName : pUnknown;
lldb::addr_t addrOffSet = address.GetOffset();
- const MIchar *pStrOperands = instrt.GetOperands(rTarget);
+ const MIchar *pStrOperands = instrt.GetOperands(sbTarget);
pStrOperands = (pStrOperands != nullptr) ? pStrOperands : pUnknown;
// MI "{address=\"0x%08llx\",func-name=\"%s\",offset=\"%lld\",inst=\"%s %s\"}"
@@ -599,9 +599,9 @@
}
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess &rProcess = rSessionInfo.m_lldbProcess;
+ lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
lldb::SBError error;
- const MIuint64 nReadBytes = rProcess.ReadMemory(static_cast<lldb::addr_t>(nAddrStart), (void *)m_pBufferMemory, nAddrNumBytes, error);
+ const MIuint64 nReadBytes = sbProcess.ReadMemory(static_cast<lldb::addr_t>(nAddrStart), (void *)m_pBufferMemory, nAddrNumBytes, error);
if (nReadBytes != nAddrNumBytes)
{
SetError(
@@ -827,14 +827,14 @@
CMICmdCmdDataListRegisterNames::Execute(void)
{
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess &rProcess = rSessionInfo.m_lldbProcess;
- if (!rProcess.IsValid())
+ lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
+ if (sbProcess.IsValid())
{
SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PROCESS), m_cmdData.strMiCmd.c_str()));
return MIstatus::failure;
}
- lldb::SBThread thread = rProcess.GetSelectedThread();
+ lldb::SBThread thread = sbProcess.GetSelectedThread();
lldb::SBFrame frame = thread.GetSelectedFrame();
lldb::SBValueList registers = frame.GetRegisters();
const MIuint nRegisters = registers.GetSize();
@@ -906,7 +906,6 @@
, m_constStrArgFormat("fmt")
, m_constStrArgRegNo("regno")
, m_miValueList(true)
- , m_pProcess(nullptr)
{
// Command factory matches this name with that received from the stdin stream
m_strMiCmd = "data-list-register-values";
@@ -975,13 +974,12 @@
}
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess &rProcess = rSessionInfo.m_lldbProcess;
- if (!rProcess.IsValid())
+ lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
+ if (!sbProcess.IsValid())
{
SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PROCESS), m_cmdData.strMiCmd.c_str()));
return MIstatus::failure;
}
- m_pProcess = &rProcess;
const CMICmdArgValListBase::VecArgObjPtr_t &rVecRegNo(pArgRegNo->GetExpectedOptions());
CMICmdArgValListBase::VecArgObjPtr_t::const_iterator it = rVecRegNo.begin();
@@ -1051,7 +1049,7 @@
lldb::SBValue
CMICmdCmdDataListRegisterValues::GetRegister(const MIuint vRegisterIndex) const
{
- lldb::SBThread thread = m_pProcess->GetSelectedThread();
+ lldb::SBThread thread = CMICmnLLDBDebugSessionInfo::Instance().GetProcess().GetSelectedThread();
lldb::SBFrame frame = thread.GetSelectedFrame();
lldb::SBValueList registers = frame.GetRegisters();
const MIuint nRegisters = registers.GetSize();
@@ -1371,10 +1369,10 @@
*m_pBufferMemory = static_cast<MIchar>(nValue);
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess &rProcess = rSessionInfo.m_lldbProcess;
+ lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
lldb::SBError error;
lldb::addr_t addr = static_cast<lldb::addr_t>(m_nAddr + nAddrOffset);
- const size_t nBytesWritten = rProcess.WriteMemory(addr, (const void *)m_pBufferMemory, (size_t)m_nCount, error);
+ const size_t nBytesWritten = sbProcess.WriteMemory(addr, (const void *)m_pBufferMemory, (size_t)m_nCount, error);
if (nBytesWritten != static_cast<size_t>(m_nCount))
{
SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_LLDB_ERR_NOT_WRITE_WHOLEBLK), m_cmdData.strMiCmd.c_str(), m_nCount, addr));
Index: tools/lldb-mi/MICmdCmdData.h
===================================================================
--- tools/lldb-mi/MICmdCmdData.h
+++ tools/lldb-mi/MICmdCmdData.h
@@ -263,7 +263,6 @@
const CMIUtilString m_constStrArgFormat;
const CMIUtilString m_constStrArgRegNo;
CMICmnMIValueList m_miValueList;
- lldb::SBProcess *m_pProcess;
};
//++ ============================================================================
Index: tools/lldb-mi/MICmdCmdExec.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdExec.cpp
+++ tools/lldb-mi/MICmdCmdExec.cpp
@@ -91,8 +91,8 @@
lldb::SBError error;
lldb::SBStream errMsg;
uint32_t launch_flags = lldb::LaunchFlags::eLaunchFlagDebug;
- lldb::SBProcess process = rSessionInfo.m_lldbTarget.Launch(rSessionInfo.m_rLlldbListener, nullptr, nullptr, nullptr, nullptr, nullptr,
- nullptr, launch_flags, false, error);
+ lldb::SBProcess process = rSessionInfo.GetTarget().Launch(rSessionInfo.GetListener(), nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, launch_flags, false, error);
if ((!process.IsValid()) || (error.Fail()))
{
@@ -100,9 +100,6 @@
return MIstatus::failure;
}
- // Save the process in the session info
- rSessionInfo.m_lldbProcess = process;
-
if (!CMIDriver::Instance().SetDriverStateRunningDebugging())
{
const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription());
@@ -137,7 +134,7 @@
m_miResultRecord = miRecordResult;
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::pid_t pid = rSessionInfo.m_lldbProcess.GetProcessID();
+ lldb::pid_t pid = rSessionInfo.GetProcess().GetProcessID();
// Give the client '=thread-group-started,id="i1" pid="xyz"'
m_bHasResultRecordExtra = true;
const CMICmnMIValueConst miValueConst2("i1");
@@ -212,7 +209,7 @@
{
const MIchar *pCmd = "continue";
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- const lldb::ReturnStatus rtn = rSessionInfo.m_rLldbDebugger.GetCommandInterpreter().HandleCommand(pCmd, m_lldbResult);
+ const lldb::ReturnStatus rtn = rSessionInfo.GetDebugger().GetCommandInterpreter().HandleCommand(pCmd, m_lldbResult);
MIunused(rtn);
if (m_lldbResult.GetErrorSize() == 0)
@@ -356,7 +353,7 @@
}
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBDebugger &rDebugger = rSessionInfo.m_rLldbDebugger;
+ lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger();
CMIUtilString strCmd("thread step-over");
if (nThreadId != UINT64_MAX)
strCmd += CMIUtilString::Format(" %llu", nThreadId);
@@ -483,7 +480,7 @@
}
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBDebugger &rDebugger = rSessionInfo.m_rLldbDebugger;
+ lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger();
CMIUtilString strCmd("thread step-in");
if (nThreadId != UINT64_MAX)
strCmd += CMIUtilString::Format(" %llu", nThreadId);
@@ -610,7 +607,7 @@
}
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBDebugger &rDebugger = rSessionInfo.m_rLldbDebugger;
+ lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger();
CMIUtilString strCmd("thread step-inst-over");
if (nThreadId != UINT64_MAX)
strCmd += CMIUtilString::Format(" %llu", nThreadId);
@@ -737,7 +734,7 @@
}
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBDebugger &rDebugger = rSessionInfo.m_rLldbDebugger;
+ lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger();
CMIUtilString strCmd("thread step-inst");
if (nThreadId != UINT64_MAX)
strCmd += CMIUtilString::Format(" %llu", nThreadId);
@@ -865,7 +862,7 @@
}
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBDebugger &rDebugger = rSessionInfo.m_rLldbDebugger;
+ lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger();
CMIUtilString strCmd("thread step-out");
if (nThreadId != UINT64_MAX)
strCmd += CMIUtilString::Format(" %llu", nThreadId);
@@ -962,7 +959,7 @@
CMICmdCmdExecInterrupt::Execute(void)
{
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBDebugger &rDebugger = rSessionInfo.m_rLldbDebugger;
+ lldb::SBDebugger &rDebugger = rSessionInfo.GetDebugger();
CMIUtilString strCmd("process interrupt");
const lldb::ReturnStatus status = rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult, false);
MIunused(status);
Index: tools/lldb-mi/MICmdCmdFile.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdFile.cpp
+++ tools/lldb-mi/MICmdCmdFile.cpp
@@ -96,7 +96,7 @@
CMICmdArgValFile *pArgFile = static_cast<CMICmdArgValFile *>(pArgNamedFile);
const CMIUtilString &strExeFilePath(pArgFile->GetValue());
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBDebugger &rDbgr = rSessionInfo.m_rLldbDebugger;
+ lldb::SBDebugger &rDbgr = rSessionInfo.GetDebugger();
lldb::SBError error;
const MIchar *pTargetTriple = nullptr; // Let LLDB discover the triple required
const MIchar *pTargetPlatformName = "";
@@ -137,8 +137,6 @@
return MIstatus::failure;
}
- rSessionInfo.m_lldbTarget = target;
-
return MIstatus::success;
}
Index: tools/lldb-mi/MICmdCmdGdbInfo.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdGdbInfo.cpp
+++ tools/lldb-mi/MICmdCmdGdbInfo.cpp
@@ -198,11 +198,11 @@
bool bOk = rStdout.TextToStdout("~\"From To Syms Read Shared Object Library\"");
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBTarget &rTarget = rSessionInfo.m_lldbTarget;
- const MIuint nModules = rTarget.GetNumModules();
+ lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
+ const MIuint nModules = sbTarget.GetNumModules();
for (MIuint i = 0; bOk && (i < nModules); i++)
{
- lldb::SBModule module = rTarget.GetModuleAtIndex(i);
+ lldb::SBModule module = sbTarget.GetModuleAtIndex(i);
if (module.IsValid())
{
const CMIUtilString strModuleFilePath(module.GetFileSpec().GetDirectory());
@@ -216,7 +216,7 @@
for (MIuint j = 0; j < nSections; j++)
{
lldb::SBSection section = module.GetSectionAtIndex(j);
- lldb::addr_t addrLoad = section.GetLoadAddress(rTarget);
+ lldb::addr_t addrLoad = section.GetLoadAddress(sbTarget);
if (addrLoad != (lldb::addr_t) - 1)
{
if (!bHaveAddrLoad)
Index: tools/lldb-mi/MICmdCmdMiscellanous.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdMiscellanous.cpp
+++ tools/lldb-mi/MICmdCmdMiscellanous.cpp
@@ -84,7 +84,7 @@
CMICmdCmdGdbExit::Execute(void)
{
CMICmnLLDBDebugger::Instance().GetDriver().SetExitApplicationFlag(true);
- const lldb::SBError sbErr = m_rLLDBDebugSessionInfo.m_lldbProcess.Detach();
+ const lldb::SBError sbErr = m_rLLDBDebugSessionInfo.GetProcess().Detach();
// Do not check for sbErr.Fail() here, m_lldbProcess is likely !IsValid()
return MIstatus::success;
@@ -234,17 +234,17 @@
m_bIsI1 = true;
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess &rProcess = rSessionInfo.m_lldbProcess;
+ lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
- // Note do not check for rProcess is IsValid(), continue
+ // Note do not check for sbProcess is IsValid(), continue
m_vecMIValueTuple.clear();
- const MIuint nThreads = rProcess.GetNumThreads();
+ const MIuint nThreads = sbProcess.GetNumThreads();
for (MIuint i = 0; i < nThreads; 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())
{
@@ -292,9 +292,9 @@
miTuple.Add(miValueResult2);
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- if (rSessionInfo.m_lldbProcess.IsValid())
+ if (rSessionInfo.GetProcess().IsValid())
{
- const lldb::pid_t pid = rSessionInfo.m_lldbProcess.GetProcessID();
+ const lldb::pid_t pid = rSessionInfo.GetProcess().GetProcessID();
const CMIUtilString strPid(CMIUtilString::Format("%lld", pid));
const CMICmnMIValueConst miValueConst3(strPid);
const CMICmnMIValueResult miValueResult3("pid", miValueConst3);
@@ -328,20 +328,20 @@
miTuple.Add(miValueResult2);
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- if (rSessionInfo.m_lldbProcess.IsValid())
+ if (rSessionInfo.GetProcess().IsValid())
{
- const lldb::pid_t pid = rSessionInfo.m_lldbProcess.GetProcessID();
+ const lldb::pid_t pid = rSessionInfo.GetProcess().GetProcessID();
const CMIUtilString strPid(CMIUtilString::Format("%lld", pid));
const CMICmnMIValueConst miValueConst3(strPid);
const CMICmnMIValueResult miValueResult3("pid", miValueConst3);
miTuple.Add(miValueResult3);
}
- if (rSessionInfo.m_lldbTarget.IsValid())
+ if (rSessionInfo.GetTarget().IsValid())
{
- lldb::SBTarget &rTrgt = rSessionInfo.m_lldbTarget;
- const MIchar *pDir = rTrgt.GetExecutable().GetDirectory();
- const MIchar *pFileName = rTrgt.GetExecutable().GetFilename();
+ lldb::SBTarget sbTrgt = rSessionInfo.GetTarget();
+ const MIchar *pDir = sbTrgt.GetExecutable().GetDirectory();
+ const MIchar *pFileName = sbTrgt.GetExecutable().GetFilename();
const CMIUtilString strFile(CMIUtilString::Format("%s/%s", pDir, pFileName));
const CMICmnMIValueConst miValueConst4(strFile);
const CMICmnMIValueResult miValueResult4("executable", miValueConst4);
@@ -470,7 +470,7 @@
const CMIUtilString &rStrCommand(pArgCommand->GetValue());
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
const lldb::ReturnStatus rtn =
- rSessionInfo.m_rLldbDebugger.GetCommandInterpreter().HandleCommand(rStrCommand.c_str(), m_lldbResult, true);
+ rSessionInfo.GetDebugger().GetCommandInterpreter().HandleCommand(rStrCommand.c_str(), m_lldbResult, true);
MIunused(rtn);
return MIstatus::success;
Index: tools/lldb-mi/MICmdCmdStack.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdStack.cpp
+++ tools/lldb-mi/MICmdCmdStack.cpp
@@ -111,8 +111,8 @@
}
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess &rProcess = rSessionInfo.m_lldbProcess;
- lldb::SBThread thread = (nThreadId != UINT64_MAX) ? rProcess.GetThreadByIndexID(nThreadId) : rProcess.GetSelectedThread();
+ lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
+ lldb::SBThread thread = (nThreadId != UINT64_MAX) ? sbProcess.GetThreadByIndexID(nThreadId) : sbProcess.GetSelectedThread();
m_nThreadFrames = thread.GetNumFrames();
return MIstatus::success;
@@ -237,8 +237,8 @@
const MIuint nFrameLow = pArgFrameLow->GetFound() ? pArgFrameLow->GetValue() : 0;
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess &rProcess = rSessionInfo.m_lldbProcess;
- lldb::SBThread thread = (nThreadId != UINT64_MAX) ? rProcess.GetThreadByIndexID(nThreadId) : rProcess.GetSelectedThread();
+ lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
+ lldb::SBThread thread = (nThreadId != UINT64_MAX) ? sbProcess.GetThreadByIndexID(nThreadId) : sbProcess.GetSelectedThread();
MIuint nThreadFrames = thread.GetNumFrames();
// Adjust nThreadFrames for the nFrameHigh argument as we use nFrameHigh+1 in the min calc as the arg
@@ -414,8 +414,8 @@
}
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess &rProcess = rSessionInfo.m_lldbProcess;
- lldb::SBThread thread = (nThreadId != UINT64_MAX) ? rProcess.GetThreadByIndexID(nThreadId) : rProcess.GetSelectedThread();
+ lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
+ lldb::SBThread thread = (nThreadId != UINT64_MAX) ? sbProcess.GetThreadByIndexID(nThreadId) : sbProcess.GetSelectedThread();
m_bThreadInvalid = !thread.IsValid();
if (m_bThreadInvalid)
return MIstatus::success;
@@ -583,8 +583,8 @@
}
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess &rProcess = rSessionInfo.m_lldbProcess;
- lldb::SBThread thread = (nThreadId != UINT64_MAX) ? rProcess.GetThreadByIndexID(nThreadId) : rProcess.GetSelectedThread();
+ lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
+ lldb::SBThread thread = (nThreadId != UINT64_MAX) ? sbProcess.GetThreadByIndexID(nThreadId) : sbProcess.GetSelectedThread();
m_bThreadInvalid = !thread.IsValid();
if (m_bThreadInvalid)
return MIstatus::success;
Index: tools/lldb-mi/MICmdCmdTarget.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdTarget.cpp
+++ tools/lldb-mi/MICmdCmdTarget.cpp
@@ -100,7 +100,7 @@
// Check we have a valid target
// Note: target created via 'file-exec-and-symbols' command
- if (!rSessionInfo.m_lldbTarget.IsValid())
+ if (!rSessionInfo.GetTarget().IsValid())
{
SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET_CURRENT), m_cmdData.strMiCmd.c_str()));
return MIstatus::failure;
@@ -120,7 +120,7 @@
// Ask LLDB to collect to the target port
const MIchar *pPlugin("gdb-remote");
lldb::SBError error;
- lldb::SBProcess process = rSessionInfo.m_lldbTarget.ConnectRemote(rSessionInfo.m_rLlldbListener, strUrl.c_str(), pPlugin, error);
+ lldb::SBProcess process = rSessionInfo.GetTarget().ConnectRemote(rSessionInfo.GetListener(), strUrl.c_str(), pPlugin, error);
// Verify that we have managed to connect successfully
lldb::SBStream errMsg;
@@ -135,16 +135,11 @@
return MIstatus::failure;
}
- // Save the process in the session info
- // Note: Order is important here since this process handle may be used by CMICmnLLDBDebugHandleEvents
- // which can fire when interpreting via HandleCommand() below.
- rSessionInfo.m_lldbProcess = process;
-
// Set the environment path if we were given one
CMIUtilString strWkDir;
if (rSessionInfo.SharedDataRetrieve<CMIUtilString>(rSessionInfo.m_constStrSharedDataKeyWkDir, strWkDir))
{
- lldb::SBDebugger &rDbgr = rSessionInfo.m_rLldbDebugger;
+ lldb::SBDebugger &rDbgr = rSessionInfo.GetDebugger();
if (!rDbgr.SetCurrentPlatformSDKRoot(strWkDir.c_str()))
{
SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_FNFAILED), m_cmdData.strMiCmd.c_str(), "target-select"));
@@ -156,7 +151,7 @@
CMIUtilString strSolibPath;
if (rSessionInfo.SharedDataRetrieve<CMIUtilString>(rSessionInfo.m_constStrSharedDataSolibPath, strSolibPath))
{
- lldb::SBDebugger &rDbgr = rSessionInfo.m_rLldbDebugger;
+ lldb::SBDebugger &rDbgr = rSessionInfo.GetDebugger();
lldb::SBCommandInterpreter cmdIterpreter = rDbgr.GetCommandInterpreter();
CMIUtilString strCmdString = CMIUtilString::Format("target modules search-paths add . %s", strSolibPath.c_str());
@@ -190,7 +185,7 @@
m_miResultRecord = miRecordResult;
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::pid_t pid = rSessionInfo.m_lldbProcess.GetProcessID();
+ lldb::pid_t pid = rSessionInfo.GetProcess().GetProcessID();
// Prod the client i.e. Eclipse with out-of-band results to help it 'continue' because it is using LLDB debugger
// Give the client '=thread-group-started,id="i1"'
m_bHasResultRecordExtra = true;
Index: tools/lldb-mi/MICmdCmdThread.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdThread.cpp
+++ tools/lldb-mi/MICmdCmdThread.cpp
@@ -99,12 +99,12 @@
}
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess &rProcess = rSessionInfo.m_lldbProcess;
- lldb::SBThread thread = rProcess.GetSelectedThread();
+ lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
+ lldb::SBThread thread = sbProcess.GetSelectedThread();
if (m_bSingleThread)
{
- thread = rProcess.GetThreadByIndexID(nThreadId);
+ thread = sbProcess.GetThreadByIndexID(nThreadId);
m_bThreadInvalid = thread.IsValid();
if (!m_bThreadInvalid)
return MIstatus::success;
@@ -120,10 +120,10 @@
// Multiple threads
m_vecMIValueTuple.clear();
- const MIuint nThreads = rProcess.GetNumThreads();
+ const MIuint nThreads = sbProcess.GetNumThreads();
for (MIuint i = 0; i < nThreads; i++)
{
- lldb::SBThread thread = rProcess.GetThreadAtIndex(i);
+ lldb::SBThread thread = sbProcess.GetThreadAtIndex(i);
if (thread.IsValid())
{
CMICmnMIValueTuple miTuple;
Index: tools/lldb-mi/MICmdCmdVar.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdVar.cpp
+++ tools/lldb-mi/MICmdCmdVar.cpp
@@ -169,8 +169,8 @@
m_strVarName = CMIUtilString::Format("var%u", CMICmnLLDBDebugSessionInfoVarObj::VarObjIdGet());
CMICmnLLDBDebugSessionInfoVarObj::VarObjIdInc();
}
- lldb::SBProcess &rProcess = rSessionInfo.m_lldbProcess;
- lldb::SBThread thread = (nThreadId != UINT64_MAX) ? rProcess.GetThreadByIndexID(nThreadId) : rProcess.GetSelectedThread();
+ lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
+ lldb::SBThread thread = (nThreadId != UINT64_MAX) ? sbProcess.GetThreadByIndexID(nThreadId) : sbProcess.GetSelectedThread();
m_nThreadId = thread.GetIndexID();
lldb::SBFrame frame = thread.GetFrameAtIndex(nFrame);
lldb::SBValue value = frame.FindVariable(rStrExpression.c_str());
@@ -519,8 +519,8 @@
vrwbChanged = false;
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess &rProcess = rSessionInfo.m_lldbProcess;
- lldb::SBThread thread = rProcess.GetSelectedThread();
+ lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
+ lldb::SBThread thread = sbProcess.GetSelectedThread();
if (thread.GetNumFrames() == 0)
{
return MIstatus::success;
Index: tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
===================================================================
--- tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
+++ tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
@@ -47,9 +47,7 @@
// Throws: None.
//--
CMICmnLLDBDebugSessionInfo::CMICmnLLDBDebugSessionInfo(void)
- : m_rLldbDebugger(CMICmnLLDBDebugger::Instance().GetTheDebugger())
- , m_rLlldbListener(CMICmnLLDBDebugger::Instance().GetTheListener())
- , m_nBrkPointCntMax(INT32_MAX)
+ : m_nBrkPointCntMax(INT32_MAX)
, m_currentSelectedThread(LLDB_INVALID_THREAD_ID)
, m_constStrSharedDataKeyWkDir("Working Directory")
, m_constStrSharedDataSolibPath("Solib Path")
@@ -226,7 +224,7 @@
bool
CMICmnLLDBDebugSessionInfo::GetThreadFrames(const SMICmdData &vCmdData, const MIuint vThreadIdx, CMIUtilString &vwrThreadFrames)
{
- lldb::SBThread thread = m_lldbProcess.GetThreadByIndexID(vThreadIdx);
+ lldb::SBThread thread = GetProcess().GetThreadByIndexID(vThreadIdx);
const uint32_t nFrames = thread.GetNumFrames();
if (nFrames == 0)
{
@@ -299,7 +297,7 @@
bool
CMICmnLLDBDebugSessionInfo::GetThreadFrames2(const SMICmdData &vCmdData, const MIuint vThreadIdx, CMIUtilString &vwrThreadFrames)
{
- lldb::SBThread thread = m_lldbProcess.GetThreadByIndexID(vThreadIdx);
+ lldb::SBThread thread = GetProcess().GetThreadByIndexID(vThreadIdx);
const uint32_t nFrames = thread.GetNumFrames();
if (nFrames == 0)
{
@@ -1329,7 +1327,7 @@
const MIchar *pFn = pUnkwn;
const MIchar *pFilePath = pUnkwn;
size_t nLine = 0;
- const size_t nAddr = brkPtAddr.GetLoadAddress(m_lldbTarget);
+ const size_t nAddr = brkPtAddr.GetLoadAddress(GetTarget());
lldb::SBCompileUnit rCmplUnit = symbolCntxt.GetCompileUnit();
if (rCmplUnit.IsValid())
@@ -1356,3 +1354,55 @@
return MIstatus::success;
}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Get current debugger.
+// Type: Method.
+// Args: None.
+// Return: lldb::SBDebugger - current debugger.
+// Throws: None.
+//--
+lldb::SBDebugger &
+CMICmnLLDBDebugSessionInfo::GetDebugger() const
+{
+ return CMICmnLLDBDebugger::Instance().GetTheDebugger();
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Get current listener.
+// Type: Method.
+// Args: None.
+// Return: lldb::SBListener - current listener.
+// Throws: None.
+//--
+lldb::SBListener &
+CMICmnLLDBDebugSessionInfo::GetListener() const
+{
+ return CMICmnLLDBDebugger::Instance().GetTheListener();
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Get current target.
+// Type: Method.
+// Args: None.
+// Return: lldb::SBTarget - current target.
+// Throws: None.
+//--
+lldb::SBTarget
+CMICmnLLDBDebugSessionInfo::GetTarget() const
+{
+ return GetDebugger().GetSelectedTarget();
+}
+
+//++ ------------------------------------------------------------------------------------
+// Details: Get current process.
+// Type: Method.
+// Args: None.
+// Return: lldb::SBProcess - current process.
+// Throws: None.
+//--
+lldb::SBProcess
+CMICmnLLDBDebugSessionInfo::GetProcess() const
+{
+ return GetTarget().GetProcess();
+}
Index: tools/lldb-mi/MICmnLLDBDebugSessionInfo.h
===================================================================
--- tools/lldb-mi/MICmnLLDBDebugSessionInfo.h
+++ tools/lldb-mi/MICmnLLDBDebugSessionInfo.h
@@ -156,14 +156,14 @@
bool RecordBrkPtInfo(const MIuint vnBrkPtId, const SBrkPtInfo &vrBrkPtInfo);
bool RecordBrkPtInfoGet(const MIuint vnBrkPtId, SBrkPtInfo &vrwBrkPtInfo) const;
bool RecordBrkPtInfoDelete(const MIuint vnBrkPtId);
+ lldb::SBDebugger &GetDebugger() const;
+ lldb::SBListener &GetListener() const;
+ lldb::SBTarget GetTarget() const;
+ lldb::SBProcess GetProcess() const;
// Attributes:
public:
// The following are available to all command instances
- lldb::SBDebugger &m_rLldbDebugger;
- lldb::SBListener &m_rLlldbListener;
- lldb::SBTarget m_lldbTarget;
- lldb::SBProcess m_lldbProcess;
const MIuint m_nBrkPointCntMax;
VecActiveThreadId_t m_vecActiveThreadId;
lldb::tid_t m_currentSelectedThread;
Index: tools/lldb-mi/MICmnLLDBDebugger.cpp
===================================================================
--- tools/lldb-mi/MICmnLLDBDebugger.cpp
+++ tools/lldb-mi/MICmnLLDBDebugger.cpp
@@ -148,7 +148,8 @@
// Explicitly delete the remote target in case MI needs to exit prematurely otherwise
// LLDB debugger may hang in its Destroy() fn waiting on events
- m_lldbDebugger.DeleteTarget(CMICmnLLDBDebugSessionInfo::Instance().m_lldbTarget);
+ lldb::SBTarget sbTarget = CMICmnLLDBDebugSessionInfo::Instance().GetTarget();
+ m_lldbDebugger.DeleteTarget(sbTarget);
// Debug: May need this but does seem to work without it so commented out the fudge 19/06/2014
// It appears we need to wait as hang does not occur when hitting a debug breakpoint here
Index: tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
===================================================================
--- tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
+++ tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
@@ -722,9 +722,9 @@
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 @@
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:
@@ -831,8 +831,8 @@
{
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
@@ -868,7 +868,7 @@
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);
@@ -881,12 +881,12 @@
}
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)
{
@@ -899,9 +899,9 @@
if (CMIUtilString::Compare(threadCloneFn, fnName))
{
- if (rProcess.IsValid())
+ if (sbProcess.IsValid())
{
- rProcess.Continue();
+ sbProcess.Continue();
vwrbShouldBrk = true;
break;
}
@@ -942,8 +942,8 @@
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)
{
@@ -997,9 +997,9 @@
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);
}
@@ -1018,8 +1018,8 @@
{
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)
{
@@ -1121,8 +1121,8 @@
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)
{
@@ -1200,7 +1200,7 @@
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;
@@ -1342,7 +1342,7 @@
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;
@@ -1377,7 +1377,7 @@
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;
@@ -1451,22 +1451,22 @@
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;
@@ -1503,7 +1503,7 @@
}
}
- lldb::SBThread currentThread = rProcess.GetSelectedThread();
+ lldb::SBThread currentThread = sbProcess.GetSelectedThread();
if (currentThread.IsValid())
{
const MIuint threadId = currentThread.GetIndexID();
@@ -1526,7 +1526,7 @@
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\""
Index: tools/lldb-mi/MICmnLLDBProxySBValue.cpp
===================================================================
--- tools/lldb-mi/MICmnLLDBProxySBValue.cpp
+++ tools/lldb-mi/MICmnLLDBProxySBValue.cpp
@@ -129,14 +129,14 @@
return MIstatus::failure;
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
- lldb::SBProcess &rProcess = rSessionInfo.m_lldbProcess;
+ lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
MIuint nBufferSize = 64;
bool bNeedResize = false;
MIchar *pBuffer = static_cast<MIchar *>(::malloc(nBufferSize));
do
{
lldb::SBError error;
- const size_t nReadSize = rProcess.ReadCStringFromMemory((lldb::addr_t)nNum, pBuffer, nBufferSize, error);
+ const size_t nReadSize = sbProcess.ReadCStringFromMemory((lldb::addr_t)nNum, pBuffer, nBufferSize, error);
if (nReadSize == (nBufferSize - 1))
{
bNeedResize = true;
Index: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
===================================================================
--- tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
+++ tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
@@ -219,7 +219,7 @@
const MIuint nBytes(128);
const MIchar *pBufferMemory = new MIchar[nBytes];
lldb::SBError error;
- const MIuint64 nReadBytes = rSessionInfo.m_lldbProcess.ReadMemory(addr, (void *)pBufferMemory, nBytes, error);
+ const MIuint64 nReadBytes = rSessionInfo.GetProcess().ReadMemory(addr, (void *)pBufferMemory, nBytes, error);
MIunused(nReadBytes);
text = CMIUtilString::Format("\\\"%s\\\"", pBufferMemory);
delete[] pBufferMemory;
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits