Skip to content

Commit 0737726

Browse files
committed
[lldb] Store the dummy target in the selected exeuction context
1 parent 53f4abc commit 0737726

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

lldb/source/Core/Debugger.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
10051005
if (log_callback)
10061006
m_callback_handler_sp =
10071007
std::make_shared<CallbackLogHandler>(log_callback, baton);
1008-
m_command_interpreter_up->Initialize();
1008+
10091009
// Always add our default platform to the platform list
10101010
PlatformSP default_platform_sp(Platform::GetHostPlatform());
10111011
assert(default_platform_sp);
@@ -1023,6 +1023,8 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
10231023
}
10241024
assert(m_dummy_target_sp.get() && "Couldn't construct dummy target?");
10251025

1026+
m_command_interpreter_up->Initialize();
1027+
10261028
OptionValueUInt64 *term_width =
10271029
m_collection_sp->GetPropertyAtIndexAsOptionValueUInt64(
10281030
ePropertyTerminalWidth);
@@ -1221,8 +1223,8 @@ void Debugger::RedrawStatusline(bool update) {
12211223
}
12221224

12231225
ExecutionContext Debugger::GetSelectedExecutionContext() {
1224-
bool adopt_selected = true;
1225-
ExecutionContextRef exe_ctx_ref(GetSelectedTarget().get(), adopt_selected);
1226+
ExecutionContextRef exe_ctx_ref(&GetSelectedOrDummyTarget(),
1227+
/*adopt_selected=*/true);
12261228
return ExecutionContext(exe_ctx_ref);
12271229
}
12281230

lldb/source/Core/Statusline.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,7 @@ void Statusline::Redraw(bool update) {
134134
}
135135

136136
ExecutionContext exe_ctx = m_debugger.GetSelectedExecutionContext();
137-
138-
// For colors and progress events, the format entity needs access to the
139-
// debugger, which requires a target in the execution context.
140-
if (!exe_ctx.HasTargetScope())
141-
exe_ctx.SetTargetPtr(&m_debugger.GetSelectedOrDummyTarget());
137+
assert(exe_ctx.HasTargetScope() && "format entity needs a target");
142138

143139
SymbolContext symbol_ctx;
144140
if (ProcessSP process_sp = exe_ctx.GetProcessSP()) {

lldb/source/Interpreter/CommandObject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ bool CommandObject::CheckRequirements(CommandReturnObject &result) {
147147
// we don't want any CommandObject instances to keep any of these objects
148148
// around longer than for a single command. Every command should call
149149
// CommandObject::Cleanup() after it has completed.
150-
assert(!m_exe_ctx.GetTargetPtr());
150+
assert(!m_exe_ctx.GetTargetPtr() || m_exe_ctx.GetTargetRef().IsDummyTarget());
151151
assert(!m_exe_ctx.GetProcessPtr());
152152
assert(!m_exe_ctx.GetThreadPtr());
153153
assert(!m_exe_ctx.GetFramePtr());

0 commit comments

Comments
 (0)