From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79896 invoked by alias); 11 Jan 2017 20:43:03 -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 79771 invoked by uid 89); 11 Jan 2017 20:43:02 -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=Prints, sk:read_me, Hx-languages-length:1479 X-Spam-User: qpsmtpd, 2 recipients 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; Wed, 11 Jan 2017 20:43:00 +0000 Received: by simark.ca (Postfix, from userid 33) id 7E8AD1E851; Wed, 11 Jan 2017 15:42:58 -0500 (EST) To: Yao Qi Subject: Re: [PATCH 1/8] Refactor disassembly code 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: Wed, 11 Jan 2017 20:43:00 -0000 From: Simon Marchi Cc: binutils@sourceware.org, gdb-patches@sourceware.org In-Reply-To: <1484051178-16013-2-git-send-email-yao.qi@linaro.org> References: <1484051178-16013-1-git-send-email-yao.qi@linaro.org> <1484051178-16013-2-git-send-email-yao.qi@linaro.org> Message-ID: <87fd30a805c696a677c56289e7b7b511@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.3 X-IsSubscribed: yes X-SW-Source: 2017-01/txt/msg00197.txt.bz2 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"? > 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. > + > + /* 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.