title: How to get the thread which has just hit breakpoint when the debuger receive SIGTRAP?
body: <p>I'm not using gdb, I'm developing a debuger like gdb on linux.</p>
  
  <p>I can receive SIGTRAP in my debugger process, but I don't know how to get the right thread which hit the breakpoint in target process.</p>
  
  <p>First I guess I should use ptrace(PTRACE_GETSIGINFO, ...) to get a siginfo_t, but there seems no attribute in siginfo_t can tell me the thread id.</p>
  
  <p>Then I think maybe I can get something from the signal, and match the breakpoint information in debugger, so I downloaded gdb source code (7.10), but OMG it's too large, I can't get the relevant functions.</p>
  
  <p>so I'm here now, could someone help me?</p>