Skip to content

Commit f846a13

Browse files
Fix the problem that the module list cannot be obtained (#111)
1 parent 610d71a commit f846a13

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

src/MICmdCmdBreak.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ bool CMICmdCmdBreakInsert::Execute() {
149149
// Ask LLDB for the target to check if we have valid or dummy one.
150150
CMICmnLLDBDebugSessionInfo &rSessionInfo(
151151
CMICmnLLDBDebugSessionInfo::Instance());
152-
lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
152+
lldb::SBTarget sbTarget = rSessionInfo.GetSelectedOrDummyTarget();
153153

154154
m_bBreakpointEnabled = !pArgDisableBreakpoint->GetFound();
155155
m_bBreakpointIsTemp = pArgTempBreakpoint->GetFound();
@@ -464,7 +464,7 @@ bool CMICmdCmdBreakDelete::Execute() {
464464
}
465465

466466
bool bSuccess = false;
467-
lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
467+
lldb::SBTarget sbTarget = rSessionInfo.GetSelectedOrDummyTarget();
468468
if (sStoppointInfo.m_eType ==
469469
CMICmnLLDBDebugSessionInfo::eStoppointType_Breakpoint)
470470
bSuccess = sbTarget.BreakpointDelete(
@@ -601,7 +601,7 @@ bool CMICmdCmdBreakDisable::Execute() {
601601
}
602602
};
603603

604-
lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
604+
lldb::SBTarget sbTarget = rSessionInfo.GetSelectedOrDummyTarget();
605605
if (sStoppointInfo.m_eType ==
606606
CMICmnLLDBDebugSessionInfo::eStoppointType_Breakpoint) {
607607
lldb::SBBreakpoint breakpoint = sbTarget.FindBreakpointByID(
@@ -744,7 +744,7 @@ bool CMICmdCmdBreakEnable::Execute() {
744744
}
745745
};
746746

747-
lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
747+
lldb::SBTarget sbTarget = rSessionInfo.GetSelectedOrDummyTarget();
748748
if (sStoppointInfo.m_eType ==
749749
CMICmnLLDBDebugSessionInfo::eStoppointType_Breakpoint) {
750750
lldb::SBBreakpoint breakpoint = sbTarget.FindBreakpointByID(
@@ -875,7 +875,7 @@ bool CMICmdCmdBreakAfter::Execute() {
875875
return MIstatus::failure;
876876
}
877877

878-
lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
878+
lldb::SBTarget sbTarget = rSessionInfo.GetSelectedOrDummyTarget();
879879
if (sStoppointInfo.m_eType ==
880880
CMICmnLLDBDebugSessionInfo::eStoppointType_Breakpoint) {
881881
lldb::SBBreakpoint breakpoint = sbTarget.FindBreakpointByID(
@@ -1023,7 +1023,7 @@ bool CMICmdCmdBreakCondition::Execute() {
10231023
return MIstatus::failure;
10241024
}
10251025

1026-
lldb::SBTarget sbTarget = rSessionInfo.GetTarget();
1026+
lldb::SBTarget sbTarget = rSessionInfo.GetSelectedOrDummyTarget();
10271027
if (sStoppointInfo.m_eType ==
10281028
CMICmnLLDBDebugSessionInfo::eStoppointType_Breakpoint) {
10291029
lldb::SBBreakpoint breakpoint = sbTarget.FindBreakpointByID(
@@ -1267,7 +1267,7 @@ bool CMICmdCmdBreakWatch::Execute() {
12671267
// Ask LLDB for the target to check if we have valid or dummy one.
12681268
CMICmnLLDBDebugSessionInfo &rSessionInfo(
12691269
CMICmnLLDBDebugSessionInfo::Instance());
1270-
auto sbTarget = rSessionInfo.GetTarget();
1270+
auto sbTarget = rSessionInfo.GetSelectedOrDummyTarget();
12711271
auto sbProcess = rSessionInfo.GetProcess();
12721272
auto sbThread = sbProcess.GetSelectedThread();
12731273
auto sbFrame = sbThread.GetSelectedFrame();

src/MICmdCmdSymbol.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ bool CMICmdCmdSymbolListLines::Execute() {
9999
CMICMDBASE_GETOPTION(pArgFile, File, m_constStrArgNameFile);
100100

101101
const auto &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
102-
if (rSessionInfo.GetTarget() == rSessionInfo.GetDebugger().GetDummyTarget()) {
102+
if (rSessionInfo.GetSelectedOrDummyTarget() ==
103+
rSessionInfo.GetDebugger().GetDummyTarget()) {
103104
SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET_CURRENT),
104105
m_cmdData.strMiCmd.c_str()));
105106
return MIstatus::failure;

src/MICmnLLDBDebugSessionInfo.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -979,13 +979,25 @@ lldb::SBListener &CMICmnLLDBDebugSessionInfo::GetListener() const {
979979
}
980980

981981
//++
982-
// Details: Get current target.
982+
// Details: Get current selected target.
983983
// Type: Method.
984984
// Args: None.
985-
// Return: lldb::SBTarget - current target.
985+
// Return: lldb::SBTarget - current selected target.
986986
// Throws: None.
987987
//--
988988
lldb::SBTarget CMICmnLLDBDebugSessionInfo::GetTarget() const {
989+
auto target = GetDebugger().GetSelectedTarget();
990+
return target;
991+
}
992+
993+
//++
994+
// Details: Get current selected or dummy target.
995+
// Type: Method.
996+
// Args: None.
997+
// Return: lldb::SBTarget - current selected or dummy target.
998+
// Throws: None.
999+
//--
1000+
lldb::SBTarget CMICmnLLDBDebugSessionInfo::GetSelectedOrDummyTarget() const {
9891001
auto target = GetDebugger().GetSelectedTarget();
9901002
if (target.IsValid())
9911003
return target;

src/MICmnLLDBDebugSessionInfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ class CMICmnLLDBDebugSessionInfo
204204
lldb::SBDebugger &GetDebugger() const;
205205
lldb::SBListener &GetListener() const;
206206
lldb::SBTarget GetTarget() const;
207+
lldb::SBTarget GetSelectedOrDummyTarget() const;
207208
lldb::SBProcess GetProcess() const;
208209

209210
void SetCreateTty(bool val);

0 commit comments

Comments
 (0)