What useful GDB scripts have you used/written?

debugging, gdb, scripting

Solution

This script, not written by me, pretty prints STL containers, such as vector, map, etc: http://www.yolinux.com/TUTORIALS/src/dbinit_stl_views-1.03.txt

Totally awesome.

Problem

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.

Original source