aboutsummaryrefslogtreecommitdiff
path: root/lldb
diff options
context:
space:
mode:
Diffstat (limited to 'lldb')
-rw-r--r--lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py11
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp6
-rw-r--r--lldb/test/API/tools/lldb-server/main.cpp7
3 files changed, 19 insertions, 5 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
index 19c7669..aea6b9f 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -444,13 +444,20 @@ class GdbRemoteTestCaseBase(Base, metaclass=GdbRemoteTestCaseFactory):
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,
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index 9c798cb..7ef50da 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -218,8 +218,8 @@ static Status EnsureFDFlags(int fd, int flags) {
static llvm::Error AddPtraceScopeNote(llvm::Error original_error) {
Expected<int> ptrace_scope = GetPtraceScope();
if (auto E = ptrace_scope.takeError()) {
- Log *log = GetLog(POSIXLog::Process);
- LLDB_LOG(log, "error reading value of ptrace_scope: {0}", E);
+ LLDB_LOG_ERROR(GetLog(POSIXLog::Process), std::move(E),
+ "error reading value of ptrace_scope: {0}");
// The original error is probably more interesting than not being able to
// read or interpret ptrace_scope.
@@ -230,6 +230,7 @@ static llvm::Error AddPtraceScopeNote(llvm::Error original_error) {
switch (*ptrace_scope) {
case 1:
case 2:
+ llvm::consumeError(std::move(original_error));
return llvm::createStringError(
std::error_code(errno, std::generic_category()),
"The current value of ptrace_scope is %d, which can cause ptrace to "
@@ -239,6 +240,7 @@ static llvm::Error AddPtraceScopeNote(llvm::Error original_error) {
"https://www.kernel.org/doc/Documentation/security/Yama.txt.",
*ptrace_scope);
case 3:
+ llvm::consumeError(std::move(original_error));
return llvm::createStringError(
std::error_code(errno, std::generic_category()),
"The current value of ptrace_scope is 3, which will cause ptrace to "
diff --git a/lldb/test/API/tools/lldb-server/main.cpp b/lldb/test/API/tools/lldb-server/main.cpp
index 0e9323c..7e84552 100644
--- a/lldb/test/API/tools/lldb-server/main.cpp
+++ b/lldb/test/API/tools/lldb-server/main.cpp
@@ -5,6 +5,7 @@
#include <cstdlib>
#include <cstring>
#include <errno.h>
+#include <fstream>
#include <future>
#include <inttypes.h>
#include <memory>
@@ -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:")) {