This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Duel reloaded: Duel.py (and a PrettyPrinter decorator)
- From: Sergei Golubchik <vuvova at gmail dot com>
- To: gdb at sourceware dot org
- Date: Mon, 19 Jun 2017 11:03:42 +0200
- Subject: Duel reloaded: Duel.py (and a PrettyPrinter decorator)
- Authentication-results: sourceware.org; auth=none
Hi,
If you've never heard about Duel - it's an insanely cool data
exploration language for gdb. Specifically designed to print out complex
data structures in one command. Created as a public domain patch for gdb
in 1993, but never got accepted for licensing reasons.
Still, Duel is super-convenient, for example, to print the whole linked
list one writes just
(gdb) dl head-->next->val
and to print field 'name' of every element in an array of structures,
one writes
(gdb) dl arr[..100].name
I've recently rewritten it in Python, so it doesn't need to be compiled
with gdb anymore, one can load it run-time (e.g. from .gdbinit).
Here it is: https://github.com/vuvova/gdb-tools
This repository also includes a helper to simplify writing pretty
printers. It removes all the boilerplate code that gdb requires, you
only need to write the value-to-string function itself.
Enjoy!
Regards,
Sergei