summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-06-19 12:47:50 +0000
committerPavel Labath <labath@google.com>2017-06-19 12:47:50 +0000
commit3508fc8cc518f2f62d38c351c90f7815f835c3e4 (patch)
treeb5f3493c3e24f3739b2e1d3a4da707e0c0405f72 /lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
parentcc1c112806556e75453e0c9a1dc0f4038aecb4ef (diff)
downloadbcm5719-llvm-3508fc8cc518f2f62d38c351c90f7815f835c3e4.tar.gz
bcm5719-llvm-3508fc8cc518f2f62d38c351c90f7815f835c3e4.zip
Add pretty-printer for wait(2) statuses and modernize the code handling them
Summary: A number of places were trying to decode the result of wait(). Add a simple utility function that does that and a struct that encapsulates the decoded result. Then also provide a pretty-printer for that class. Reviewers: zturner, krytarowski, eugene Subscribers: lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D33998 llvm-svn: 305689
Diffstat (limited to 'lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp')
-rw-r--r--lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp19
1 files changed, 3 insertions, 16 deletions
diff --git a/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp b/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
index f6c8c78ccb7..518f0d2da4f 100644
--- a/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
+++ b/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp
@@ -1085,8 +1085,7 @@ Status NativeProcessDarwin::HandleWaitpidResult() {
"waitpid exiting pid from the pipe. Will notify "
"as if parent process died with exit status -1.",
__FUNCTION__);
- SetExitStatus(eExitTypeInvalid, -1, "failed to receive waitpid result",
- notify_status);
+ SetExitStatus(WaitStatus(WaitStatus::Exit, -1), notify_status);
return error;
}
@@ -1099,8 +1098,7 @@ Status NativeProcessDarwin::HandleWaitpidResult() {
"waitpid exit status from the pipe. Will notify "
"as if parent process died with exit status -1.",
__FUNCTION__);
- SetExitStatus(eExitTypeInvalid, -1, "failed to receive waitpid result",
- notify_status);
+ SetExitStatus(WaitStatus(WaitStatus::Exit, -1), notify_status);
return error;
}
@@ -1111,18 +1109,7 @@ Status NativeProcessDarwin::HandleWaitpidResult() {
__FUNCTION__, pid,
(pid == m_pid) ? "the inferior" : "not the inferior", status);
- ExitType exit_type = eExitTypeInvalid;
- int exit_status = -1;
-
- if (WIFEXITED(status)) {
- exit_type = eExitTypeExit;
- exit_status = WEXITSTATUS(status);
- } else if (WIFSIGNALED(status)) {
- exit_type = eExitTypeSignal;
- exit_status = WTERMSIG(status);
- }
-
- SetExitStatus(exit_type, exit_status, nullptr, notify_status);
+ SetExitStatus(WaitStatus::Decode(status), notify_status);
return error;
}
OpenPOWER on IntegriCloud