how to use gdb to debug program with signal handler

how to use gdb to debug program with signal handler
1. compile with debug options
2. start your program with gdb
3. change the default signal behaviour for gdb with below command:
(when received SIGINT signal, gdb stop, print message, and pass this signal to program)
handle SIGINT stop print pass
4. use catch signal SIGINT to set breakpoint for SIGINT signal
5. run program and send signal to your program, then gdb will stop

PS: signal SIGINT can send signal to program
handle SIGINT can list the gdb current signal setting

https://blog.csdn.net/haoyuedangkong_fei/article/details/49336137

猜你喜欢

转载自blog.csdn.net/lantianjialiang/article/details/81187175