0

Came across this doc: https://idea.popcount.org/2012-12-11-linux-process-states/ (a bit old). It says ptrace is handling debugee's signals by receiving SIGCHLD. Is GDB relying on this? Related, does GDB get notification when signal handler is set to "noprint nostop pass"? Further, the doc above says, in the case of ptrace, system blocks debuggee when some signal happens, until debugger finishes handling and continues debugee by waitpid(). Is this still the case nowadays?

Thanks in advance!

Xiao Wu
  • 45
  • 5

1 Answers1

0

The answer is "yes" to every single question you posed, except:

and continues debugee by waitpid()

The waitpid doesn't continue debuggee, merely waits for it. The "continue" is done with (surprise!) ptrace(PTRACE_CONT, ...).

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • Thanks for the answer! – Xiao Wu Nov 26 '17 at 16:45
  • Does GDB trace SIGCHLD all the time as long as it attaches to debuggee? From my experience of using GDB, looks like GDB does not listen to SIGCHLD initially. When some break point is hit or Ctrl+C is input, GDB begin to trace the debuggee. Is that the case? Is there way to not listen to SIGCHLD totally? – Xiao Wu Nov 26 '17 at 16:51
  • "Does GDB trace SIGCHLD all the time" -- yes. It's the nature of `PTRACE_ATTACH`. "From my experience ..." -- yes, I have seen your other question. Your experience must have some other explanation. – Employed Russian Nov 26 '17 at 17:06