From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20004 invoked by alias); 2 Feb 2017 01:20:57 -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 19994 invoked by uid 89); 2 Feb 2017 01:20:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=H*f:sk:0c624f1, H*i:sk:0c624f1 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; Thu, 02 Feb 2017 01:20:55 +0000 Received: by simark.ca (Postfix, from userid 33) id 9FF5B1E166; Wed, 1 Feb 2017 20:20:53 -0500 (EST) To: Pedro Alves Subject: Re: [PATCH v4 1/2] Add back gdb_pretty_print_insn 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: Thu, 02 Feb 2017 01:20:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org In-Reply-To: <0c624f14-cd12-289d-a0a5-6cd56b79a376@redhat.com> References: <1485909045-30285-1-git-send-email-palves@redhat.com> <1485909045-30285-2-git-send-email-palves@redhat.com> <31c02e39-d45f-8b65-2ff5-c21582d0f43d@redhat.com> <3d886f4f-ba53-4ef6-3767-a7fe8a17ba85@redhat.com> <0c624f14-cd12-289d-a0a5-6cd56b79a376@redhat.com> Message-ID: <91f689224629236a3be67f06d3b01557@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.3 X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg00061.txt.bz2 On 2017-02-01 18:50, Pedro Alves wrote: > On 02/01/2017 08:31 PM, Pedro Alves wrote: > >> reuse both. Which suggests creating a new struct to hold >> whatever should survive across calls. And then we can >> go the step further, and make that a class, with >> pretty_print_insn a method of _that_ class instead of >> of gdb_disassembler. Like: >> >> I can try that, but I think I'd rather do it after >> string_file is in already. > > Here's what it looks like, on top of the v4 series. I think it looks good, it doesn't really add any complexity. > diff --git a/gdb/disasm.h b/gdb/disasm.h > index dffe9cd..a03eba6 100644 > --- a/gdb/disasm.h > +++ b/gdb/disasm.h > @@ -97,11 +97,34 @@ extern void gdb_disassembly (struct gdbarch > *gdbarch, struct ui_out *uiout, > extern int gdb_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr, > struct ui_file *stream, int *branch_delay_insns); > > -/* Prints the instruction INSN into UIOUT and returns the length of > - the printed instruction in bytes. */ > +/* Class used to pretty-print an instruction. */ I'd say "...to pretty-print instructions.", since the goal is to reuse it for multiple instructions.