Skip to content

Conversation

@JDevlieghere
Copy link
Member

No description provided.

@llvmbot llvmbot added the lldb label Jul 18, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 18, 2025

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/149615.diff

2 Files Affected:

  • (modified) lldb/source/Core/Debugger.cpp (+2-2)
  • (modified) lldb/source/Core/Statusline.cpp (+1-5)
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index ed674ee1275c7..3a3fb9eb0bdaa 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1221,8 +1221,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);
 }
 
diff --git a/lldb/source/Core/Statusline.cpp b/lldb/source/Core/Statusline.cpp
index 393d427241021..cfed40ac7fb2b 100644
--- a/lldb/source/Core/Statusline.cpp
+++ b/lldb/source/Core/Statusline.cpp
@@ -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()) {

@JDevlieghere JDevlieghere force-pushed the store-dummy-target branch 2 times, most recently from 2f65e10 to 7701787 Compare July 21, 2025 16:59
@jimingham
Copy link
Collaborator

This seems like a good idea. No reason for everybody to have to independently fall back to the dummy target.

@JDevlieghere
Copy link
Member Author

This seems to break a bunch of assumptions. I still think it's the right thing to do, but it's not on the critical path so I'll keep this in my back pocket until I have the bandwidth to fix the test failures:

Unresolved Tests (1):
  lldb-api :: python_api/interpreter/TestRunCommandInterpreterAPI.py

********************
Failed Tests (24):
  lldb-api :: commands/command/script/TestCommandScript.py
  lldb-api :: commands/settings/TestSettings.py
  lldb-api :: commands/statistics/basic/TestStats.py
  lldb-api :: commands/target/auto-install-main-executable/TestAutoInstallMainExecutable.py
  lldb-api :: functionalities/load_unload/TestLoadUnload.py
  lldb-api :: functionalities/postmortem/elf-core/TestLinuxCore.py
  lldb-api :: functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
  lldb-api :: functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py
  lldb-api :: lang/c/tls_globals/TestTlsGlobals.py
  lldb-api :: lang/cpp/fixits/TestCppFixIts.py
  lldb-api :: source-manager/TestSourceManager.py
  lldb-api :: tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py
  lldb-api :: tools/lldb-dap/coreFile/TestDAP_coreFile.py
  lldb-shell :: Commands/command-backtrace-parser-1.test
  lldb-shell :: Commands/command-backtrace-parser-2.test
  lldb-shell :: Commands/command-statistics-dump.test
  lldb-shell :: Driver/LocalLLDBInit.test
  lldb-shell :: ScriptInterpreter/Python/scripted_breakpoint_lua.test
  lldb-shell :: SymbolFile/DWARF/dwo-debug-file-search-path-symlink-relative-compdir.c
  lldb-shell :: SymbolFile/DWARF/dwo-debug-file-search-paths-dwoname-absolute-compdir.c
  lldb-shell :: SymbolFile/DWARF/dwo-debug-file-search-paths-filename-only-absolute-compdir.c
  lldb-shell :: SymbolFile/DWARF/dwo-debug-file-search-paths-filename-only-relative-compdir.c
  lldb-shell :: SymbolFile/DWARF/dwo-debug-file-search-paths-relative-compdir.c
  lldb-shell :: SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants