1 //===-- Host.cpp ------------------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // C includes 11 #include <errno.h> 12 #include <limits.h> 13 #include <stdlib.h> 14 #include <sys/types.h> 15 #ifndef _WIN32 16 #include <dlfcn.h> 17 #include <grp.h> 18 #include <netdb.h> 19 #include <pwd.h> 20 #include <sys/stat.h> 21 #include <unistd.h> 22 #endif 23 24 #if defined(__APPLE__) 25 #include <mach-o/dyld.h> 26 #include <mach/mach_init.h> 27 #include <mach/mach_port.h> 28 #endif 29 30 #if defined(__linux__) || defined(__FreeBSD__) || \ 31 defined(__FreeBSD_kernel__) || defined(__APPLE__) || \ 32 defined(__NetBSD__) || defined(__OpenBSD__) 33 #if !defined(__ANDROID__) 34 #include <spawn.h> 35 #endif 36 #include <sys/syscall.h> 37 #include <sys/wait.h> 38 #endif 39 40 #if defined(__FreeBSD__) 41 #include <pthread_np.h> 42 #endif 43 44 #if defined(__NetBSD__) 45 #include <lwp.h> 46 #endif 47 48 // C++ Includes 49 50 // Other libraries and framework includes 51 // Project includes 52 53 #include "lldb/Core/ArchSpec.h" 54 #include "lldb/Host/Host.h" 55 #include "lldb/Host/HostInfo.h" 56 #include "lldb/Host/HostProcess.h" 57 #include "lldb/Host/MonitoringProcessLauncher.h" 58 #include "lldb/Host/Predicate.h" 59 #include "lldb/Host/ProcessLauncher.h" 60 #include "lldb/Host/ThreadLauncher.h" 61 #include "lldb/Host/posix/ConnectionFileDescriptorPosix.h" 62 #include "lldb/Target/FileAction.h" 63 #include "lldb/Target/ProcessLaunchInfo.h" 64 #include "lldb/Target/UnixSignals.h" 65 #include "lldb/Utility/CleanUp.h" 66 #include "lldb/Utility/DataBufferLLVM.h" 67 #include "lldb/Utility/FileSpec.h" 68 #include "lldb/Utility/Log.h" 69 #include "lldb/Utility/Status.h" 70 #include "lldb/lldb-private-forward.h" 71 #include "llvm/ADT/SmallString.h" 72 #include "llvm/ADT/StringSwitch.h" 73 #include "llvm/Support/Errno.h" 74 #include "llvm/Support/FileSystem.h" 75 76 #if defined(_WIN32) 77 #include "lldb/Host/windows/ConnectionGenericFileWindows.h" 78 #include "lldb/Host/windows/ProcessLauncherWindows.h" 79 #else 80 #include "lldb/Host/posix/ProcessLauncherPosixFork.h" 81 #endif 82 83 #if defined(__APPLE__) 84 #ifndef _POSIX_SPAWN_DISABLE_ASLR 85 #define _POSIX_SPAWN_DISABLE_ASLR 0x0100 86 #endif 87 88 extern "C" { 89 int __pthread_chdir(const char *path); 90 int __pthread_fchdir(int fildes); 91 } 92 93 #endif 94 95 using namespace lldb; 96 using namespace lldb_private; 97 98 #if !defined(__APPLE__) && !defined(_WIN32) 99 struct MonitorInfo { 100 lldb::pid_t pid; // The process ID to monitor 101 Host::MonitorChildProcessCallback 102 callback; // The callback function to call when "pid" exits or signals 103 bool monitor_signals; // If true, call the callback when "pid" gets signaled. 104 }; 105 106 static thread_result_t MonitorChildProcessThreadFunction(void *arg); 107 108 HostThread Host::StartMonitoringChildProcess( 109 const Host::MonitorChildProcessCallback &callback, lldb::pid_t pid, 110 bool monitor_signals) { 111 MonitorInfo *info_ptr = new MonitorInfo(); 112 113 info_ptr->pid = pid; 114 info_ptr->callback = callback; 115 info_ptr->monitor_signals = monitor_signals; 116 117 char thread_name[256]; 118 ::snprintf(thread_name, sizeof(thread_name), 119 "<lldb.host.wait4(pid=%" PRIu64 ")>", pid); 120 return ThreadLauncher::LaunchThread( 121 thread_name, MonitorChildProcessThreadFunction, info_ptr, NULL); 122 } 123 124 #ifndef __linux__ 125 //------------------------------------------------------------------ 126 // Scoped class that will disable thread canceling when it is 127 // constructed, and exception safely restore the previous value it 128 // when it goes out of scope. 129 //------------------------------------------------------------------ 130 class ScopedPThreadCancelDisabler { 131 public: 132 ScopedPThreadCancelDisabler() { 133 // Disable the ability for this thread to be cancelled 134 int err = ::pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &m_old_state); 135 if (err != 0) 136 m_old_state = -1; 137 } 138 139 ~ScopedPThreadCancelDisabler() { 140 // Restore the ability for this thread to be cancelled to what it 141 // previously was. 142 if (m_old_state != -1) 143 ::pthread_setcancelstate(m_old_state, 0); 144 } 145 146 private: 147 int m_old_state; // Save the old cancelability state. 148 }; 149 #endif // __linux__ 150 151 #ifdef __linux__ 152 #if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)) 153 static __thread volatile sig_atomic_t g_usr1_called; 154 #else 155 static thread_local volatile sig_atomic_t g_usr1_called; 156 #endif 157 158 static void SigUsr1Handler(int) { g_usr1_called = 1; } 159 #endif // __linux__ 160 161 static bool CheckForMonitorCancellation() { 162 #ifdef __linux__ 163 if (g_usr1_called) { 164 g_usr1_called = 0; 165 return true; 166 } 167 #else 168 ::pthread_testcancel(); 169 #endif 170 return false; 171 } 172 173 static thread_result_t MonitorChildProcessThreadFunction(void *arg) { 174 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); 175 const char *function = __FUNCTION__; 176 if (log) 177 log->Printf("%s (arg = %p) thread starting...", function, arg); 178 179 MonitorInfo *info = (MonitorInfo *)arg; 180 181 const Host::MonitorChildProcessCallback callback = info->callback; 182 const bool monitor_signals = info->monitor_signals; 183 184 assert(info->pid <= UINT32_MAX); 185 const ::pid_t pid = monitor_signals ? -1 * getpgid(info->pid) : info->pid; 186 187 delete info; 188 189 int status = -1; 190 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) 191 #define __WALL 0 192 #endif 193 const int options = __WALL; 194 195 #ifdef __linux__ 196 // This signal is only used to interrupt the thread from waitpid 197 struct sigaction sigUsr1Action; 198 memset(&sigUsr1Action, 0, sizeof(sigUsr1Action)); 199 sigUsr1Action.sa_handler = SigUsr1Handler; 200 ::sigaction(SIGUSR1, &sigUsr1Action, nullptr); 201 #endif // __linux__ 202 203 while (1) { 204 log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); 205 if (log) 206 log->Printf("%s ::waitpid (pid = %" PRIi32 ", &status, options = %i)...", 207 function, pid, options); 208 209 if (CheckForMonitorCancellation()) 210 break; 211 212 // Get signals from all children with same process group of pid 213 const ::pid_t wait_pid = ::waitpid(pid, &status, options); 214 215 if (CheckForMonitorCancellation()) 216 break; 217 218 if (wait_pid == -1) { 219 if (errno == EINTR) 220 continue; 221 else { 222 LLDB_LOG(log, 223 "arg = {0}, thread exiting because waitpid failed ({1})...", 224 arg, llvm::sys::StrError()); 225 break; 226 } 227 } else if (wait_pid > 0) { 228 bool exited = false; 229 int signal = 0; 230 int exit_status = 0; 231 const char *status_cstr = NULL; 232 if (WIFSTOPPED(status)) { 233 signal = WSTOPSIG(status); 234 status_cstr = "STOPPED"; 235 } else if (WIFEXITED(status)) { 236 exit_status = WEXITSTATUS(status); 237 status_cstr = "EXITED"; 238 exited = true; 239 } else if (WIFSIGNALED(status)) { 240 signal = WTERMSIG(status); 241 status_cstr = "SIGNALED"; 242 if (wait_pid == abs(pid)) { 243 exited = true; 244 exit_status = -1; 245 } 246 } else { 247 status_cstr = "(\?\?\?)"; 248 } 249 250 // Scope for pthread_cancel_disabler 251 { 252 #ifndef __linux__ 253 ScopedPThreadCancelDisabler pthread_cancel_disabler; 254 #endif 255 256 log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); 257 if (log) 258 log->Printf("%s ::waitpid (pid = %" PRIi32 259 ", &status, options = %i) => pid = %" PRIi32 260 ", status = 0x%8.8x (%s), signal = %i, exit_state = %i", 261 function, pid, options, wait_pid, status, status_cstr, 262 signal, exit_status); 263 264 if (exited || (signal != 0 && monitor_signals)) { 265 bool callback_return = false; 266 if (callback) 267 callback_return = callback(wait_pid, exited, signal, exit_status); 268 269 // If our process exited, then this thread should exit 270 if (exited && wait_pid == abs(pid)) { 271 if (log) 272 log->Printf("%s (arg = %p) thread exiting because pid received " 273 "exit signal...", 274 __FUNCTION__, arg); 275 break; 276 } 277 // If the callback returns true, it means this process should 278 // exit 279 if (callback_return) { 280 if (log) 281 log->Printf("%s (arg = %p) thread exiting because callback " 282 "returned true...", 283 __FUNCTION__, arg); 284 break; 285 } 286 } 287 } 288 } 289 } 290 291 log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); 292 if (log) 293 log->Printf("%s (arg = %p) thread exiting...", __FUNCTION__, arg); 294 295 return NULL; 296 } 297 298 #endif // #if !defined (__APPLE__) && !defined (_WIN32) 299 300 #if !defined(__APPLE__) 301 302 void Host::SystemLog(SystemLogType type, const char *format, va_list args) { 303 vfprintf(stderr, format, args); 304 } 305 306 #endif 307 308 void Host::SystemLog(SystemLogType type, const char *format, ...) { 309 va_list args; 310 va_start(args, format); 311 SystemLog(type, format, args); 312 va_end(args); 313 } 314 315 lldb::pid_t Host::GetCurrentProcessID() { return ::getpid(); } 316 317 #ifndef _WIN32 318 319 lldb::thread_t Host::GetCurrentThread() { 320 return lldb::thread_t(pthread_self()); 321 } 322 323 const char *Host::GetSignalAsCString(int signo) { 324 switch (signo) { 325 case SIGHUP: 326 return "SIGHUP"; // 1 hangup 327 case SIGINT: 328 return "SIGINT"; // 2 interrupt 329 case SIGQUIT: 330 return "SIGQUIT"; // 3 quit 331 case SIGILL: 332 return "SIGILL"; // 4 illegal instruction (not reset when caught) 333 case SIGTRAP: 334 return "SIGTRAP"; // 5 trace trap (not reset when caught) 335 case SIGABRT: 336 return "SIGABRT"; // 6 abort() 337 #if defined(SIGPOLL) 338 #if !defined(SIGIO) || (SIGPOLL != SIGIO) 339 // Under some GNU/Linux, SIGPOLL and SIGIO are the same. Causing the build to 340 // fail with 'multiple define cases with same value' 341 case SIGPOLL: 342 return "SIGPOLL"; // 7 pollable event ([XSR] generated, not supported) 343 #endif 344 #endif 345 #if defined(SIGEMT) 346 case SIGEMT: 347 return "SIGEMT"; // 7 EMT instruction 348 #endif 349 case SIGFPE: 350 return "SIGFPE"; // 8 floating point exception 351 case SIGKILL: 352 return "SIGKILL"; // 9 kill (cannot be caught or ignored) 353 case SIGBUS: 354 return "SIGBUS"; // 10 bus error 355 case SIGSEGV: 356 return "SIGSEGV"; // 11 segmentation violation 357 case SIGSYS: 358 return "SIGSYS"; // 12 bad argument to system call 359 case SIGPIPE: 360 return "SIGPIPE"; // 13 write on a pipe with no one to read it 361 case SIGALRM: 362 return "SIGALRM"; // 14 alarm clock 363 case SIGTERM: 364 return "SIGTERM"; // 15 software termination signal from kill 365 case SIGURG: 366 return "SIGURG"; // 16 urgent condition on IO channel 367 case SIGSTOP: 368 return "SIGSTOP"; // 17 sendable stop signal not from tty 369 case SIGTSTP: 370 return "SIGTSTP"; // 18 stop signal from tty 371 case SIGCONT: 372 return "SIGCONT"; // 19 continue a stopped process 373 case SIGCHLD: 374 return "SIGCHLD"; // 20 to parent on child stop or exit 375 case SIGTTIN: 376 return "SIGTTIN"; // 21 to readers pgrp upon background tty read 377 case SIGTTOU: 378 return "SIGTTOU"; // 22 like TTIN for output if (tp->t_local<OSTOP) 379 #if defined(SIGIO) 380 case SIGIO: 381 return "SIGIO"; // 23 input/output possible signal 382 #endif 383 case SIGXCPU: 384 return "SIGXCPU"; // 24 exceeded CPU time limit 385 case SIGXFSZ: 386 return "SIGXFSZ"; // 25 exceeded file size limit 387 case SIGVTALRM: 388 return "SIGVTALRM"; // 26 virtual time alarm 389 case SIGPROF: 390 return "SIGPROF"; // 27 profiling time alarm 391 #if defined(SIGWINCH) 392 case SIGWINCH: 393 return "SIGWINCH"; // 28 window size changes 394 #endif 395 #if defined(SIGINFO) 396 case SIGINFO: 397 return "SIGINFO"; // 29 information request 398 #endif 399 case SIGUSR1: 400 return "SIGUSR1"; // 30 user defined signal 1 401 case SIGUSR2: 402 return "SIGUSR2"; // 31 user defined signal 2 403 default: 404 break; 405 } 406 return NULL; 407 } 408 409 #endif 410 411 #if !defined(__APPLE__) // see Host.mm 412 413 bool Host::GetBundleDirectory(const FileSpec &file, FileSpec &bundle) { 414 bundle.Clear(); 415 return false; 416 } 417 418 bool Host::ResolveExecutableInBundle(FileSpec &file) { return false; } 419 #endif 420 421 #ifndef _WIN32 422 423 FileSpec Host::GetModuleFileSpecForHostAddress(const void *host_addr) { 424 FileSpec module_filespec; 425 #if !defined(__ANDROID__) 426 Dl_info info; 427 if (::dladdr(host_addr, &info)) { 428 if (info.dli_fname) 429 module_filespec.SetFile(info.dli_fname, true); 430 } 431 #endif 432 return module_filespec; 433 } 434 435 #endif 436 437 #if !defined(__linux__) 438 bool Host::FindProcessThreads(const lldb::pid_t pid, TidMap &tids_to_attach) { 439 return false; 440 } 441 #endif 442 443 struct ShellInfo { 444 ShellInfo() 445 : process_reaped(false), pid(LLDB_INVALID_PROCESS_ID), signo(-1), 446 status(-1) {} 447 448 lldb_private::Predicate<bool> process_reaped; 449 lldb::pid_t pid; 450 int signo; 451 int status; 452 }; 453 454 static bool 455 MonitorShellCommand(std::shared_ptr<ShellInfo> shell_info, lldb::pid_t pid, 456 bool exited, // True if the process did exit 457 int signo, // Zero for no signal 458 int status) // Exit value of process if signal is zero 459 { 460 shell_info->pid = pid; 461 shell_info->signo = signo; 462 shell_info->status = status; 463 // Let the thread running Host::RunShellCommand() know that the process 464 // exited and that ShellInfo has been filled in by broadcasting to it 465 shell_info->process_reaped.SetValue(true, eBroadcastAlways); 466 return true; 467 } 468 469 Status Host::RunShellCommand(const char *command, const FileSpec &working_dir, 470 int *status_ptr, int *signo_ptr, 471 std::string *command_output_ptr, 472 uint32_t timeout_sec, bool run_in_default_shell) { 473 return RunShellCommand(Args(command), working_dir, status_ptr, signo_ptr, 474 command_output_ptr, timeout_sec, run_in_default_shell); 475 } 476 477 Status Host::RunShellCommand(const Args &args, const FileSpec &working_dir, 478 int *status_ptr, int *signo_ptr, 479 std::string *command_output_ptr, 480 uint32_t timeout_sec, bool run_in_default_shell) { 481 Status error; 482 ProcessLaunchInfo launch_info; 483 launch_info.SetArchitecture(HostInfo::GetArchitecture()); 484 if (run_in_default_shell) { 485 // Run the command in a shell 486 launch_info.SetShell(HostInfo::GetDefaultShell()); 487 launch_info.GetArguments().AppendArguments(args); 488 const bool localhost = true; 489 const bool will_debug = false; 490 const bool first_arg_is_full_shell_command = false; 491 launch_info.ConvertArgumentsForLaunchingInShell( 492 error, localhost, will_debug, first_arg_is_full_shell_command, 0); 493 } else { 494 // No shell, just run it 495 const bool first_arg_is_executable = true; 496 launch_info.SetArguments(args, first_arg_is_executable); 497 } 498 499 if (working_dir) 500 launch_info.SetWorkingDirectory(working_dir); 501 llvm::SmallString<PATH_MAX> output_file_path; 502 503 if (command_output_ptr) { 504 // Create a temporary file to get the stdout/stderr and redirect the 505 // output of the command into this file. We will later read this file 506 // if all goes well and fill the data into "command_output_ptr" 507 FileSpec tmpdir_file_spec; 508 if (HostInfo::GetLLDBPath(ePathTypeLLDBTempSystemDir, tmpdir_file_spec)) { 509 tmpdir_file_spec.AppendPathComponent("lldb-shell-output.%%%%%%"); 510 llvm::sys::fs::createUniqueFile(tmpdir_file_spec.GetPath(), 511 output_file_path); 512 } else { 513 llvm::sys::fs::createTemporaryFile("lldb-shell-output.%%%%%%", "", 514 output_file_path); 515 } 516 } 517 518 FileSpec output_file_spec{output_file_path.c_str(), false}; 519 520 launch_info.AppendSuppressFileAction(STDIN_FILENO, true, false); 521 if (output_file_spec) { 522 launch_info.AppendOpenFileAction(STDOUT_FILENO, output_file_spec, false, 523 true); 524 launch_info.AppendDuplicateFileAction(STDOUT_FILENO, STDERR_FILENO); 525 } else { 526 launch_info.AppendSuppressFileAction(STDOUT_FILENO, false, true); 527 launch_info.AppendSuppressFileAction(STDERR_FILENO, false, true); 528 } 529 530 std::shared_ptr<ShellInfo> shell_info_sp(new ShellInfo()); 531 const bool monitor_signals = false; 532 launch_info.SetMonitorProcessCallback( 533 std::bind(MonitorShellCommand, shell_info_sp, std::placeholders::_1, 534 std::placeholders::_2, std::placeholders::_3, 535 std::placeholders::_4), 536 monitor_signals); 537 538 error = LaunchProcess(launch_info); 539 const lldb::pid_t pid = launch_info.GetProcessID(); 540 541 if (error.Success() && pid == LLDB_INVALID_PROCESS_ID) 542 error.SetErrorString("failed to get process ID"); 543 544 if (error.Success()) { 545 bool timed_out = false; 546 shell_info_sp->process_reaped.WaitForValueEqualTo( 547 true, std::chrono::seconds(timeout_sec), &timed_out); 548 if (timed_out) { 549 error.SetErrorString("timed out waiting for shell command to complete"); 550 551 // Kill the process since it didn't complete within the timeout specified 552 Kill(pid, SIGKILL); 553 // Wait for the monitor callback to get the message 554 timed_out = false; 555 shell_info_sp->process_reaped.WaitForValueEqualTo( 556 true, std::chrono::seconds(1), &timed_out); 557 } else { 558 if (status_ptr) 559 *status_ptr = shell_info_sp->status; 560 561 if (signo_ptr) 562 *signo_ptr = shell_info_sp->signo; 563 564 if (command_output_ptr) { 565 command_output_ptr->clear(); 566 uint64_t file_size = output_file_spec.GetByteSize(); 567 if (file_size > 0) { 568 if (file_size > command_output_ptr->max_size()) { 569 error.SetErrorStringWithFormat( 570 "shell command output is too large to fit into a std::string"); 571 } else { 572 auto Buffer = 573 DataBufferLLVM::CreateFromPath(output_file_spec.GetPath()); 574 if (error.Success()) 575 command_output_ptr->assign(Buffer->GetChars(), 576 Buffer->GetByteSize()); 577 } 578 } 579 } 580 } 581 } 582 583 llvm::sys::fs::remove(output_file_spec.GetPath()); 584 return error; 585 } 586 587 // The functions below implement process launching for non-Apple-based platforms 588 #if !defined(__APPLE__) 589 Status Host::LaunchProcess(ProcessLaunchInfo &launch_info) { 590 std::unique_ptr<ProcessLauncher> delegate_launcher; 591 #if defined(_WIN32) 592 delegate_launcher.reset(new ProcessLauncherWindows()); 593 #else 594 delegate_launcher.reset(new ProcessLauncherPosixFork()); 595 #endif 596 MonitoringProcessLauncher launcher(std::move(delegate_launcher)); 597 598 Status error; 599 HostProcess process = launcher.LaunchProcess(launch_info, error); 600 601 // TODO(zturner): It would be better if the entire HostProcess were returned 602 // instead of writing 603 // it into this structure. 604 launch_info.SetProcessID(process.GetProcessId()); 605 606 return error; 607 } 608 #endif // !defined(__APPLE__) 609 610 #ifndef _WIN32 611 void Host::Kill(lldb::pid_t pid, int signo) { ::kill(pid, signo); } 612 613 #endif 614 615 #if !defined(__APPLE__) 616 bool Host::OpenFileInExternalEditor(const FileSpec &file_spec, 617 uint32_t line_no) { 618 return false; 619 } 620 621 #endif 622 623 const UnixSignalsSP &Host::GetUnixSignals() { 624 static const auto s_unix_signals_sp = 625 UnixSignals::Create(HostInfo::GetArchitecture()); 626 return s_unix_signals_sp; 627 } 628 629 std::unique_ptr<Connection> Host::CreateDefaultConnection(llvm::StringRef url) { 630 #if defined(_WIN32) 631 if (url.startswith("file://")) 632 return std::unique_ptr<Connection>(new ConnectionGenericFile()); 633 #endif 634 return std::unique_ptr<Connection>(new ConnectionFileDescriptor()); 635 } 636 637 #if defined(LLVM_ON_UNIX) 638 WaitStatus WaitStatus::Decode(int wstatus) { 639 if (WIFEXITED(wstatus)) 640 return {Exit, uint8_t(WEXITSTATUS(wstatus))}; 641 else if (WIFSIGNALED(wstatus)) 642 return {Signal, uint8_t(WTERMSIG(wstatus))}; 643 else if (WIFSTOPPED(wstatus)) 644 return {Stop, uint8_t(WSTOPSIG(wstatus))}; 645 llvm_unreachable("Unknown wait status"); 646 } 647 #endif 648 649 void llvm::format_provider<WaitStatus>::format(const WaitStatus &WS, 650 raw_ostream &OS, 651 StringRef Options) { 652 if (Options == "g") { 653 char type; 654 switch (WS.type) { 655 case WaitStatus::Exit: 656 type = 'W'; 657 break; 658 case WaitStatus::Signal: 659 type = 'X'; 660 break; 661 case WaitStatus::Stop: 662 type = 'S'; 663 break; 664 } 665 OS << formatv("{0}{1:x-2}", type, WS.status); 666 return; 667 } 668 669 assert(Options.empty()); 670 const char *desc; 671 switch(WS.type) { 672 case WaitStatus::Exit: 673 desc = "Exited with status"; 674 break; 675 case WaitStatus::Signal: 676 desc = "Killed by signal"; 677 break; 678 case WaitStatus::Stop: 679 desc = "Stopped by signal"; 680 break; 681 } 682 OS << desc << " " << int(WS.status); 683 } 684