Skip to content

[lldb] Store the dummy target in the selected exeuction context #149615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lldb/source/Core/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
if (log_callback)
m_callback_handler_sp =
std::make_shared<CallbackLogHandler>(log_callback, baton);
m_command_interpreter_up->Initialize();

// Always add our default platform to the platform list
PlatformSP default_platform_sp(Platform::GetHostPlatform());
assert(default_platform_sp);
Expand All @@ -1023,6 +1023,8 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
}
assert(m_dummy_target_sp.get() && "Couldn't construct dummy target?");

m_command_interpreter_up->Initialize();

OptionValueUInt64 *term_width =
m_collection_sp->GetPropertyAtIndexAsOptionValueUInt64(
ePropertyTerminalWidth);
Expand Down Expand Up @@ -1221,8 +1223,8 @@ void Debugger::RedrawStatusline(bool update) {
}

ExecutionContext Debugger::GetSelectedExecutionContext() {
bool adopt_selected = true;
ExecutionContextRef exe_ctx_ref(GetSelectedTarget().get(), adopt_selected);
ExecutionContextRef exe_ctx_ref(&GetSelectedOrDummyTarget(),
/*adopt_selected=*/true);
return ExecutionContext(exe_ctx_ref);
}

Expand Down
6 changes: 1 addition & 5 deletions lldb/source/Core/Statusline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,7 @@ void Statusline::Redraw(bool update) {
}

ExecutionContext exe_ctx = m_debugger.GetSelectedExecutionContext();

// For colors and progress events, the format entity needs access to the
// debugger, which requires a target in the execution context.
if (!exe_ctx.HasTargetScope())
exe_ctx.SetTargetPtr(&m_debugger.GetSelectedOrDummyTarget());
assert(exe_ctx.HasTargetScope() && "format entity needs a target");

SymbolContext symbol_ctx;
if (ProcessSP process_sp = exe_ctx.GetProcessSP()) {
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Interpreter/CommandObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ bool CommandObject::CheckRequirements(CommandReturnObject &result) {
// we don't want any CommandObject instances to keep any of these objects
// around longer than for a single command. Every command should call
// CommandObject::Cleanup() after it has completed.
assert(!m_exe_ctx.GetTargetPtr());
assert(!m_exe_ctx.GetTargetPtr() || m_exe_ctx.GetTargetRef().IsDummyTarget());
assert(!m_exe_ctx.GetProcessPtr());
assert(!m_exe_ctx.GetThreadPtr());
assert(!m_exe_ctx.GetFramePtr());
Expand Down
Loading