[Lldb-commits] [lldb] 11a0969 - [lldb] Fixup TestLoadAfterAttach for 82ba3f4
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 7 06:06:46 PDT 2022
Author: Pavel Labath
Date: 2022-07-07T15:06:40+02:00
New Revision: 11a09692ad960a8e547f05f070fe8b24664a4e24
URL: https://github.com/llvm/llvm-project/commit/11a09692ad960a8e547f05f070fe8b24664a4e24
DIFF: https://github.com/llvm/llvm-project/commit/11a09692ad960a8e547f05f070fe8b24664a4e24.diff
LOG: [lldb] Fixup TestLoadAfterAttach for 82ba3f4
After 82ba3f4, we (again) need to call lldb_enable_attach to be able to
attach to processes on linux. This was a new test, so it does not have
the necessary boilerplate.
Added:
Modified:
lldb/test/API/functionalities/load_after_attach/TestLoadAfterAttach.py
lldb/test/API/functionalities/load_after_attach/main.cpp
Removed:
################################################################################
diff --git a/lldb/test/API/functionalities/load_after_attach/TestLoadAfterAttach.py b/lldb/test/API/functionalities/load_after_attach/TestLoadAfterAttach.py
index 6ab82205a7863..39fc096a1a422 100644
--- a/lldb/test/API/functionalities/load_after_attach/TestLoadAfterAttach.py
+++ b/lldb/test/API/functionalities/load_after_attach/TestLoadAfterAttach.py
@@ -10,6 +10,8 @@ class TestCase(TestBase):
def test_load_after_attach(self):
self.build()
+ sync_file_path = lldbutil.append_to_process_working_directory(self, "process_ready")
+
ctx = self.platformContext
lib_name = ctx.shlib_prefix + 'lib_b.' + ctx.shlib_extension
@@ -22,7 +24,9 @@ def test_load_after_attach(self):
# Spawn a new process.
# use realpath to workaround llvm.org/pr48376
# Pass path to solib for dlopen to properly locate the library.
- popen = self.spawnSubprocess(os.path.realpath(exe), extra_env=environment)
+ popen = self.spawnSubprocess(os.path.realpath(exe), [sync_file_path],
+ extra_env=environment)
+ lldbutil.wait_for_file_on_target(self, sync_file_path)
# Attach to the spawned process.
error = lldb.SBError()
diff --git a/lldb/test/API/functionalities/load_after_attach/main.cpp b/lldb/test/API/functionalities/load_after_attach/main.cpp
index 97eea20a581d8..96012a126001a 100644
--- a/lldb/test/API/functionalities/load_after_attach/main.cpp
+++ b/lldb/test/API/functionalities/load_after_attach/main.cpp
@@ -3,8 +3,12 @@
#include <cstdio>
#include <thread>
#include <chrono>
+#include <fstream>
int main(int argc, char* argv[]) {
+ lldb_enable_attach();
+ std::ofstream(argv[1]).close();
+
// Wait until debugger is attached.
int main_thread_continue = 0;
int i = 0;
More information about the lldb-commits
mailing list