flyingbin
flyingbin

Reputation: 1097

How to debug SIGTRAP using gdb?

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 into my trap handler.

How to single step into my trap handler?

Upvotes: 1

Views: 2655

Answers (1)

Guy L
Guy L

Reputation: 2954

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.

Upvotes: 0

Related Questions