Debugging X with GDB

Bernie Innocenti bernie at
Sun Jan 10 16:42:16 PST 2010

Cc'ing the gdb and xorg lists, in case someone knows better.

On Tue, 2010-01-05 at 22:21 -0500, Richard Stallman wrote:
> The version of GDB installed is 6.8, so I guess that is rather old.
> It is important for MIPS gNewSense to have a version of GDB
> which is well maintained for the MIPS.

I asked on #xorg-devel about our issue with ^C not working in gdb.

So, we seems to have encountered a long-standing problem, not related to
MIPS or a specific version of GDB:

<bernie> is it still to be expected that gdb can't stop the X server with ^C ?
<bernie> I'm debugging on a mips platform... it may very well be a platform bug
<bernie> ajax, airlied: maybe one of you knows?
<airlied> bernie: I'm not sure its ever worked for me, I generally kill -INT `pidof Xorg`
<whot> it works if you attach to a running server, not if you start through gdb
<bernie> whot: indeed, I just discovered it
<bernie> I wonder if it's a bug in gdb
<bernie> airlied: thanks for the suggestion, I thought it was just me :)
<airlied> I think X might change TTY state and piss gdb off
<bernie> airlied: oh, good point (although I'm debugging over ssh, it would be a bug for X to attempt changing that tty rather than the actual console)
<bernie> xf86DrvMsg(pScrn->scrnIndex, from, "Using %sware Cursor\n",
<bernie> lol
<nwnk> ^c'ing a running server is expected to work, regardless of how you attached gdb.
<nwnk> if it doesn't it's a bug in gdb or in the kernel's signal delivery code
<bernie> nwnk: I have "NoTrapSignals", but it doesn't help
<bernie> nwnk: I suspect a bug in gdb...
<nwnk> wouldn't be the first
<bernie> nwnk: as a matter of fact, X is resilient to ^C even when running standalone
<whot> really? that'd be news to me
<jcristau> ^c in gdb doesn't send sigint to the traced process though, it sends sigint to gdb
<bernie> whot: only when it's sort of crashed :-)
<bernie> whot: or maybe it's because of the NoTrapSignals
<nwnk> jcristau: right; gdb should then handle it according to whatever you set for 'signal SIGINT', which defaults to 'stop'
<nwnk> excuse me, 'handle SIGINT'
<nwnk> but what often seems to happen is the signal just gets ignored by both

   // Bernie Innocenti -
 \X/  Sugar Labs       -

More information about the xorg-devel mailing list