15 std::ostringstream oss;
16 oss <<
"0x" << std::setfill(
'0') << std::setw(16) << std::hex << std::uppercase << value;
21 std::ostringstream oss;
22 oss <<
"0x" << std::setfill(
'0') << std::setw(8) << std::hex << std::uppercase << value;
27 std::ostringstream oss;
28 oss <<
"0x" << std::setfill(
'0') << std::setw(4) << std::hex << std::uppercase << value;
33 std::ostringstream oss;
34 oss <<
"0x" << std::setfill(
'0') << std::setw(2) << std::hex << std::uppercase << static_cast<unsigned>(value);
39 std::ostringstream stream;
40 stream << std::hex << std::uppercase << value;
47 return "SIGHUP (Hangup)";
49 return "SIGINT (Interrupt)";
51 return "SIGQUIT (Quit)";
53 return "SIGILL (Illegal instruction)";
55 return "SIGTRAP (Trace/breakpoint trap)";
57 return "SIGABRT (Aborted)";
59 return "SIGBUS (Bus error)";
61 return "SIGFPE (Floating point exception)";
63 return "SIGKILL (Killed)";
65 return "SIGUSR1 (User defined signal 1)";
67 return "SIGSEGV (Segmentation fault)";
69 return "SIGUSR2 (User defined signal 2)";
71 return "SIGPIPE (Broken pipe)";
73 return "SIGALRM (Alarm clock)";
75 return "SIGTERM (Terminated)";
77 return "SIGCHLD (Child exited)";
79 return "SIGCONT (Continued)";
81 return "SIGSTOP (Stopped)";
83 return "SIGTSTP (Stopped (tty input))";
85 return "SIGTTIN (Stopped (tty input))";
87 return "SIGTTOU (Stopped (tty output))";
89 return "SIGURG (Urgent I/O condition)";
91 return "SIGXCPU (CPU time limit exceeded)";
93 return "SIGXFSZ (File size limit exceeded)";
95 return "SIGVTALRM (Virtual timer expired)";
97 return "SIGPROF (Profiling timer expired)";
99 return "SIGWINCH (Window size changed)";
101 return "SIGIO (I/O possible)";
103 return "SIGPWR (Power failure)";
105 return "SIGSYS (Bad system call)";
108 if (sig >= SIGRTMIN && sig <= SIGRTMAX) {
109 std::ostringstream oss;
110 oss <<
"SIGRTMIN+" << (sig - SIGRTMIN) <<
" (Real-time signal)";
114 std::ostringstream oss;
115 oss <<
"Unknown signal (" << sig <<
")";
Exception class, hex formatting utilities, and terminal color definitions.
std::string format_hex8(uint8_t value)
Format an 8-bit value as a hex string with 0x prefix.
std::string format_signal(uint32_t sig)
Format a signal number as a descriptive string.
std::string format_hex64(uint64_t value)
Format a 64-bit value as a hex string with 0x prefix.
std::string format_hex32(uint32_t value)
Format a 32-bit value as a hex string with 0x prefix.
std::string format_hex_no_prefix(uint64_t value)
Format a 64-bit value as a hex string without 0x prefix.
std::string format_hex16(uint16_t value)
Format a 16-bit value as a hex string with 0x prefix.