Add an error message for exec failures to the signal_demo, resolves #111

This commit is contained in:
Jeremy 2024-04-18 19:38:19 -05:00
parent 2526a38c16
commit 5a1f4b6d37
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4
2 changed files with 6 additions and 0 deletions

View File

@ -147,6 +147,9 @@ void do_signal_safe_trace(cpptrace::frame_ptr* buffer, std::size_t size) {
close(input_pipe.read_end);
close(input_pipe.write_end);
execl("signal_tracer", "signal_tracer", nullptr);
const char* exec_failure_message = "exec(signal_tracer) failed: Make sure the signal_tracer executable is in "
"the current working directory and the binary's permissions are correct.\n";
write(STDERR_FILENO, exec_failure_message, strlen(exec_failure_message));
_exit(1);
}
// Resolve to safe_object_frames and write those to the pipe

View File

@ -52,6 +52,9 @@ void handler(int signo, siginfo_t* info, void* context) {
"signal_tracer",
nullptr
);
const char* exec_failure_message = "exec(signal_tracer) failed: Make sure the signal_tracer executable is in "
"the current working directory and the binary's permissions are correct.\n";
write(STDERR_FILENO, exec_failure_message, strlen(exec_failure_message));
_exit(1);
}
for(std::size_t i = 0; i < count; i++) {