Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Quoted from here.

gdb puts the debugged process in its own pgrp and sets the terminal to that pgrp. (Try e.g. ps j on the PIDs of gdb and your program being debugged.)

And what does it mean by

ps j on the PIDs of gdb and your program being debugged

does that mean ps j PID?

I don't get anything special from this though...

Basically I don't understand what that article is talking about,can anyone explain it in more great details?

share|improve this question

A “pgrp” is a process group. ps j lists the process group ID (the column is called PGID). The PGID of a process is typically itself or its parent's process group, but can be arbitrarily set with setpgid(). Process groups control what processes receive job control signals. I think gdb moves the process to its own group so as to avoid having the process receive job control signals that would mess up gdb's control over the process.

The bug report is about using gdb with a program that uses sigwait. sigwait allows a process to receive a signal in an underhand way: instead of being delivered to the process in the usual manner, the signal is removed from the pending queue and sigwait returns. This is mainly useful to arrange for a signal to be always delivered to a particular thread: block the signal, but have a thread consume it by running sigwait.

Since the signal is not actually delivered to the process, ptrace sees nothing, and so gdb isn't notified that the process has underhandedly consumed the signal.

The debate in the bug report is about whether the kernel should be modified so that ptrace sees something when the signal is consumed through sigwait, or whether gdb should handle this situation differently. I don't know enough about this to take sides.

share|improve this answer
Do you understand the explanation in that bug that says it's not a bug? – locale Jun 10 '11 at 7:41
@locale: I've expanded my answer, but deciding whether it's a bug or not is beyond my level of expertise. P.S. This is getting really into developper territory; I've recommended that your question be migrated to Stack Overflow, and I recommend that you create an account there and associate it with your Server Fault account. – Gilles Jun 10 '11 at 9:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.