Scripting GDB For a stack trace

I got a stack trace generated from an application like this:

Backtrace[0] 0xee8df698 eip 0x87c3b39
Backtrace[1] 0xee8df6e8 eip 0x87c9dbc
Backtrace[2] 0xee8df838 eip 0x85e3f19

And so on. Here’s how I converted it to something useful:

Copy and past the trace into emacs.

Mark the top left corner (ctrl-space)

Move to the last line, right at the end of the eip.

Alt-X kill-rectangle.

This is a great way to do editing by columns in emacs.

Added the words “info symbol to the begging of each line. I did this by first cutting a return chacter, then doing a search and replace, pasting in the cut ‘return’ as the search criteria, andreplaceing it with the ‘return’ followed by “info symbol “. I use this hack a lot to modify the start or end of all the lines in a file.

Once done, I ran

gdb –command=~adyoung/bugs/myapp/backtrace.txt ./myapp core

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.