cmProcess.cxx 18 KB

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