From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97764 invoked by alias); 19 Jun 2017 09:04:00 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 97736 invoked by uid 89); 19 Jun 2017 09:03:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=enjoy!, 1993, exploration, printers X-HELO: mail.askmonty.org Received: from mail.askmonty.org (HELO mail.askmonty.org) (173.203.201.185) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Jun 2017 09:03:57 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.askmonty.org (Postfix) with ESMTP id 51EE1813218 for ; Mon, 19 Jun 2017 09:04:00 +0000 (UTC) Received: from mail.askmonty.org ([127.0.0.1]) by localhost (mail.askmonty.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ARxeCI+sYCRS for ; Mon, 19 Jun 2017 09:03:56 +0000 (UTC) Received: from meddwl (dslb-088-077-220-049.088.077.pools.vodafone-ip.de [88.77.220.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: serg) by mail.askmonty.org (Postfix) with ESMTPSA id EFBDA813217 for ; Mon, 19 Jun 2017 09:03:55 +0000 (UTC) Date: Mon, 19 Jun 2017 09:04:00 -0000 From: Sergei Golubchik To: gdb@sourceware.org Subject: Duel reloaded: Duel.py (and a PrettyPrinter decorator) Message-ID: <20170619090342.GA9305@meddwl.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2017-06/txt/msg00014.txt.bz2 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