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
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,20 @@ def launch_process_for_attach(
if not exe_path:
exe_path = self.getBuildArtifact("a.out")

args = []
# This file will be created once the inferior has enabled attaching.
sync_file_path = lldbutil.append_to_process_working_directory(
self, "process_ready"
)
args = [f"syncfile:{sync_file_path}"]
if inferior_args:
args.extend(inferior_args)
if sleep_seconds:
args.append("sleep:%d" % sleep_seconds)

return self.spawnSubprocess(exe_path, args)
inferior = self.spawnSubprocess(exe_path, args)
lldbutil.wait_for_file_on_target(self, sync_file_path)

return inferior

def prep_debug_monitor_and_inferior(
self,
Expand Down
7 changes: 6 additions & 1 deletion lldb/test/API/tools/lldb-server/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <cstdlib>
#include <cstring>
#include <errno.h>
#include <fstream>
#include <future>
#include <inttypes.h>
#include <memory>
Expand Down Expand Up @@ -265,7 +266,11 @@ int main(int argc, char **argv) {
// Process command line args.
for (int i = 1; i < argc; ++i) {
std::string arg = argv[i];
if (consume_front(arg, "stderr:")) {
if (consume_front(arg, "syncfile:")) {
// Write to this file to tell test framework that attaching is now
// possible.
std::ofstream(arg).close();
} else if (consume_front(arg, "stderr:")) {
// Treat remainder as text to go to stderr.
fprintf(stderr, "%s\n", arg.c_str());
} else if (consume_front(arg, "retval:")) {
Expand Down
Loading