cmProcess.cxx 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  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 "cmAlgorithms.h"
  5. #include "cmCTest.h"
  6. #include "cmCTestRunTest.h"
  7. #include "cmCTestTestHandler.h"
  8. #include "cmGetPipes.h"
  9. #include "cmsys/Process.h"
  10. #include <iostream>
  11. #include <signal.h>
  12. #include <string>
  13. #if defined(_WIN32)
  14. # include "cm_kwiml.h"
  15. #endif
  16. #include <utility>
  17. #define CM_PROCESS_BUF_SIZE 65536
  18. cmProcess::cmProcess(cmCTestRunTest& runner)
  19. : Runner(runner)
  20. , Conv(cmProcessOutput::UTF8, CM_PROCESS_BUF_SIZE)
  21. {
  22. this->Timeout = cmDuration::zero();
  23. this->TotalTime = cmDuration::zero();
  24. this->ExitValue = 0;
  25. this->Id = 0;
  26. this->StartTime = std::chrono::steady_clock::time_point();
  27. }
  28. cmProcess::~cmProcess() = default;
  29. void cmProcess::SetCommand(std::string const& command)
  30. {
  31. this->Command = command;
  32. }
  33. void cmProcess::SetCommandArguments(std::vector<std::string> const& args)
  34. {
  35. this->Arguments = args;
  36. }
  37. void cmProcess::SetWorkingDirectory(std::string const& dir)
  38. {
  39. this->WorkingDirectory = dir;
  40. }
  41. bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity)
  42. {
  43. this->ProcessState = cmProcess::State::Error;
  44. if (this->Command.empty()) {
  45. return false;
  46. }
  47. this->StartTime = std::chrono::steady_clock::now();
  48. this->ProcessArgs.clear();
  49. // put the command as arg0
  50. this->ProcessArgs.push_back(this->Command.c_str());
  51. // now put the command arguments in
  52. for (std::string const& arg : this->Arguments) {
  53. this->ProcessArgs.push_back(arg.c_str());
  54. }
  55. this->ProcessArgs.push_back(nullptr); // null terminate the list
  56. cm::uv_timer_ptr timer;
  57. int status = timer.init(loop, this);
  58. if (status != 0) {
  59. cmCTestLog(this->Runner.GetCTest(), ERROR_MESSAGE,
  60. "Error initializing timer: " << uv_strerror(status)
  61. << std::endl);
  62. return false;
  63. }
  64. cm::uv_pipe_ptr pipe_writer;
  65. cm::uv_pipe_ptr pipe_reader;
  66. pipe_writer.init(loop, 0);
  67. pipe_reader.init(loop, 0, this);
  68. int fds[2] = { -1, -1 };
  69. status = cmGetPipes(fds);
  70. if (status != 0) {
  71. cmCTestLog(this->Runner.GetCTest(), ERROR_MESSAGE,
  72. "Error initializing pipe: " << uv_strerror(status)
  73. << std::endl);
  74. return false;
  75. }
  76. uv_pipe_open(pipe_reader, fds[0]);
  77. uv_pipe_open(pipe_writer, fds[1]);
  78. uv_stdio_container_t stdio[3];
  79. stdio[0].flags = UV_INHERIT_FD;
  80. stdio[0].data.fd = 0;
  81. stdio[1].flags = UV_INHERIT_STREAM;
  82. stdio[1].data.stream = pipe_writer;
  83. stdio[2] = stdio[1];
  84. uv_process_options_t options = uv_process_options_t();
  85. options.file = this->Command.data();
  86. options.args = const_cast<char**>(this->ProcessArgs.data());
  87. options.stdio_count = 3; // in, out and err
  88. options.exit_cb = &cmProcess::OnExitCB;
  89. options.stdio = stdio;
  90. #if !defined(CMAKE_USE_SYSTEM_LIBUV)
  91. std::vector<char> cpumask;
  92. if (affinity && !affinity->empty()) {
  93. cpumask.resize(static_cast<size_t>(uv_cpumask_size()), 0);
  94. for (auto p : *affinity) {
  95. cpumask[p] = 1;
  96. }
  97. options.cpumask = cpumask.data();
  98. options.cpumask_size = cpumask.size();
  99. } else {
  100. options.cpumask = nullptr;
  101. options.cpumask_size = 0;
  102. }
  103. #else
  104. static_cast<void>(affinity);
  105. #endif
  106. status =
  107. uv_read_start(pipe_reader, &cmProcess::OnAllocateCB, &cmProcess::OnReadCB);
  108. if (status != 0) {
  109. cmCTestLog(this->Runner.GetCTest(), ERROR_MESSAGE,
  110. "Error starting read events: " << uv_strerror(status)
  111. << std::endl);
  112. return false;
  113. }
  114. status = this->Process.spawn(loop, options, this);
  115. if (status != 0) {
  116. cmCTestLog(this->Runner.GetCTest(), ERROR_MESSAGE,
  117. "Process not started\n " << this->Command << "\n["
  118. << uv_strerror(status) << "]\n");
  119. return false;
  120. }
  121. this->PipeReader = std::move(pipe_reader);
  122. this->Timer = std::move(timer);
  123. this->StartTimer();
  124. this->ProcessState = cmProcess::State::Executing;
  125. return true;
  126. }
  127. void cmProcess::StartTimer()
  128. {
  129. auto properties = this->Runner.GetTestProperties();
  130. auto msec =
  131. std::chrono::duration_cast<std::chrono::milliseconds>(this->Timeout);
  132. if (msec != std::chrono::milliseconds(0) || !properties->ExplicitTimeout) {
  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 = 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. cmAppend(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->Runner.FinalizeTest();
  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. if (this->ProcessState != cmProcess::State::Executing) {
  237. return;
  238. }
  239. this->ProcessState = cmProcess::State::Expired;
  240. bool const was_still_reading = !this->ReadHandleClosed;
  241. if (!this->ReadHandleClosed) {
  242. this->ReadHandleClosed = true;
  243. this->PipeReader.reset();
  244. }
  245. if (!this->ProcessHandleClosed) {
  246. // Kill the child and let our on-exit handler finish the test.
  247. cmsysProcess_KillPID(static_cast<unsigned long>(this->Process->pid));
  248. } else if (was_still_reading) {
  249. // Our on-exit handler already ran but did not finish the test
  250. // because we were still reading output. We've just dropped
  251. // our read handler, so we need to finish the test now.
  252. this->Runner.FinalizeTest();
  253. }
  254. }
  255. void cmProcess::OnExitCB(uv_process_t* process, int64_t exit_status,
  256. int term_signal)
  257. {
  258. auto self = static_cast<cmProcess*>(process->data);
  259. self->OnExit(exit_status, term_signal);
  260. }
  261. void cmProcess::OnExit(int64_t exit_status, int term_signal)
  262. {
  263. if (this->ProcessState != cmProcess::State::Expired) {
  264. if (
  265. #if defined(_WIN32)
  266. ((DWORD)exit_status & 0xF0000000) == 0xC0000000
  267. #else
  268. term_signal != 0
  269. #endif
  270. ) {
  271. this->ProcessState = cmProcess::State::Exception;
  272. } else {
  273. this->ProcessState = cmProcess::State::Exited;
  274. }
  275. }
  276. // Record exit information.
  277. this->ExitValue = exit_status;
  278. this->Signal = term_signal;
  279. this->TotalTime = std::chrono::steady_clock::now() - this->StartTime;
  280. // Because of a processor clock scew the runtime may become slightly
  281. // negative. If someone changed the system clock while the process was
  282. // running this may be even more. Make sure not to report a negative
  283. // duration here.
  284. if (this->TotalTime <= cmDuration::zero()) {
  285. this->TotalTime = cmDuration::zero();
  286. }
  287. this->ProcessHandleClosed = true;
  288. if (this->ReadHandleClosed) {
  289. uv_timer_stop(this->Timer);
  290. this->Runner.FinalizeTest();
  291. }
  292. }
  293. cmProcess::State cmProcess::GetProcessStatus()
  294. {
  295. return this->ProcessState;
  296. }
  297. void cmProcess::ChangeTimeout(cmDuration t)
  298. {
  299. this->Timeout = t;
  300. this->StartTimer();
  301. }
  302. void cmProcess::ResetStartTime()
  303. {
  304. this->StartTime = std::chrono::steady_clock::now();
  305. }
  306. cmProcess::Exception cmProcess::GetExitException()
  307. {
  308. auto exception = Exception::None;
  309. #if defined(_WIN32) && !defined(__CYGWIN__)
  310. auto exit_code = (DWORD)this->ExitValue;
  311. if ((exit_code & 0xF0000000) != 0xC0000000) {
  312. return exception;
  313. }
  314. if (exit_code) {
  315. switch (exit_code) {
  316. case STATUS_DATATYPE_MISALIGNMENT:
  317. case STATUS_ACCESS_VIOLATION:
  318. case STATUS_IN_PAGE_ERROR:
  319. case STATUS_INVALID_HANDLE:
  320. case STATUS_NONCONTINUABLE_EXCEPTION:
  321. case STATUS_INVALID_DISPOSITION:
  322. case STATUS_ARRAY_BOUNDS_EXCEEDED:
  323. case STATUS_STACK_OVERFLOW:
  324. exception = Exception::Fault;
  325. break;
  326. case STATUS_FLOAT_DENORMAL_OPERAND:
  327. case STATUS_FLOAT_DIVIDE_BY_ZERO:
  328. case STATUS_FLOAT_INEXACT_RESULT:
  329. case STATUS_FLOAT_INVALID_OPERATION:
  330. case STATUS_FLOAT_OVERFLOW:
  331. case STATUS_FLOAT_STACK_CHECK:
  332. case STATUS_FLOAT_UNDERFLOW:
  333. # ifdef STATUS_FLOAT_MULTIPLE_FAULTS
  334. case STATUS_FLOAT_MULTIPLE_FAULTS:
  335. # endif
  336. # ifdef STATUS_FLOAT_MULTIPLE_TRAPS
  337. case STATUS_FLOAT_MULTIPLE_TRAPS:
  338. # endif
  339. case STATUS_INTEGER_DIVIDE_BY_ZERO:
  340. case STATUS_INTEGER_OVERFLOW:
  341. exception = Exception::Numerical;
  342. break;
  343. case STATUS_CONTROL_C_EXIT:
  344. exception = Exception::Interrupt;
  345. break;
  346. case STATUS_ILLEGAL_INSTRUCTION:
  347. case STATUS_PRIVILEGED_INSTRUCTION:
  348. exception = Exception::Illegal;
  349. break;
  350. default:
  351. exception = Exception::Other;
  352. }
  353. }
  354. #else
  355. if (this->Signal) {
  356. switch (this->Signal) {
  357. case SIGSEGV:
  358. exception = Exception::Fault;
  359. break;
  360. case SIGFPE:
  361. exception = Exception::Numerical;
  362. break;
  363. case SIGINT:
  364. exception = Exception::Interrupt;
  365. break;
  366. case SIGILL:
  367. exception = Exception::Illegal;
  368. break;
  369. default:
  370. exception = Exception::Other;
  371. }
  372. }
  373. #endif
  374. return exception;
  375. }
  376. std::string cmProcess::GetExitExceptionString()
  377. {
  378. std::string exception_str;
  379. #if defined(_WIN32)
  380. switch (this->ExitValue) {
  381. case STATUS_CONTROL_C_EXIT:
  382. exception_str = "User interrupt";
  383. break;
  384. case STATUS_FLOAT_DENORMAL_OPERAND:
  385. exception_str = "Floating-point exception (denormal operand)";
  386. break;
  387. case STATUS_FLOAT_DIVIDE_BY_ZERO:
  388. exception_str = "Divide-by-zero";
  389. break;
  390. case STATUS_FLOAT_INEXACT_RESULT:
  391. exception_str = "Floating-point exception (inexact result)";
  392. break;
  393. case STATUS_FLOAT_INVALID_OPERATION:
  394. exception_str = "Invalid floating-point operation";
  395. break;
  396. case STATUS_FLOAT_OVERFLOW:
  397. exception_str = "Floating-point overflow";
  398. break;
  399. case STATUS_FLOAT_STACK_CHECK:
  400. exception_str = "Floating-point stack check failed";
  401. break;
  402. case STATUS_FLOAT_UNDERFLOW:
  403. exception_str = "Floating-point underflow";
  404. break;
  405. # ifdef STATUS_FLOAT_MULTIPLE_FAULTS
  406. case STATUS_FLOAT_MULTIPLE_FAULTS:
  407. exception_str = "Floating-point exception (multiple faults)";
  408. break;
  409. # endif
  410. # ifdef STATUS_FLOAT_MULTIPLE_TRAPS
  411. case STATUS_FLOAT_MULTIPLE_TRAPS:
  412. exception_str = "Floating-point exception (multiple traps)";
  413. break;
  414. # endif
  415. case STATUS_INTEGER_DIVIDE_BY_ZERO:
  416. exception_str = "Integer divide-by-zero";
  417. break;
  418. case STATUS_INTEGER_OVERFLOW:
  419. exception_str = "Integer overflow";
  420. break;
  421. case STATUS_DATATYPE_MISALIGNMENT:
  422. exception_str = "Datatype misalignment";
  423. break;
  424. case STATUS_ACCESS_VIOLATION:
  425. exception_str = "Access violation";
  426. break;
  427. case STATUS_IN_PAGE_ERROR:
  428. exception_str = "In-page error";
  429. break;
  430. case STATUS_INVALID_HANDLE:
  431. exception_str = "Invalid handle";
  432. break;
  433. case STATUS_NONCONTINUABLE_EXCEPTION:
  434. exception_str = "Noncontinuable exception";
  435. break;
  436. case STATUS_INVALID_DISPOSITION:
  437. exception_str = "Invalid disposition";
  438. break;
  439. case STATUS_ARRAY_BOUNDS_EXCEEDED:
  440. exception_str = "Array bounds exceeded";
  441. break;
  442. case STATUS_STACK_OVERFLOW:
  443. exception_str = "Stack overflow";
  444. break;
  445. case STATUS_ILLEGAL_INSTRUCTION:
  446. exception_str = "Illegal instruction";
  447. break;
  448. case STATUS_PRIVILEGED_INSTRUCTION:
  449. exception_str = "Privileged instruction";
  450. break;
  451. case STATUS_NO_MEMORY:
  452. default:
  453. char buf[1024];
  454. const char* fmt = "Exit code 0x%" KWIML_INT_PRIx64 "\n";
  455. _snprintf(buf, 1024, fmt, this->ExitValue);
  456. exception_str.assign(buf);
  457. }
  458. #else
  459. switch (this->Signal) {
  460. # ifdef SIGSEGV
  461. case SIGSEGV:
  462. exception_str = "Segmentation fault";
  463. break;
  464. # endif
  465. # ifdef SIGBUS
  466. # if !defined(SIGSEGV) || SIGBUS != SIGSEGV
  467. case SIGBUS:
  468. exception_str = "Bus error";
  469. break;
  470. # endif
  471. # endif
  472. # ifdef SIGFPE
  473. case SIGFPE:
  474. exception_str = "Floating-point exception";
  475. break;
  476. # endif
  477. # ifdef SIGILL
  478. case SIGILL:
  479. exception_str = "Illegal instruction";
  480. break;
  481. # endif
  482. # ifdef SIGINT
  483. case SIGINT:
  484. exception_str = "User interrupt";
  485. break;
  486. # endif
  487. # ifdef SIGABRT
  488. case SIGABRT:
  489. exception_str = "Child aborted";
  490. break;
  491. # endif
  492. # ifdef SIGKILL
  493. case SIGKILL:
  494. exception_str = "Child killed";
  495. break;
  496. # endif
  497. # ifdef SIGTERM
  498. case SIGTERM:
  499. exception_str = "Child terminated";
  500. break;
  501. # endif
  502. # ifdef SIGHUP
  503. case SIGHUP:
  504. exception_str = "SIGHUP";
  505. break;
  506. # endif
  507. # ifdef SIGQUIT
  508. case SIGQUIT:
  509. exception_str = "SIGQUIT";
  510. break;
  511. # endif
  512. # ifdef SIGTRAP
  513. case SIGTRAP:
  514. exception_str = "SIGTRAP";
  515. break;
  516. # endif
  517. # ifdef SIGIOT
  518. # if !defined(SIGABRT) || SIGIOT != SIGABRT
  519. case SIGIOT:
  520. exception_str = "SIGIOT";
  521. break;
  522. # endif
  523. # endif
  524. # ifdef SIGUSR1
  525. case SIGUSR1:
  526. exception_str = "SIGUSR1";
  527. break;
  528. # endif
  529. # ifdef SIGUSR2
  530. case SIGUSR2:
  531. exception_str = "SIGUSR2";
  532. break;
  533. # endif
  534. # ifdef SIGPIPE
  535. case SIGPIPE:
  536. exception_str = "SIGPIPE";
  537. break;
  538. # endif
  539. # ifdef SIGALRM
  540. case SIGALRM:
  541. exception_str = "SIGALRM";
  542. break;
  543. # endif
  544. # ifdef SIGSTKFLT
  545. case SIGSTKFLT:
  546. exception_str = "SIGSTKFLT";
  547. break;
  548. # endif
  549. # ifdef SIGCHLD
  550. case SIGCHLD:
  551. exception_str = "SIGCHLD";
  552. break;
  553. # elif defined(SIGCLD)
  554. case SIGCLD:
  555. exception_str = "SIGCLD";
  556. break;
  557. # endif
  558. # ifdef SIGCONT
  559. case SIGCONT:
  560. exception_str = "SIGCONT";
  561. break;
  562. # endif
  563. # ifdef SIGSTOP
  564. case SIGSTOP:
  565. exception_str = "SIGSTOP";
  566. break;
  567. # endif
  568. # ifdef SIGTSTP
  569. case SIGTSTP:
  570. exception_str = "SIGTSTP";
  571. break;
  572. # endif
  573. # ifdef SIGTTIN
  574. case SIGTTIN:
  575. exception_str = "SIGTTIN";
  576. break;
  577. # endif
  578. # ifdef SIGTTOU
  579. case SIGTTOU:
  580. exception_str = "SIGTTOU";
  581. break;
  582. # endif
  583. # ifdef SIGURG
  584. case SIGURG:
  585. exception_str = "SIGURG";
  586. break;
  587. # endif
  588. # ifdef SIGXCPU
  589. case SIGXCPU:
  590. exception_str = "SIGXCPU";
  591. break;
  592. # endif
  593. # ifdef SIGXFSZ
  594. case SIGXFSZ:
  595. exception_str = "SIGXFSZ";
  596. break;
  597. # endif
  598. # ifdef SIGVTALRM
  599. case SIGVTALRM:
  600. exception_str = "SIGVTALRM";
  601. break;
  602. # endif
  603. # ifdef SIGPROF
  604. case SIGPROF:
  605. exception_str = "SIGPROF";
  606. break;
  607. # endif
  608. # ifdef SIGWINCH
  609. case SIGWINCH:
  610. exception_str = "SIGWINCH";
  611. break;
  612. # endif
  613. # ifdef SIGPOLL
  614. case SIGPOLL:
  615. exception_str = "SIGPOLL";
  616. break;
  617. # endif
  618. # ifdef SIGIO
  619. # if !defined(SIGPOLL) || SIGIO != SIGPOLL
  620. case SIGIO:
  621. exception_str = "SIGIO";
  622. break;
  623. # endif
  624. # endif
  625. # ifdef SIGPWR
  626. case SIGPWR:
  627. exception_str = "SIGPWR";
  628. break;
  629. # endif
  630. # ifdef SIGSYS
  631. case SIGSYS:
  632. exception_str = "SIGSYS";
  633. break;
  634. # endif
  635. # ifdef SIGUNUSED
  636. # if !defined(SIGSYS) || SIGUNUSED != SIGSYS
  637. case SIGUNUSED:
  638. exception_str = "SIGUNUSED";
  639. break;
  640. # endif
  641. # endif
  642. default:
  643. exception_str = "Signal ";
  644. exception_str += std::to_string(this->Signal);
  645. }
  646. #endif
  647. return exception_str;
  648. }