From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75993 invoked by alias); 16 May 2017 10:49:01 -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 75360 invoked by uid 89); 16 May 2017 10:48:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=delegate, 3-4, HERE X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-pg0-f50.google.com Received: from mail-pg0-f50.google.com (HELO mail-pg0-f50.google.com) (74.125.83.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 May 2017 10:48:20 +0000 Received: by mail-pg0-f50.google.com with SMTP id u28so74657733pgn.1; Tue, 16 May 2017 03:48:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=7LHOhDy9tMTrdPjejOn2TW84TQLtT2kM2etO8aFaDhM=; b=qkE/E0ZaBYlvlsFevdnmoH6IjbOwWEU/7+J/cMAsqn8gA6HIOtT3DFp7OfavW5ZPZT yG7wEr46u/duOcrbnf0HY0hXTqhgzMcLX5Sl/5BZsnT7LYAIM7cI0CB4XPxDg8N6CLNC kUkEGrqnErT0/l/bxhA2LFhUq8A9YL6JKSFjyvSo7LYViA/lWTTYj7dVAE23quDPRQ2E EvnwLcARJXW8pHuv3NlOxq34kRg3Osd7sQo+moBZ0WY1oLlu8kn9kvKb0c3gOpqOj7jW 2lbzwr/zVipbYOQrZSdrXaCFZWP4rOzGH7hVWntcWSgpm2fZKG8xxJZUGV5b8K8pI6mf Makw== X-Gm-Message-State: AODbwcBNaSj1Gkb+RCmEvoNoLJdC9BSsBYK3tIbcrCXmw3EdVebQKrDo EA+OOMqOkfPUfNqD X-Received: by 10.98.6.132 with SMTP id 126mr11370448pfg.197.1494931702054; Tue, 16 May 2017 03:48:22 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc114.osuosl.org. [140.211.9.72]) by smtp.gmail.com with ESMTPSA id e64sm26559372pfl.49.2017.05.16.03.48.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 May 2017 03:48:21 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: binutils@sourceware.org, gdb-patches@sourceware.org Subject: [PATCH 0/6] Unify the disassembler selection in gdb and objdump Date: Tue, 16 May 2017 10:49:00 -0000 Message-Id: <1494931698-15309-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg00336.txt.bz2 Nowadays, we have opcodes library which provides disassembler for each architecture (print_insn_XX functions), and gdb, objdump and sim use them. However, they (at least gdb and objdump) select disassembler in different places, so this causes some duplicated code and inconsistencies. This patch series change gdb selecting disassembler through opcodes/disassemble.c:disassembler in default, but there are still some targets select their disassemblers in their own way (AFAICS, they can be changed to disassemble.c:disassembler too in the follow up patches). Patch #1 refactor the code. Patch #2 does the major change in this series, but only apply to the obvious places. Patch #3-4 do the similar changes too, but not as obvious as patch #2. Patch #5 fixes the inconsistency of rs6000 disassembler selection. As a result of these changes, a lot of print_insn_XXX functions are no longer needed out side of opcodes library, so patch #6, as an RFC, moves these function declarations from include/dis-asm.h to an internal header in opcodes/. If this series is on the right track, I'll change the rest of gdb ports (like arm, mips, aarch64, etc) to default disassembler selection. The series is tested for gdb on x86_64-linux and ppc64-linux (gcc110). It is also tested for binutils/ld/gas on x86_64-linux with all targets enabled. *** BLURB HERE *** Yao Qi (6): Refactor disassembler selection Delegate opcodes to select disassembler in GDB Use disassble.c:disassembler select h8300 disassembler Use disassble.c:disassembler select rl78 disassembler Use disassble.c:disassembler select rs6000 disassembler Move print_insn_XXX to an opcodes internal header binutils/objdump.c | 4 +- gdb/alpha-tdep.c | 3 -- gdb/arc-tdep.c | 2 - gdb/arch-utils.c | 20 ++++++++++ gdb/arch-utils.h | 2 + gdb/avr-tdep.c | 1 - gdb/bfin-tdep.c | 1 - gdb/cris-tdep.c | 18 --------- gdb/frv-tdep.c | 1 - gdb/ft32-tdep.c | 2 - gdb/gdbarch.c | 4 +- gdb/gdbarch.sh | 2 +- gdb/h8300-tdep.c | 4 -- gdb/hppa-tdep.c | 2 - gdb/iq2000-tdep.c | 1 - gdb/lm32-tdep.c | 3 -- gdb/m32c-tdep.c | 3 -- gdb/m32r-tdep.c | 2 - gdb/m68hc11-tdep.c | 11 ----- gdb/m68k-tdep.c | 4 -- gdb/m88k-tdep.c | 2 - gdb/microblaze-tdep.c | 2 - gdb/mn10300-tdep.c | 2 - gdb/moxie-tdep.c | 2 - gdb/msp430-tdep.c | 3 -- gdb/mt-tdep.c | 1 - gdb/nds32-tdep.c | 2 - gdb/nios2-tdep.c | 14 ------- gdb/rl78-tdep.c | 3 -- gdb/rs6000-tdep.c | 14 ------- gdb/rx-tdep.c | 2 - gdb/s390-linux-tdep.c | 2 - gdb/score-tdep.c | 10 ----- gdb/sh-tdep.c | 1 - gdb/sh64-tdep.c | 2 - gdb/sparc-tdep.c | 2 - gdb/tic6x-tdep.c | 10 ----- gdb/tilegx-tdep.c | 2 - gdb/v850-tdep.c | 2 - gdb/vax-tdep.c | 2 - gdb/xstormy16-tdep.c | 2 - gdb/xtensa-tdep.c | 2 - include/dis-asm.h | 88 ++++------------------------------------ opcodes/alpha-dis.c | 2 +- opcodes/avr-dis.c | 2 +- opcodes/bfin-dis.c | 2 +- opcodes/cr16-dis.c | 2 +- opcodes/crx-dis.c | 2 +- opcodes/d10v-dis.c | 2 +- opcodes/d30v-dis.c | 2 +- opcodes/disassemble.c | 43 ++++++++++++-------- opcodes/disassemble.h | 102 +++++++++++++++++++++++++++++++++++++++++++++++ opcodes/dlx-dis.c | 2 +- opcodes/epiphany-dis.c | 2 +- opcodes/fr30-dis.c | 2 +- opcodes/frv-dis.c | 2 +- opcodes/ft32-dis.c | 2 +- opcodes/h8300-dis.c | 2 +- opcodes/h8500-dis.c | 2 +- opcodes/hppa-dis.c | 2 +- opcodes/i370-dis.c | 2 +- opcodes/i386-dis.c | 2 +- opcodes/i860-dis.c | 2 +- opcodes/i960-dis.c | 2 +- opcodes/ip2k-dis.c | 2 +- opcodes/iq2000-dis.c | 2 +- opcodes/lm32-dis.c | 2 +- opcodes/m10200-dis.c | 2 +- opcodes/m10300-dis.c | 2 +- opcodes/m32r-dis.c | 2 +- opcodes/m68hc11-dis.c | 2 +- opcodes/m68k-dis.c | 2 +- opcodes/m88k-dis.c | 2 +- opcodes/mcore-dis.c | 2 +- opcodes/metag-dis.c | 2 +- opcodes/microblaze-dis.c | 2 +- opcodes/mmix-dis.c | 2 +- opcodes/moxie-dis.c | 2 +- opcodes/msp430-dis.c | 2 +- opcodes/mt-dis.c | 2 +- opcodes/nds32-dis.c | 2 +- opcodes/nios2-dis.c | 2 +- opcodes/ns32k-dis.c | 2 +- opcodes/or1k-dis.c | 2 +- opcodes/pdp11-dis.c | 2 +- opcodes/pj-dis.c | 2 +- opcodes/ppc-dis.c | 2 +- opcodes/pru-dis.c | 2 +- opcodes/riscv-dis.c | 2 +- opcodes/rl78-dis.c | 8 +++- opcodes/s390-dis.c | 2 +- opcodes/score-dis.c | 2 +- opcodes/sh-dis.c | 2 +- opcodes/sh64-dis.c | 2 +- opcodes/tic30-dis.c | 2 +- opcodes/tic4x-dis.c | 2 +- opcodes/tic54x-dis.c | 2 +- opcodes/tic6x-dis.c | 2 +- opcodes/tic80-dis.c | 2 +- opcodes/tilegx-dis.c | 2 +- opcodes/tilepro-dis.c | 2 +- opcodes/v850-dis.c | 2 +- opcodes/vax-dis.c | 2 +- opcodes/visium-dis.c | 2 +- opcodes/w65-dis.c | 2 +- opcodes/wasm32-dis.c | 2 +- opcodes/xc16x-dis.c | 2 +- opcodes/xgate-dis.c | 2 +- opcodes/xstormy16-dis.c | 2 +- opcodes/xtensa-dis.c | 2 +- opcodes/z80-dis.c | 2 +- opcodes/z8k-dis.c | 2 +- sim/common/sim-trace.c | 6 ++- 113 files changed, 242 insertions(+), 311 deletions(-) create mode 100644 opcodes/disassemble.h -- 1.9.1