From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id 0E6423858CDB for ; Sun, 9 Oct 2022 03:59:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0E6423858CDB Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 6552B300089; Sun, 9 Oct 2022 03:59:05 +0000 (UTC) From: Tsukasa OI To: Tsukasa OI , Andrew Burgess , Palmer Dabbelt Cc: gdb-patches@sourceware.org Subject: [RFC PATCH 0/1] gdb/riscv: Cache per-BFD disassembler Date: Sun, 9 Oct 2022 03:59:02 +0000 Message-Id: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Oct 2022 03:59:08 -0000 Hello, On RISC-V, calling the disassembler function (libopcodes) is not a small cost. This is because riscv_get_disassembler function sets the default architecture from given BFD's .riscv.attributes section. However, by default, GDB calls this function for every instruction. This commit replaces RISC-V's disassembler function and stop calling riscv_get_disassembler function if current BFD has not changed. It expects around 30-80% improvements on disassembling relatively large chunk of RISC-V code but most of them will be obscured by a RISC-V disassembler optimization the author is currently working on. Still, 3-5% of performance improvements will remain (due to reduced BFD section reads). [REQUEST FOR COMMENTS] I'm confident that most of BFD contents won't change so dynamically on GDB and caching itself is not a bad idea. Still, I'm not sure whether this usage of "static" variables is okay. I would like to hear your thoughts. Thanks, Tsukasa Tsukasa OI (1): gdb/riscv: Cache per-BFD disassembler gdb/riscv-tdep.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) base-commit: c10a862f17847bc9c50d680c87b87dc51ae4b95e -- 2.34.1