Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <signal.h>
- #include <sys/types.h>
- #include <ucontext.h>
- #include <stdio.h>
- #include <unistd.h>
- void handler (int sig, siginfo_t *si, ucontext_t *ctx)
- {
- stack_t st = ctx->uc_stack;
- size_t *retp = ctx->uc_mcontext.mc_rsp;
- printf ("%p\n", ctx->uc_mcontext.mc_rip);
- int i;
- for (i=0; i<30; i++)
- {
- printf ("%p\n", *(retp+i));
- }
- }
- void lol () {kill (getpid(), SIGINT);}
- int main()
- {
- printf ("%i\n", sizeof (size_t));
- struct sigaction sa;
- sigemptyset (&sa.sa_mask);
- sa.sa_flags = SA_RESETHAND | SA_SIGINFO;
- sa.sa_sigaction = handler;
- sigaction (SIGINT, &sa, NULL);
- lol();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement