开发者

How to debug SIGTRAP using gdb?

开发者 https://www.devze.com 2023-04-03 08:20 出处:网络
My own program uses SIGTRAP signal. I want to use gdb to debug my program. However, when the SIGTRAP is raised in my program, gdb cannot go in开发者_运维百科to my trap handler.

My own program uses SIGTRAP signal. I want to use gdb to debug my program. However, when the SIGTRAP is raised in my program, gdb cannot go in开发者_运维百科to my trap handler.

How to single step into my trap handler?


I am not sure if it will work for you, but try to use sigaction to turn off your signal handler (within your signal handler), and than raise SIGTRAP again.

That should raise the signal to the OS, which will call the debugger (hopefully). afterwards use sigaction again to register you own handler.

0

精彩评论

暂无评论...
验证码 换一张
取 消