Skip to content
Merged
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
3 changes: 3 additions & 0 deletions lldb/include/lldb/Core/Debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,9 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
/// Redraw the statusline if enabled.
void RedrawStatusline(std::optional<ExecutionContextRef> exe_ctx_ref);

/// Flush cached state (e.g. stale execution context in the statusline).
void FlushStatusLine();

/// This is the correct way to query the state of Interruption.
/// If you are on the RunCommandInterpreter thread, it will check the
/// command interpreter state, and if it is on another thread it will
Expand Down
3 changes: 3 additions & 0 deletions lldb/include/lldb/Core/Statusline.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class Statusline {
/// Redraw the statusline.
void Redraw(std::optional<ExecutionContextRef> exe_ctx_ref);

/// Clear the cached execution context to discard stale pointers.
void ClearExecutionContext();

/// Inform the statusline that the terminal dimensions have changed.
void TerminalSizeChanged();

Expand Down
9 changes: 9 additions & 0 deletions lldb/source/Core/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,15 @@ void Debugger::RedrawStatusline(
m_statusline->Redraw(exe_ctx_ref);
}

void Debugger::FlushStatusLine() {
std::lock_guard<std::mutex> guard(m_statusline_mutex);

if (!m_statusline)
return;

m_statusline->ClearExecutionContext();
}

ExecutionContext Debugger::GetSelectedExecutionContext() {
bool adopt_selected = true;
ExecutionContextRef exe_ctx_ref(GetSelectedTarget().get(), adopt_selected);
Expand Down
2 changes: 2 additions & 0 deletions lldb/source/Core/Statusline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ void Statusline::UpdateScrollWindow(ScrollWindowMode mode) {
m_debugger.RefreshIOHandler();
}

void Statusline::ClearExecutionContext() { m_exe_ctx_ref.ClearFrame(); }

void Statusline::Redraw(std::optional<ExecutionContextRef> exe_ctx_ref) {
// Update the cached execution context.
if (exe_ctx_ref)
Expand Down
1 change: 1 addition & 0 deletions lldb/source/Target/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6025,6 +6025,7 @@ void Process::Flush() {
m_extended_thread_stop_id = 0;
m_queue_list.Clear();
m_queue_list_stop_id = 0;
GetTarget().GetDebugger().FlushStatusLine();
}

lldb::addr_t Process::GetCodeAddressMask() {
Expand Down