We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
# include <unistd.h> # include <signal.h> # include <string.h> # include <stdlib.h> static int fds[2]; static void sgsgvhndlr (int signr) { write (fds[1], &signr, 1); _Exit (EXIT_FAILURE); } static int err (int exit_code, char *msg) { write (STDERR_FILENO, msg, strlen (msg)); write (STDERR_FILENO, "\n", 1); _Exit (EXIT_FAILURE); } int main (void) { int rc; pid_t pid; rc = pipe (fds); if (rc != 0) err (EXIT_FAILURE, "pipe"); pid = fork (); if (pid == -1) err (EXIT_FAILURE, "fork"); if (pid) { rc = read (fds[0], &pid, 1); if (rc - 1) err (EXIT_FAILURE, "read"); write (STDOUT_FILENO, "gdb\n", 4); /* execute gdb */ return EXIT_SUCCESS; } else { struct sigaction sa = {0,}; sa.sa_handler = sgsgvhndlr; rc = sigaction (SIGSEGV, &sa, NULL); if (rc) err (EXIT_SUCCESS, "sigaction"); return *(char*)0; } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: