Peeter Joot's (OLD) Blog.

Math, physics, perl, and programming obscurity.

gdb signal SIGCONT and pause()

Posted by peeterjoot on July 15, 2009

Anybody used to debugging on AIX is probably familiar with the convienence of the handy pause() function. Put a call to this in your program where you want to get the debugger attached, and let it run. Once you attach dbx you can ‘next’ past the pause() function to the code you want to debug.

This doesn’t work on Linux, and I found out the magic trick today. Attach gdb, find your thread, and set a breakpoint at a good spot past the pause() call. Then, do:

(gdb) signal SIGCONT

Voila. You’ll then hit your breakpoint, and can find the bug or walk through the code and learn it’s behaviour, …

Note that unlike the kill command, gdb doesn’t take cont or sigcont as allowable variations of SIGCONT.

EDIT: I can no longer get this to work with gdb 7.0. If anybody knows why I would be interested.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: