Extending gdbserver to support an strace client

Extending gdbserver to support an strace client

The strace command traces system calls and signals, deciding them and their corresponding arguments into a symbolic form. A frequent debugging request from developers is the ability to allow strace to trace system calls for a program that is also being debugged by GDB, like this:

% gdb --args test-program
(gdb) b main
Breakpoint 1 at 0x40128e: file test-program.c, line 22.
(gdb) run
Starting program: test-program
Breakpoint 1, main (argc=3, argv=0x7fffffffdb98) at test-program.c:22
22 int thread_count = 2;

In another terminal window, we invoke strace on the same process GDB is debugging:

% strace -p $(pgrep -f test-program)
strace: attach: ptrace(PTRACE_SEIZE, 27882): Operation not permitted

The culprit here is that the ptrace system call, which is used by both GDB and strace to control the execution of programs, and does not allow both strace and GDB to control the same process.

Continue reading “Extending gdbserver to support an strace client”


ltrace for RHEL 6 and 7

Debugging software is something akin to an art form but, regardless of the approach you prefer, having good information on what’s happening in your application is key. ltrace is one tool you may wish to add to your belt – a debugging tool that attaches to a running process, and prints to the terminal or a log file the library calls and/or system calls made by that process. In both its mode of operation and command line interface, ltrace is similar to strace. While strace only works for system calls, however, ltrace has no such restriction.

Continue reading “ltrace for RHEL 6 and 7”


RHEL Developer Toolkit 2.0 now in beta

Just under a year ago, we introduced the Red Hat Enterprise Linux Developer Toolset 1.0 which provides the latest, stable open source developer tool versions at an accelerated cadence than that of Red Hat Enterprise Linux.  That version started with gcc 4.7 and gdb 7.4.  Since then, we’ve added V1.1 with some additional components and today we are announcing V2.0  beta that adds Eclipse, and more:

Continue reading RHEL Developer Toolkit 2.0 now in beta