What useful GDB scripts have you used/written?

Posted by nik on Stack Overflow See other posts from Stack Overflow or by nik
Published on 2009-07-07T19:14:54Z Indexed on 2010/04/15 0:33 UTC
Read the original article Hit count: 458

Filed under:
|
|
|

People use gdb on and off for debugging, of course there are lots of other debugging tools across the varied OSes, with and without GUI and, maybe other fancy IDE features.

I would like to know what useful gdb scripts you have written and liked.
While, I do not mean a dump of commands in a something.gdb file that you source to pull out a bunch of data, if that made your day, go ahead and talk about it.

  • Lets think conditional processing, control loops and functions written for more elegant and refined programming to debug and, maybe even for whitebox testing
  • Things get interesting when you start debugging remote systems (say, over a serial/ethernet interface)
  • And, what if the target is a multi-processor (and, multithreaded) system

Let me put a simple case as an example...
Say,

A script that traversed serially over entries
to locate a bad entry in a large hash-table
that is implemented on an embedded platform.

That helped me debug a broken hash-table once.

© Stack Overflow or respective owner

Related posts about gdb

Related posts about scripting