[问题] SIGTRAP handler

楼主: gigigigi (gigigigi)   2016-01-24 17:24:36
https://gist.github.com/anonymous/6a49e6e0982a4c1b59f7
$ gcc -o dbg-int3{,.c} -g && ./dbg-int3
Yes, real routines go here.
跟使用 gdb ./dbg-int3
(gdb) c
Continuing.
No, I don't want to serve you.
为什么印出来结果不同? 是因为 GDB 的确会对 attached process 作 SIGTRAP handler 的拦截处理
所以程式的static void int3_handler(int signo) { being_debugged = 0; } 没作用?
http://blog.linux.org.tw/~jserv/archives/2010/08/ptrace_sigtrap.html
例子是Jserv网站
谢谢

Links booklink

Contact Us: admin [ a t ] ucptt.com