[問題] 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