1

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?

Jolta
  • 2,620
  • 1
  • 29
  • 42
flyingbin
  • 1,097
  • 2
  • 11
  • 28
  • 2
    try `handle SIGTRAP pass nostop`, though I think having a `SIGTRAP` handler could be problematic (GDB also complains about it). – user786653 Sep 07 '11 at 06:45
  • Thanks! I tried it, but it doesn't work. I still cannot single step into the trap handler. – flyingbin Sep 07 '11 at 15:45

1 Answers1

0

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.

Guy L
  • 2,824
  • 2
  • 27
  • 37