cmProcess.cxx 18 KB

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