tools

Presentation of tools I’m using or I was using when developing software with C++ languange.

Table of Content:

_____________________________________________________

cgdb

It’s terminal application that is a little similar to vim text editor by means of display and key bindings. It’s based on gdb, but it has one feature that is really helpful for me. The main window is divided in two parts: upper and lower one. The upper one presents the source code of currently debugging application, and the lower one is just the same as the window from the gdb.

You can see current line marker (green arrow), breakpoint (line number marked in red) and source code lines before and after the current one. To switch from lower window (which is the default) to the source code window you just press ESC button. To get back to the gdb window, press “i” button (like entering insert mode in vim).

When you are in source code window, you can move the code up and down using arrows (or j and k keys like in vim). You can also search strings by typing “/”. Pressing space will create or delete breakpoint (if there was any) in the current line.

_____________________________________________________

pstack

Prints a stack trace of running processes. This tool helped me couple of times when I had to debug multithreaded application that are already started, because it prints stack trace of each thread in the process. When an application hangs because of i.e. wrongly used locks, you can use it. It prints similar output to the gdb one (with gdb you have to attach to the currently running process and print information about threads “i th”), but is just faster to type: “pstack <pid>”.
_____________________________________________________

strace

Traces the system calls of the program. It will help you when you are trying to find out what system calls are used by the program. I haven’t used it much but I saw when my teammate solve a very hard to find problem in a second after using it.

  1. No comments yet.
  1. No trackbacks yet.

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: