[Lldb-commits] [lldb] [lldb] Fix TestGlobalModuleCache.py for remote debugging (PR #111483)

Igor Kudrin via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 7 22:15:24 PDT 2024


https://github.com/igorkudrin created https://github.com/llvm/llvm-project/pull/111483

`SBDebugger().Create()` returns a debugger with only the host platform in its platform list. If the test suite is running for a remote platform, it should be explicitly added and selected in the new debugger created within the test, otherwise, the test will fail because the host platform may not be able to launch the built binary.

>From bb594335d05a4c8cb2949556f5b338242a9b5280 Mon Sep 17 00:00:00 2001
From: Igor Kudrin <ikudrin at accesssoftek.com>
Date: Mon, 7 Oct 2024 22:07:02 -0700
Subject: [PATCH] [lldb] Fix TestGlobalModuleCache.py for remote debugging

`SBDebugger().Create()` returns a debugger with only the host platform
in its platform list. If the test suite is running for a remote platform,
 it should be explicitly added and selected in the new debugger created
within the test, otherwise, the test will fail because the host platform
may not be able to launch the built binary.
---
 .../API/python_api/global_module_cache/TestGlobalModuleCache.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
index ccefc28946e062..16bc86bd4fc44d 100644
--- a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
+++ b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
@@ -111,6 +111,8 @@ def do_test(self, one_target, one_debugger):
         else:
             if one_target:
                 new_debugger = lldb.SBDebugger().Create()
+                if lldb.selected_platform is not None:
+                    new_debugger.SetSelectedPlatform(lldb.selected_platform)
                 new_debugger.SetAsync(False)
                 self.old_debugger = self.dbg
                 self.dbg = new_debugger



More information about the lldb-commits mailing list