summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp14
-rw-r--r--lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h2
-rw-r--r--lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp5
-rw-r--r--lldb/source/Target/Process.cpp11
4 files changed, 16 insertions, 16 deletions
diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
index dc30ebd4066..84e35ba2264 100644
--- a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
@@ -1115,14 +1115,13 @@ ProcessMonitor::AttachOpThread(void *arg)
{
AttachArgs *args = static_cast<AttachArgs*>(arg);
- if (!Attach(args))
- return NULL;
+ Attach(args);
ServeOperation(args);
return NULL;
}
-bool
+void
ProcessMonitor::Attach(AttachArgs *args)
{
lldb::pid_t pid = args->m_pid;
@@ -1134,27 +1133,24 @@ ProcessMonitor::Attach(AttachArgs *args)
{
args->m_error.SetErrorToGenericError();
args->m_error.SetErrorString("Attaching to process 1 is not allowed.");
- goto FINISH;
+ return;
}
// Attach to the requested process.
if (PTRACE(PT_ATTACH, pid, NULL, 0) < 0)
{
args->m_error.SetErrorToErrno();
- goto FINISH;
+ return;
}
int status;
if ((status = waitpid(pid, NULL, 0)) < 0)
{
args->m_error.SetErrorToErrno();
- goto FINISH;
+ return;
}
process.SendMessage(ProcessMessage::Attach(pid));
-
-FINISH:
- return args->m_error.Success();
}
size_t
diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h
index 68bf2f80051..935fd85ed37 100644
--- a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h
+++ b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h
@@ -290,7 +290,7 @@ private:
static void *
AttachOpThread(void *args);
- static bool
+ static void
Attach(AttachArgs *args);
static void
diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
index 702ff800394..0e5ab5a8d8b 100644
--- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
+++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
@@ -341,6 +341,11 @@ ProcessPOSIX::DoDestroy()
{
assert(m_monitor);
m_exit_now = true;
+ if (GetID() == LLDB_INVALID_PROCESS_ID)
+ {
+ error.SetErrorString("invalid process id");
+ return error;
+ }
if (!m_monitor->Kill())
{
error.SetErrorToErrno();
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index f5650112f4d..3b50799eec6 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -3397,14 +3397,13 @@ Process::Attach (ProcessAttachInfo &attach_info)
else
{
if (GetID() != LLDB_INVALID_PROCESS_ID)
- {
SetID (LLDB_INVALID_PROCESS_ID);
- const char *error_string = error.AsCString();
- if (error_string == NULL)
- error_string = "attach failed";
- SetExitStatus(-1, error_string);
- }
+ const char *error_string = error.AsCString();
+ if (error_string == NULL)
+ error_string = "attach failed";
+
+ SetExitStatus(-1, error_string);
}
}
}
OpenPOWER on IntegriCloud