From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85919 invoked by alias); 12 Jan 2017 12:19:25 -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 85897 invoked by uid 89); 12 Jan 2017 12:19:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=0.2 required=5.0 tests=AWL,BAYES_40,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=H*r:AES128-SHA, Prints, =e5=b0=a7, sk:read_me?= X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-wj0-f195.google.com Received: from mail-wj0-f195.google.com (HELO mail-wj0-f195.google.com) (209.85.210.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Jan 2017 12:19:23 +0000 Received: by mail-wj0-f195.google.com with SMTP id qs7so1677280wjc.1; Thu, 12 Jan 2017 04:19:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=aY46DB6xS3QsMTkb1biVRMpUF3iGWjIhiDlJb0+GA+0=; b=qMzPsC6Ee5/4E1IBRoxEY1vxvHmHo7heijSNQKzVQM9yqyww6nHw+XyZoc+XAGo8wN giL4yUG2XKv9mp/bc85ylzQtey3VIDNtlKFZvdRTdAM6jvLIsTUGwtTxsb05UQ3g/ghh Lp3bieUxgn8+ksel0XE9dgITubfPyrm0jXJKdafDggdTgyznANCGGigyLLkZhPYRlygF UkkuLkSmG6JwEFG7aVvNZYEPIshgrFh3ULdl0HyH0a3piO+daop1coWthEpNopHUaGcK kalmyiFGyfrtd2O5J3+IsNxfU2Q7Dkhq04A0h/f4tVvIN/gHQzhyr+rFYzRMzaS9gBUR hisQ== X-Gm-Message-State: AIkVDXKz+TjZtNpXqjekcAcSwoAyDBKuuWrQaZAe7rxqjxxTQWX+vr0vVxApxxSNw9RsvA== X-Received: by 10.194.64.197 with SMTP id q5mr1760223wjs.204.1484223561363; Thu, 12 Jan 2017 04:19:21 -0800 (PST) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id ct7sm13393758wjc.2.2017.01.12.04.19.18 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 12 Jan 2017 04:19:20 -0800 (PST) Date: Thu, 12 Jan 2017 12:19:00 -0000 From: Yao Qi To: Simon Marchi Cc: binutils@sourceware.org, gdb-patches@sourceware.org Subject: Re: [PATCH 1/8] Refactor disassembly code Message-ID: <20170112121909.GC31406@E107787-LIN> References: <1484051178-16013-1-git-send-email-yao.qi@linaro.org> <1484051178-16013-2-git-send-email-yao.qi@linaro.org> <87fd30a805c696a677c56289e7b7b511@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87fd30a805c696a677c56289e7b7b511@polymtl.ca> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2017-01/txt/msg00217.txt.bz2 On 17-01-11 15:42:58, Simon Marchi wrote: > On 2017-01-10 07:26, Yao Qi wrote: > >@@ -761,15 +768,15 @@ fprintf_disasm (void *stream, const char > >*format, ...) > > return 0; > > } > > > >-struct disassemble_info > >-gdb_disassemble_info (struct gdbarch *gdbarch, struct ui_file *file) > >+gdb_disassembler::gdb_disassembler (struct gdbarch *gdbarch, > >+ struct ui_file *file, > >+ di_read_memory_ftype func) > > Perhaps name this parameter "read_memory_func"? > OK. > >diff --git a/gdb/disasm.h b/gdb/disasm.h > >index 4c6fd54..5592cdb 100644 > >--- a/gdb/disasm.h > >+++ b/gdb/disasm.h > >@@ -33,6 +33,48 @@ struct gdbarch; > > struct ui_out; > > struct ui_file; > > > >+class gdb_disassembler > >+{ > >+ using di_read_memory_ftype = decltype > >(disassemble_info::read_memory_func); > >+ > >+public: > >+ gdb_disassembler (struct gdbarch *gdbarch, struct ui_file *file) > >+ : gdb_disassembler (gdbarch, file, dis_asm_read_memory) > >+ {} > >+ > >+ int print_insn (CORE_ADDR memaddr); > >+ int print_insn (CORE_ADDR memaddr, int *branch_delay_insns); > > Not very important, but since print_insn(CORE_ADDR) is trivial, you > could merge those two methods and provide a default parameter value > of NULL for branch_delay_insns. OK. Fixed them locally. > > >+ > >+ /* Prints the instruction INSN into UIOUT and returns the length of > >+ the printed instruction in bytes. */ > >+ int pretty_print_insn (struct ui_out *uiout, > >+ const struct disasm_insn *insn, int flags); > > It could be a good time to modernize the flags parameter and make it > an enum flag. > This can be done later. -- Yao (齐尧)