Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: base/process/kill_posix.cc

Issue 2312393002: Debug exit code (Closed)
Patch Set: abort instead of int3 Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/logging.cc ('k') | content/browser/child_process_launcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/kill_posix.cc
diff --git a/base/process/kill_posix.cc b/base/process/kill_posix.cc
index 4dc60ef2a247345d6263ec678ca22fd5af04c95b..ed8c72ad7041afe597e678503e01339f80a429aa 100644
--- a/base/process/kill_posix.cc
+++ b/base/process/kill_posix.cc
@@ -27,18 +27,27 @@ namespace {
TerminationStatus GetTerminationStatusImpl(ProcessHandle handle,
bool can_block,
int* exit_code) {
+ LOG(ERROR) << "In GetTerminationStatusImpl can_block=" << can_block;
+ fflush(stderr);
int status = 0;
const pid_t result = HANDLE_EINTR(waitpid(handle, &status,
can_block ? 0 : WNOHANG));
+ LOG(ERROR) << "waitpid result=" << result << "status=" << status;
+ fflush(stderr);
+
if (result == -1) {
DPLOG(ERROR) << "waitpid(" << handle << ")";
if (exit_code)
*exit_code = 0;
+ LOG(ERROR) << "Normal termination";
+ fflush(stderr);
return TERMINATION_STATUS_NORMAL_TERMINATION;
} else if (result == 0) {
// the child hasn't exited yet.
if (exit_code)
*exit_code = 0;
+ LOG(ERROR) << "Still running";
+ fflush(stderr);
return TERMINATION_STATUS_STILL_RUNNING;
}
@@ -46,6 +55,8 @@ TerminationStatus GetTerminationStatusImpl(ProcessHandle handle,
*exit_code = status;
if (WIFSIGNALED(status)) {
+ LOG(ERROR) << "WIFSIGNALED: signal" << WTERMSIG(status);
+ fflush(stderr);
switch (WTERMSIG(status)) {
case SIGABRT:
case SIGBUS:
@@ -54,6 +65,7 @@ TerminationStatus GetTerminationStatusImpl(ProcessHandle handle,
case SIGSEGV:
case SIGTRAP:
case SIGSYS:
+ LOG(ERROR) << "Process crashed";
return TERMINATION_STATUS_PROCESS_CRASHED;
case SIGKILL:
#if defined(OS_CHROMEOS)
@@ -63,15 +75,19 @@ TerminationStatus GetTerminationStatusImpl(ProcessHandle handle,
#endif
case SIGINT:
case SIGTERM:
+ LOG(ERROR) << "Process was killed";
return TERMINATION_STATUS_PROCESS_WAS_KILLED;
default:
break;
}
}
- if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
+ if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {
+ LOG(ERROR) << "Abnormal termination";
return TERMINATION_STATUS_ABNORMAL_TERMINATION;
+ }
+ LOG(ERROR) << "Normal termination (last resort)";
return TERMINATION_STATUS_NORMAL_TERMINATION;
}
« no previous file with comments | « base/logging.cc ('k') | content/browser/child_process_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698