Skip to content

Commit 6f50eee

Browse files
author
git apple-llvm automerger
committed
Merge commit '18edd4115853' from llvm.org/main into next
2 parents 3eb1488 + 18edd41 commit 6f50eee

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,13 +444,20 @@ def launch_process_for_attach(
444444
if not exe_path:
445445
exe_path = self.getBuildArtifact("a.out")
446446

447-
args = []
447+
# This file will be created once the inferior has enabled attaching.
448+
sync_file_path = lldbutil.append_to_process_working_directory(
449+
self, "process_ready"
450+
)
451+
args = [f"syncfile:{sync_file_path}"]
448452
if inferior_args:
449453
args.extend(inferior_args)
450454
if sleep_seconds:
451455
args.append("sleep:%d" % sleep_seconds)
452456

453-
return self.spawnSubprocess(exe_path, args)
457+
inferior = self.spawnSubprocess(exe_path, args)
458+
lldbutil.wait_for_file_on_target(self, sync_file_path)
459+
460+
return inferior
454461

455462
def prep_debug_monitor_and_inferior(
456463
self,

lldb/test/API/tools/lldb-server/main.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <cstdlib>
66
#include <cstring>
77
#include <errno.h>
8+
#include <fstream>
89
#include <future>
910
#include <inttypes.h>
1011
#include <memory>
@@ -265,7 +266,11 @@ int main(int argc, char **argv) {
265266
// Process command line args.
266267
for (int i = 1; i < argc; ++i) {
267268
std::string arg = argv[i];
268-
if (consume_front(arg, "stderr:")) {
269+
if (consume_front(arg, "syncfile:")) {
270+
// Write to this file to tell test framework that attaching is now
271+
// possible.
272+
std::ofstream(arg).close();
273+
} else if (consume_front(arg, "stderr:")) {
269274
// Treat remainder as text to go to stderr.
270275
fprintf(stderr, "%s\n", arg.c_str());
271276
} else if (consume_front(arg, "retval:")) {

0 commit comments

Comments
 (0)