From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28355 invoked by alias); 19 Jun 2017 09:18:47 -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 28311 invoked by uid 89); 19 Jun 2017 09:18:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=1993, exploration, sk:technic, printers X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Jun 2017 09:18:43 +0000 Received: by simark.ca (Postfix, from userid 33) id A562E1E4A2; Mon, 19 Jun 2017 05:18:46 -0400 (EDT) To: Sergei Golubchik Subject: Re: Duel reloaded: Duel.py (and a PrettyPrinter decorator) X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 19 Jun 2017 09:18:00 -0000 From: Simon Marchi Cc: gdb@sourceware.org In-Reply-To: <20170619090342.GA9305@meddwl.fritz.box> References: <20170619090342.GA9305@meddwl.fritz.box> Message-ID: <2dcff9eb662d42f4d8be8d12295c7d64@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.5 X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00015.txt.bz2 On 2017-06-19 11:03, Sergei Golubchik wrote: > 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 That's indeed very nice, I didn't know about it. The alternative of these lines using only built-in gdb features would be to write a small while loop, I guess. So I can see how this can be convenient. > 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. I really like using an annotation for declaring a pretty printer. I wonder if we could (legally-wise and technically-wise) steal that idea :). Simon