cmProcess.cxx 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file LICENSE.rst or https://cmake.org/licensing for details. */
  3. #include "cmProcess.h"
  4. #include <csignal>
  5. #include <iostream>
  6. #include <ratio>
  7. #include <string>
  8. #include <utility>
  9. #include <cmext/algorithm>
  10. #include "cmsys/Process.h"
  11. #include "cmCTest.h"
  12. #include "cmCTestRunTest.h"
  13. #include "cmCTestTestHandler.h"
  14. #include "cmGetPipes.h"
  15. #include "cmStringAlgorithms.h"
  16. #if defined(_WIN32)
  17. # include <cm3p/kwiml/int.h>
  18. #endif
  19. #define CM_PROCESS_BUF_SIZE 65536
  20. cmProcess::cmProcess(std::unique_ptr<cmCTestRunTest> runner)
  21. : Runner(std::move(runner))
  22. , Conv(cmProcessOutput::UTF8, CM_PROCESS_BUF_SIZE)
  23. {
  24. this->TotalTime = cmDuration::zero();
  25. this->ExitValue = 0;
  26. this->Id = 0;
  27. this->StartTime = std::chrono::steady_clock::time_point();
  28. }
  29. cmProcess::~cmProcess() = default;
  30. void cmProcess::SetCommand(std::string const& command)
  31. {
  32. this->Command = command;
  33. }
  34. void cmProcess::SetCommandArguments(std::vector<std::string> const& args)
  35. {
  36. this->Arguments = args;
  37. }
  38. void cmProcess::SetWorkingDirectory(std::string const& dir)
  39. {
  40. this->WorkingDirectory = dir;
  41. }
  42. bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
  43. {
  44. this->ProcessState = cmProcess::State::Error;
  45. if (this->Command.empty()) {
  46. return false;
  47. }
  48. this->StartTime = std::chrono::steady_clock::now();
  49. this->SystemStartTime = std::chrono::system_clock::now();
  50. this->ProcessArgs.clear();
  51. // put the command as arg0
  52. this->ProcessArgs.push_back(this->Command.c_str());
  53. // now put the command arguments in
  54. for (std::string const& arg : this->Arguments) {
  55. this->ProcessArgs.push_back(arg.c_str());
  56. }
  57. this->ProcessArgs.push_back(nullptr); // null terminate the list
  58. cm::uv_timer_ptr timer;
  59. int status = timer.init(loop, this);
  60. if (status != 0) {
  61. cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
  62. "Error initializing timer: " << uv_strerror(status)
  63. << std::endl);
  64. return false;
  65. }
  66. cm::uv_pipe_ptr pipe_writer;
  67. cm::uv_pipe_ptr pipe_reader;
  68. pipe_writer.init(loop, 0);
  69. pipe_reader.init(loop, 0, this);
  70. int fds[2] = { -1, -1 };
  71. status = cmGetPipes(fds);
  72. if (status != 0) {
  73. cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
  74. "Error initializing pipe: " << uv_strerror(status)
  75. << std::endl);
  76. return false;
  77. }
  78. uv_pipe_open(pipe_reader, fds[0]);
  79. uv_pipe_open(pipe_writer, fds[1]);
  80. uv_stdio_container_t stdio[3];
  81. stdio[0].flags = UV_INHERIT_FD;
  82. stdio[0].data.fd = 0;
  83. stdio[1].flags = UV_INHERIT_STREAM;
  84. stdio[1].data.stream = pipe_writer;
  85. stdio[2] = stdio[1];
  86. uv_process_options_t options = uv_process_options_t();
  87. options.file = this->Command.data();
  88. options.args = const_cast<char**>(this->ProcessArgs.data());
  89. options.stdio_count = 3; // in, out and err
  90. options.exit_cb = &cmProcess::OnExitCB;
  91. options.stdio = stdio;
  92. #if UV_VERSION_MAJOR > 1 || !defined(CMAKE_USE_SYSTEM_LIBUV)
  93. if (!this->Runner->GetCTest()->GetInteractiveDebugMode()) {
  94. options.flags = UV_PROCESS_WINDOWS_USE_PARENT_ERROR_MODE;
  95. }
  96. #endif
  97. #if !defined(CMAKE_USE_SYSTEM_LIBUV)
  98. std::vector<char> cpumask;
  99. if (affinity && !affinity->empty()) {
  100. cpumask.resize(static_cast<size_t>(uv_cpumask_size()), 0);
  101. for (auto p : *affinity) {
  102. cpumask[p] = 1;
  103. }
  104. options.cpumask = cpumask.data();
  105. options.cpumask_size = cpumask.size();
  106. } else {
  107. options.cpumask = nullptr;
  108. options.cpumask_size = 0;
  109. }
  110. #else
  111. static_cast<void>(affinity);
  112. #endif
  113. status =
  114. uv_read_start(pipe_reader, &cmProcess::OnAllocateCB, &cmProcess::OnReadCB);
  115. if (status != 0) {
  116. cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
  117. "Error starting read events: " << uv_strerror(status)
  118. << std::endl);
  119. return false;
  120. }
  121. status = this->Process.spawn(loop, options, this);
  122. if (status != 0) {
  123. cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
  124. "Process not started\n " << this->Command << "\n["
  125. << uv_strerror(status) << "]\n");
  126. return false;
  127. }
  128. this->PipeReader = std::move(pipe_reader);
  129. this->Timer = std::move(timer);
  130. this->StartTimer();
  131. this->ProcessState = cmProcess::State::Executing;
  132. return true;
  133. }
  134. void cmProcess::StartTimer()
  135. {
  136. if (this->Timeout) {
  137. auto msec =
  138. std::chrono::duration_cast<std::chrono::milliseconds>(*this->Timeout);
  139. this->Timer.start(&cmProcess::OnTimeoutCB,
  140. static_cast<uint64_t>(msec.count()), 0,
  141. cm::uv_update_time::no);
  142. }
  143. }
  144. bool cmProcess::Buffer::GetLine(std::string& line)
  145. {
  146. // Scan for the next newline.
  147. for (size_type sz = this->size(); this->Last != sz; ++this->Last) {
  148. if ((*this)[this->Last] == '\n' || (*this)[this->Last] == '\0') {
  149. // Extract the range first..last as a line.
  150. char const* text = this->data() + this->First;
  151. size_type length = this->Last - this->First;
  152. while (length && text[length - 1] == '\r') {
  153. length--;
  154. }
  155. line.assign(text, length);
  156. // Start a new range for the next line.
  157. ++this->Last;
  158. this->First = this->Last;
  159. // Return the line extracted.
  160. return true;
  161. }
  162. }
  163. // Available data have been exhausted without a newline.
  164. if (this->First != 0) {
  165. // Move the partial line to the beginning of the buffer.
  166. this->erase(this->begin(), this->begin() + this->First);
  167. this->First = 0;
  168. this->Last = this->size();
  169. }
  170. return false;
  171. }
  172. bool cmProcess::Buffer::GetLast(std::string& line)
  173. {
  174. // Return the partial last line, if any.
  175. if (!this->empty()) {
  176. line.assign(this->data(), this->size());
  177. this->First = this->Last = 0;
  178. this->clear();
  179. return true;
  180. }
  181. return false;
  182. }
  183. void cmProcess::OnReadCB(uv_stream_t* stream, ssize_t nread,
  184. uv_buf_t const* buf)
  185. {
  186. auto* self = static_cast<cmProcess*>(stream->data);
  187. self->OnRead(nread, buf);
  188. }
  189. void cmProcess::OnRead(ssize_t nread, uv_buf_t const* buf)
  190. {
  191. std::string line;
  192. if (nread > 0) {
  193. std::string strdata;
  194. this->Conv.DecodeText(buf->base, static_cast<size_t>(nread), strdata);
  195. cm::append(this->Output, strdata);
  196. while (this->Output.GetLine(line)) {
  197. this->Runner->CheckOutput(line);
  198. line.clear();
  199. }
  200. return;
  201. }
  202. if (nread == 0) {
  203. return;
  204. }
  205. // The process will provide no more data.
  206. if (nread != UV_EOF) {
  207. auto error = static_cast<int>(nread);
  208. cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
  209. "Error reading stream: " << uv_strerror(error) << std::endl);
  210. }
  211. // Look for partial last lines.
  212. if (this->Output.GetLast(line)) {
  213. this->Runner->CheckOutput(line);
  214. }
  215. this->ReadHandleClosed = true;
  216. this->PipeReader.reset();
  217. if (this->ProcessHandleClosed) {
  218. uv_timer_stop(this->Timer);
  219. this->Finish();
  220. }
  221. }
  222. void cmProcess::OnAllocateCB(uv_handle_t* handle, size_t suggested_size,
  223. uv_buf_t* buf)
  224. {
  225. auto* self = static_cast<cmProcess*>(handle->data);
  226. self->OnAllocate(suggested_size, buf);
  227. }
  228. void cmProcess::OnAllocate(size_t /*suggested_size*/, uv_buf_t* buf)
  229. {
  230. if (this->Buf.size() != CM_PROCESS_BUF_SIZE) {
  231. this->Buf.resize(CM_PROCESS_BUF_SIZE);
  232. }
  233. *buf =
  234. uv_buf_init(this->Buf.data(), static_cast<unsigned int>(this->Buf.size()));
  235. }
  236. void cmProcess::OnTimeoutCB(uv_timer_t* timer)
  237. {
  238. auto* self = static_cast<cmProcess*>(timer->data);
  239. self->OnTimeout();
  240. }
  241. void cmProcess::OnTimeout()
  242. {
  243. bool const wasExecuting = this->ProcessState == cmProcess::State::Executing;
  244. this->ProcessState = cmProcess::State::Expired;
  245. // If the test process is still executing normally, and we timed out because
  246. // the test timeout was reached, send the custom timeout signal, if any.
  247. if (wasExecuting && this->TimeoutReason_ == TimeoutReason::Normal) {
  248. cmCTestTestHandler::cmCTestTestProperties* p =
  249. this->Runner->GetTestProperties();
  250. if (p->TimeoutSignal) {
  251. this->TerminationStyle = Termination::Custom;
  252. uv_process_kill(this->Process, p->TimeoutSignal->Number);
  253. if (p->TimeoutGracePeriod) {
  254. this->Timeout = *p->TimeoutGracePeriod;
  255. } else {
  256. static cmDuration const defaultGracePeriod{ 1.0 };
  257. this->Timeout = defaultGracePeriod;
  258. }
  259. this->StartTimer();
  260. return;
  261. }
  262. }
  263. this->TerminationStyle = Termination::Forced;
  264. bool const was_still_reading = !this->ReadHandleClosed;
  265. if (!this->ReadHandleClosed) {
  266. this->ReadHandleClosed = true;
  267. this->PipeReader.reset();
  268. }
  269. if (!this->ProcessHandleClosed) {
  270. // Kill the child and let our on-exit handler finish the test.
  271. cmsysProcess_KillPID(static_cast<unsigned long>(this->Process->pid));
  272. } else if (was_still_reading) {
  273. // Our on-exit handler already ran but did not finish the test
  274. // because we were still reading output. We've just dropped
  275. // our read handler, so we need to finish the test now.
  276. this->Finish();
  277. }
  278. }
  279. void cmProcess::OnExitCB(uv_process_t* process, int64_t exit_status,
  280. int term_signal)
  281. {
  282. auto* self = static_cast<cmProcess*>(process->data);
  283. self->OnExit(exit_status, term_signal);
  284. }
  285. void cmProcess::OnExit(int64_t exit_status, int term_signal)
  286. {
  287. if (this->ProcessState != cmProcess::State::Expired) {
  288. if (
  289. #if defined(_WIN32)
  290. ((DWORD)exit_status & 0xF0000000) == 0xC0000000
  291. #else
  292. term_signal != 0
  293. #endif
  294. ) {
  295. this->ProcessState = cmProcess::State::Exception;
  296. } else {
  297. this->ProcessState = cmProcess::State::Exited;
  298. }
  299. }
  300. // Record exit information.
  301. this->ExitValue = exit_status;
  302. this->Signal = term_signal;
  303. this->ProcessHandleClosed = true;
  304. if (this->ReadHandleClosed) {
  305. uv_timer_stop(this->Timer);
  306. this->Finish();
  307. }
  308. }
  309. void cmProcess::Finish()
  310. {
  311. this->TotalTime = std::chrono::steady_clock::now() - this->StartTime;
  312. // Because of a processor clock scew the runtime may become slightly
  313. // negative. If someone changed the system clock while the process was
  314. // running this may be even more. Make sure not to report a negative
  315. // duration here.
  316. if (this->TotalTime <= cmDuration::zero()) {
  317. this->TotalTime = cmDuration::zero();
  318. }
  319. this->Runner->FinalizeTest();
  320. }
  321. cmProcess::State cmProcess::GetProcessStatus()
  322. {
  323. return this->ProcessState;
  324. }
  325. void cmProcess::ChangeTimeout(cmDuration t)
  326. {
  327. this->Timeout = t;
  328. this->StartTimer();
  329. }
  330. void cmProcess::ResetStartTime()
  331. {
  332. this->StartTime = std::chrono::steady_clock::now();
  333. }
  334. cmProcess::Exception cmProcess::GetExitException() const
  335. {
  336. auto exception = Exception::None;
  337. #if defined(_WIN32) && !defined(__CYGWIN__)
  338. auto exit_code = (DWORD)this->ExitValue;
  339. if ((exit_code & 0xF0000000) != 0xC0000000) {
  340. return exception;
  341. }
  342. if (exit_code) {
  343. switch (exit_code) {
  344. case STATUS_DATATYPE_MISALIGNMENT:
  345. case STATUS_ACCESS_VIOLATION:
  346. case STATUS_IN_PAGE_ERROR:
  347. case STATUS_INVALID_HANDLE:
  348. case STATUS_NONCONTINUABLE_EXCEPTION:
  349. case STATUS_INVALID_DISPOSITION:
  350. case STATUS_ARRAY_BOUNDS_EXCEEDED:
  351. case STATUS_STACK_OVERFLOW:
  352. exception = Exception::Fault;
  353. break;
  354. case STATUS_FLOAT_DENORMAL_OPERAND:
  355. case STATUS_FLOAT_DIVIDE_BY_ZERO:
  356. case STATUS_FLOAT_INEXACT_RESULT:
  357. case STATUS_FLOAT_INVALID_OPERATION:
  358. case STATUS_FLOAT_OVERFLOW:
  359. case STATUS_FLOAT_STACK_CHECK:
  360. case STATUS_FLOAT_UNDERFLOW:
  361. # ifdef STATUS_FLOAT_MULTIPLE_FAULTS
  362. case STATUS_FLOAT_MULTIPLE_FAULTS:
  363. # endif
  364. # ifdef STATUS_FLOAT_MULTIPLE_TRAPS
  365. case STATUS_FLOAT_MULTIPLE_TRAPS:
  366. # endif
  367. case STATUS_INTEGER_DIVIDE_BY_ZERO:
  368. case STATUS_INTEGER_OVERFLOW:
  369. exception = Exception::Numerical;
  370. break;
  371. case STATUS_CONTROL_C_EXIT:
  372. exception = Exception::Interrupt;
  373. break;
  374. case STATUS_ILLEGAL_INSTRUCTION:
  375. case STATUS_PRIVILEGED_INSTRUCTION:
  376. exception = Exception::Illegal;
  377. break;
  378. default:
  379. exception = Exception::Other;
  380. }
  381. }
  382. #else
  383. if (this->Signal) {
  384. switch (this->Signal) {
  385. case SIGSEGV:
  386. exception = Exception::Fault;
  387. break;
  388. case SIGFPE:
  389. exception = Exception::Numerical;
  390. break;
  391. case SIGINT:
  392. exception = Exception::Interrupt;
  393. break;
  394. case SIGILL:
  395. exception = Exception::Illegal;
  396. break;
  397. default:
  398. exception = Exception::Other;
  399. }
  400. }
  401. #endif
  402. return exception;
  403. }
  404. std::string cmProcess::GetExitExceptionString() const
  405. {
  406. std::string exception_str;
  407. #if defined(_WIN32)
  408. switch (this->ExitValue) {
  409. case STATUS_CONTROL_C_EXIT:
  410. exception_str = "User interrupt";
  411. break;
  412. case STATUS_FLOAT_DENORMAL_OPERAND:
  413. exception_str = "Floating-point exception (denormal operand)";
  414. break;
  415. case STATUS_FLOAT_DIVIDE_BY_ZERO:
  416. exception_str = "Divide-by-zero";
  417. break;
  418. case STATUS_FLOAT_INEXACT_RESULT:
  419. exception_str = "Floating-point exception (inexact result)";
  420. break;
  421. case STATUS_FLOAT_INVALID_OPERATION:
  422. exception_str = "Invalid floating-point operation";
  423. break;
  424. case STATUS_FLOAT_OVERFLOW:
  425. exception_str = "Floating-point overflow";
  426. break;
  427. case STATUS_FLOAT_STACK_CHECK:
  428. exception_str = "Floating-point stack check failed";
  429. break;
  430. case STATUS_FLOAT_UNDERFLOW:
  431. exception_str = "Floating-point underflow";
  432. break;
  433. # ifdef STATUS_FLOAT_MULTIPLE_FAULTS
  434. case STATUS_FLOAT_MULTIPLE_FAULTS:
  435. exception_str = "Floating-point exception (multiple faults)";
  436. break;
  437. # endif
  438. # ifdef STATUS_FLOAT_MULTIPLE_TRAPS
  439. case STATUS_FLOAT_MULTIPLE_TRAPS:
  440. exception_str = "Floating-point exception (multiple traps)";
  441. break;
  442. # endif
  443. case STATUS_INTEGER_DIVIDE_BY_ZERO:
  444. exception_str = "Integer divide-by-zero";
  445. break;
  446. case STATUS_INTEGER_OVERFLOW:
  447. exception_str = "Integer overflow";
  448. break;
  449. case STATUS_DATATYPE_MISALIGNMENT:
  450. exception_str = "Datatype misalignment";
  451. break;
  452. case STATUS_ACCESS_VIOLATION:
  453. exception_str = "Access violation";
  454. break;
  455. case STATUS_IN_PAGE_ERROR:
  456. exception_str = "In-page error";
  457. break;
  458. case STATUS_INVALID_HANDLE:
  459. exception_str = "Invalid handle";
  460. break;
  461. case STATUS_NONCONTINUABLE_EXCEPTION:
  462. exception_str = "Noncontinuable exception";
  463. break;
  464. case STATUS_INVALID_DISPOSITION:
  465. exception_str = "Invalid disposition";
  466. break;
  467. case STATUS_ARRAY_BOUNDS_EXCEEDED:
  468. exception_str = "Array bounds exceeded";
  469. break;
  470. case STATUS_STACK_OVERFLOW:
  471. exception_str = "Stack overflow";
  472. break;
  473. case STATUS_ILLEGAL_INSTRUCTION:
  474. exception_str = "Illegal instruction";
  475. break;
  476. case STATUS_PRIVILEGED_INSTRUCTION:
  477. exception_str = "Privileged instruction";
  478. break;
  479. case STATUS_NO_MEMORY:
  480. default:
  481. char buf[1024];
  482. char const* fmt = "Exit code 0x%" KWIML_INT_PRIx64 "\n";
  483. snprintf(buf, sizeof(buf), fmt, this->ExitValue);
  484. exception_str.assign(buf);
  485. }
  486. #else
  487. switch (this->Signal) {
  488. # ifdef SIGSEGV
  489. case SIGSEGV:
  490. exception_str = "Segmentation fault";
  491. break;
  492. # endif
  493. # ifdef SIGBUS
  494. # if !defined(SIGSEGV) || SIGBUS != SIGSEGV
  495. case SIGBUS:
  496. exception_str = "Bus error";
  497. break;
  498. # endif
  499. # endif
  500. # ifdef SIGFPE
  501. case SIGFPE:
  502. exception_str = "Floating-point exception";
  503. break;
  504. # endif
  505. # ifdef SIGILL
  506. case SIGILL:
  507. exception_str = "Illegal instruction";
  508. break;
  509. # endif
  510. # ifdef SIGINT
  511. case SIGINT:
  512. exception_str = "User interrupt";
  513. break;
  514. # endif
  515. # ifdef SIGABRT
  516. case SIGABRT:
  517. exception_str = "Subprocess aborted";
  518. break;
  519. # endif
  520. # ifdef SIGKILL
  521. case SIGKILL:
  522. exception_str = "Subprocess killed";
  523. break;
  524. # endif
  525. # ifdef SIGTERM
  526. case SIGTERM:
  527. exception_str = "Subprocess terminated";
  528. break;
  529. # endif
  530. # ifdef SIGHUP
  531. case SIGHUP:
  532. exception_str = "SIGHUP";
  533. break;
  534. # endif
  535. # ifdef SIGQUIT
  536. case SIGQUIT:
  537. exception_str = "SIGQUIT";
  538. break;
  539. # endif
  540. # ifdef SIGTRAP
  541. case SIGTRAP:
  542. exception_str = "SIGTRAP";
  543. break;
  544. # endif
  545. # ifdef SIGIOT
  546. # if !defined(SIGABRT) || SIGIOT != SIGABRT
  547. case SIGIOT:
  548. exception_str = "SIGIOT";
  549. break;
  550. # endif
  551. # endif
  552. # ifdef SIGUSR1
  553. case SIGUSR1:
  554. exception_str = "SIGUSR1";
  555. break;
  556. # endif
  557. # ifdef SIGUSR2
  558. case SIGUSR2:
  559. exception_str = "SIGUSR2";
  560. break;
  561. # endif
  562. # ifdef SIGPIPE
  563. case SIGPIPE:
  564. exception_str = "SIGPIPE";
  565. break;
  566. # endif
  567. # ifdef SIGALRM
  568. case SIGALRM:
  569. exception_str = "SIGALRM";
  570. break;
  571. # endif
  572. # ifdef SIGSTKFLT
  573. case SIGSTKFLT:
  574. exception_str = "SIGSTKFLT";
  575. break;
  576. # endif
  577. # ifdef SIGCHLD
  578. case SIGCHLD:
  579. exception_str = "SIGCHLD";
  580. break;
  581. # elif defined(SIGCLD)
  582. case SIGCLD:
  583. exception_str = "SIGCLD";
  584. break;
  585. # endif
  586. # ifdef SIGCONT
  587. case SIGCONT:
  588. exception_str = "SIGCONT";
  589. break;
  590. # endif
  591. # ifdef SIGSTOP
  592. case SIGSTOP:
  593. exception_str = "SIGSTOP";
  594. break;
  595. # endif
  596. # ifdef SIGTSTP
  597. case SIGTSTP:
  598. exception_str = "SIGTSTP";
  599. break;
  600. # endif
  601. # ifdef SIGTTIN
  602. case SIGTTIN:
  603. exception_str = "SIGTTIN";
  604. break;
  605. # endif
  606. # ifdef SIGTTOU
  607. case SIGTTOU:
  608. exception_str = "SIGTTOU";
  609. break;
  610. # endif
  611. # ifdef SIGURG
  612. case SIGURG:
  613. exception_str = "SIGURG";
  614. break;
  615. # endif
  616. # ifdef SIGXCPU
  617. case SIGXCPU:
  618. exception_str = "SIGXCPU";
  619. break;
  620. # endif
  621. # ifdef SIGXFSZ
  622. case SIGXFSZ:
  623. exception_str = "SIGXFSZ";
  624. break;
  625. # endif
  626. # ifdef SIGVTALRM
  627. case SIGVTALRM:
  628. exception_str = "SIGVTALRM";
  629. break;
  630. # endif
  631. # ifdef SIGPROF
  632. case SIGPROF:
  633. exception_str = "SIGPROF";
  634. break;
  635. # endif
  636. # ifdef SIGWINCH
  637. case SIGWINCH:
  638. exception_str = "SIGWINCH";
  639. break;
  640. # endif
  641. # ifdef SIGPOLL
  642. case SIGPOLL:
  643. exception_str = "SIGPOLL";
  644. break;
  645. # endif
  646. # ifdef SIGIO
  647. # if !defined(SIGPOLL) || SIGIO != SIGPOLL
  648. case SIGIO:
  649. exception_str = "SIGIO";
  650. break;
  651. # endif
  652. # endif
  653. # ifdef SIGPWR
  654. case SIGPWR:
  655. exception_str = "SIGPWR";
  656. break;
  657. # endif
  658. # ifdef SIGSYS
  659. case SIGSYS:
  660. exception_str = "SIGSYS";
  661. break;
  662. # endif
  663. # ifdef SIGUNUSED
  664. # if !defined(SIGSYS) || SIGUNUSED != SIGSYS
  665. case SIGUNUSED:
  666. exception_str = "SIGUNUSED";
  667. break;
  668. # endif
  669. # endif
  670. default:
  671. exception_str = cmStrCat("Signal ", this->Signal);
  672. }
  673. #endif
  674. return exception_str;
  675. }