From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122531 invoked by alias); 25 Jan 2016 11:41:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 122512 invoked by uid 89); 25 Jan 2016 11:41:30 -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,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=4bx, Hx-languages-length:1513, completeness, letter X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 25 Jan 2016 11:41:29 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 88B4FC0AC917; Mon, 25 Jan 2016 11:41:28 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0PBfRxG016916; Mon, 25 Jan 2016 06:41:27 -0500 Message-ID: <56A609E7.6050903@redhat.com> Date: Mon, 25 Jan 2016 11:41:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Toshihito Kikuchi , "gdb-patches@sourceware.org" Subject: Re: [PATCH] Add a new format letter to dump instructions backward References: <1827952218.466587.1453670934999.JavaMail.yahoo.ref@mail.yahoo.com> <1827952218.466587.1453670934999.JavaMail.yahoo@mail.yahoo.com> In-Reply-To: <1827952218.466587.1453670934999.JavaMail.yahoo@mail.yahoo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-01/txt/msg00613.txt.bz2 On 01/24/2016 09:28 PM, Toshihito Kikuchi wrote: > Hi all, > Hi there. > With the attached patch, I'd like to add a new format letter "j" to > the "x" command to dump instructions in backward direction. Thanks. What's the rationale for making this a format letter though? It seems orthogonal to the other format letters to me. Example, say I dump raw opcodes in hex, with: (gdb) x /4x main 0x400766
: 0x55 0x48 0x89 0xe5 (gdb) x /4x 0x40076a : 0x48 0x83 0xec 0x30 (gdb) x 0x40076e : 0x48 (gdb) 0x40076f : 0xc7 but then I can't go backwards in hex, as /j overrides it, and always prints like /i: (gdb) x /4xj 0x400766
: push %rbp 0x400767 : mov %rsp,%rbp 0x40076a : sub $0x30,%rsp => 0x40076e : movq $0x0,-0x8(%rbp) Seems to me that some other UI would be better. E.g.,: #1 - a different switch, like "x -back /i " ? #2 - a different command, like "bx" ? #3 - negative repeat counts ? (gdb) x /4i // next 4 instructions (gdb) x /-4i // previous 4 instructions (gdb) x /4bx // next 4 bytes, in hex (gdb) x /-4bx // previous 4 bytes, in hex Added #1 just for completeness, I don't find it very convenient. #3 feels natural to me. What do you (and others) think? Adding some tests would be great. Also, the documentation will need to be updated. If you haven't yet, please take a look at: https://sourceware.org/gdb/wiki/ContributionChecklist Thanks, Pedro Alves