From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123885 invoked by alias); 24 May 2017 20:35:34 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 123850 invoked by uid 9674); 24 May 2017 20:35:33 -0000 Date: Wed, 24 May 2017 20:35:00 -0000 Message-ID: <20170524203533.123808.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] users/jkratoch/indexcxx: Merge remote-tracking branch 'gdb/master' into indexcxx X-Git-Refname: refs/heads/users/jkratoch/indexcxx X-Git-Reftype: branch X-Git-Oldrev: 480030250901adfbd6e8080e87143fc9959f372e X-Git-Newrev: a5a2c6c693bd290b3a5ffe924aa2c2e30b7d221f X-SW-Source: 2017-q2/txt/msg00036.txt.bz2 List-Id: The branch, users/jkratoch/indexcxx has been updated via a5a2c6c693bd290b3a5ffe924aa2c2e30b7d221f (commit) via 88c1242dc0a1e1ab582a65ea8bd05eb5f244c59b (commit) via f4985dba0f53b38efcca4eef42cfbfca5ef44ee2 (commit) via ab20fa4ae95212c58e369916de347f3d518530c2 (commit) via f532ab94387d1bc47de619ae08ead522753d89fa (commit) via 39503f82427e22ed8e04d986ccdc8562091ec62e (commit) via 003ca0fd22863aaf1a9811c8a35a0133a2d27fb1 (commit) from 480030250901adfbd6e8080e87143fc9959f372e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit a5a2c6c693bd290b3a5ffe924aa2c2e30b7d221f Merge: 4800302 88c1242 Author: Jan Kratochvil Date: Wed May 24 22:35:25 2017 +0200 Merge remote-tracking branch 'gdb/master' into indexcxx commit 88c1242dc0a1e1ab582a65ea8bd05eb5f244c59b Author: Yao Qi Date: Wed May 24 17:23:52 2017 +0100 Move print_insn_XXX to an opcodes internal header With the changes done in previous patches, print_insn_XXX functions don't have to be external visible out of opcodes, because both gdb and objdump select disassemblers through a single interface. This patch moves these print_insn_XXX declarations from include/dis-asm.h to opcodes/disassemble.h, which is a new header added by this patch. include: 2017-05-24 Yao Qi * dis-asm.h: Move some function declarations to opcodes/disassemble.h. opcodes: 2017-05-24 Yao Qi * alpha-dis.c: Include disassemble.h, don't include dis-asm.h. * avr-dis.c, bfin-dis.c, cr16-dis.c: Likewise. * crx-dis.c, d10v-dis.c, d30v-dis.c: Likewise. * disassemble.c, dlx-dis.c, epiphany-dis.c: Likewise. * fr30-dis.c, ft32-dis.c, h8300-dis.c, h8500-dis.c: Likewise. * hppa-dis.c, i370-dis.c, i386-dis.c: Likewise. * i860-dis.c, i960-dis.c, ip2k-dis.c: Likewise. * iq2000-dis.c, lm32-dis.c, m10200-dis.c: Likewise. * m10300-dis.c, m32r-dis.c, m68hc11-dis.c: Likewise. * m68k-dis.c, m88k-dis.c, mcore-dis.c: Likewise. * metag-dis.c, microblaze-dis.c, mmix-dis.c: Likewise. * moxie-dis.c, msp430-dis.c, mt-dis.c: * nds32-dis.c, nios2-dis.c, ns32k-dis.c: Likewise. * or1k-dis.c, pdp11-dis.c, pj-dis.c: Likewise. * ppc-dis.c, pru-dis.c, riscv-dis.c: Likewise. * rl78-dis.c, s390-dis.c, score-dis.c: Likewise. * sh-dis.c, sh64-dis.c, tic30-dis.c: Likewise. * tic4x-dis.c, tic54x-dis.c, tic6x-dis.c: Likewise. * tic80-dis.c, tilegx-dis.c, tilepro-dis.c: Likewise. * v850-dis.c, vax-dis.c, visium-dis.c: Likewise. * w65-dis.c, wasm32-dis.c, xc16x-dis.c: Likewise. * xgate-dis.c, xstormy16-dis.c, xtensa-dis.c: Likewise. * z80-dis.c, z8k-dis.c: Likewise. * disassemble.h: New file. commit f4985dba0f53b38efcca4eef42cfbfca5ef44ee2 Author: Yao Qi Date: Wed May 24 17:23:52 2017 +0100 Use disassemble.c:disassembler select rs6000 disassembler Nowadays, rs6000 disassembler is selected in different ways in opcodes and gdb, opcodes: case bfd_arch_rs6000: if (mach == bfd_mach_ppc_620) disassemble = print_insn_big_powerpc; else disassemble = print_insn_rs6000; break; gdb: if (arch == bfd_arch_rs6000) set_gdbarch_print_insn (gdbarch, print_insn_rs6000); else set_gdbarch_print_insn (gdbarch, gdb_print_insn_powerpc); I am not sure which one is the right one. However, such selection should be done in one place instead of two. gdb: 2017-05-24 Yao Qi * rs6000-tdep.c (gdb_print_insn_powerpc): Remove. (rs6000_gdbarch_init): Don't call set_gdbarch_print_insn. commit ab20fa4ae95212c58e369916de347f3d518530c2 Author: Yao Qi Date: Wed May 24 17:23:52 2017 +0100 Use disassemble.c:disassembler select rl78 disassembler This patch changes rl78 to let disassble.c:disassembler select disassembler. rl78_get_disassembler doesn't handle the case that abfd is NULL, so this patch also fix it. gdb: 2017-05-24 Yao Qi * rl78-tdep.c (rl78_gdbarch_init): Don't call set_gdbarch_print_insn. opcodes: 2017-05-24 Yao Qi * rl78-dis.c (rl78_get_disassembler): If parameter abfd is NULL, set cpu to E_FLAG_RL78_ANY_CPU. commit f532ab94387d1bc47de619ae08ead522753d89fa Author: Yao Qi Date: Wed May 24 17:23:52 2017 +0100 Use disassemble.c:disassembler select h8300 disassembler opcodes/disassble.c:disassembler select h8300 disassembler like this, if (mach == bfd_mach_h8300h || mach == bfd_mach_h8300hn) disassemble = print_insn_h8300h; else if (mach == bfd_mach_h8300s || mach == bfd_mach_h8300sn || mach == bfd_mach_h8300sx || mach == bfd_mach_h8300sxn) disassemble = print_insn_h8300s; else disassemble = print_insn_h8300; which is the same as what gdb/h8300-tdpe.c does, switch (info.bfd_arch_info->mach) { case bfd_mach_h8300: ... set_gdbarch_print_insn (gdbarch, print_insn_h8300); case bfd_mach_h8300h: case bfd_mach_h8300hn: ... set_gdbarch_print_insn (gdbarch, print_insn_h8300h); case bfd_mach_h8300s: case bfd_mach_h8300sn: ... set_gdbarch_print_insn (gdbarch, print_insn_h8300s); so we can leave disassble.c:disassembler doing the selection. gdb: 2017-05-24 Yao Qi * h8300-tdep.c (h8300_gdbarch_init): Don't call set_gdbarch_print_insn. commit 39503f82427e22ed8e04d986ccdc8562091ec62e Author: Yao Qi Date: Wed May 24 17:23:52 2017 +0100 Delegate opcodes to select disassembler in GDB This patch changes GDB to use disassembler selected by opcodes in default, so that we don't have to duplicate the selection logic again in GDB side. For example, gdb/score-tdep.c has static int score_print_insn (bfd_vma memaddr, struct disassemble_info *info) { if (info->endian == BFD_ENDIAN_BIG) return print_insn_big_score (memaddr, info); else return print_insn_little_score (memaddr, info); } and opcodes/disassemble.c has the same logic, case bfd_arch_score: if (big) disassemble = print_insn_big_score; else disassemble = print_insn_little_score; This patch removes the logic in GDB and calls opcodes/disassemble.c:disassembler in default to select disassembler. gdb: 2017-05-24 Yao Qi * alpha-tdep.c (alpha_gdbarch_init): Don't call set_gdbarch_print_insn. * arc-tdep.c (arc_gdbarch_init): Likewise. * arch-utils.c: include dis-asm.h. (default_print_insn): New function. * arch-utils.h (default_print_insn): Declare. * avr-tdep.c (avr_gdbarch_init): Don't call set_gdbarch_print_insn. * bfin-tdep.c (bfin_gdbarch_init): Likewise. * cris-tdep.c (cris_delayed_get_disassembler): Remove. (cris_gdbarch_init): Don't call set_gdbarch_print_insn. * frv-tdep.c (frv_gdbarch_init): Likewise. * ft32-tdep.c (ft32_gdbarch_init): Likewise. * gdbarch.sh (print_insn): Use default_print_insn. * gdbarch.c: Regenerated. * hppa-tdep.c (hppa_gdbarch_init): Likewise. * iq2000-tdep.c (iq2000_gdbarch_init): Likewise. * lm32-tdep.c (lm32_gdbarch_init): Likewise. * m32c-tdep.c (m32c_gdbarch_init): Likewise. * m32r-tdep.c (m32r_gdbarch_init): Likewise. * m68hc11-tdep.c (gdb_print_insn_m68hc11): Remove. (m68hc11_gdbarch_init): Don't call set_gdbarch_print_insn. * m68k-tdep.c (m68k_gdbarch_init): Likewise. * m88k-tdep.c (m88k_gdbarch_init): Likewise. * microblaze-tdep.c (microblaze_gdbarch_init): Likewise. * mn10300-tdep.c (mn10300_gdbarch_init): Likewise. * moxie-tdep.c (moxie_gdbarch_init): Likewise. * msp430-tdep.c (msp430_gdbarch_init): Likewise. * mt-tdep.c (mt_gdbarch_init): Likewise. * nds32-tdep.c (nds32_gdbarch_init): Likewise. * nios2-tdep.c (nios2_print_insn): Remove. (nios2_gdbarch_init): Don't call set_gdbarch_print_insn. * rx-tdep.c (rx_gdbarch_init): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * score-tdep.c (score_print_insn): Remove. (score_gdbarch_init): Don't call set_gdbarch_print_insn. * sh-tdep.c (sh_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sparc-tdep.c (sparc32_gdbarch_init): Likewise. * tic6x-tdep.c (tic6x_print_insn): Remove. (tic6x_gdbarch_init): Don't call set_gdbarch_print_insn. * tilegx-tdep.c (tilegx_gdbarch_init): Likewise. * v850-tdep.c (v850_gdbarch_init): Likewise. * vax-tdep.c (vax_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * xtensa-tdep.c (xtensa_gdbarch_init): Likewise. commit 003ca0fd22863aaf1a9811c8a35a0133a2d27fb1 Author: Yao Qi Date: Wed May 24 17:23:52 2017 +0100 Refactor disassembler selection Nowadays, opcodes/disassemble.c:disassembler selects the proper disassembler according to ABFD only. However, it actually selects disassemblers according to arch, mach, endianess, and abfd. This patch adds them to the parameters of disassembler, so that its caller can still select disassemblers in case that abfd is NULL (a typical case in GDB). There isn't any functionality change. binutils: 2017-05-24 Yao Qi * objdump.c (disassemble_data): Caller update. include: 2017-05-24 Yao Qi * dis-asm.h (disassembler): Update declaration. opcodes: 2017-05-24 Yao Qi * disassemble.c (disassembler): Add arguments a, big and mach. Use them. sim/common: 2017-05-24 Yao Qi * sim-trace.c (trace_disasm): Caller update. ----------------------------------------------------------------------- Summary of changes: binutils/ChangeLog | 4 ++ binutils/objdump.c | 4 +- gdb/ChangeLog | 63 ++++++++++++++++++++++++++++ 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/ChangeLog | 9 ++++ include/dis-asm.h | 88 ++++------------------------------------ opcodes/ChangeLog | 38 +++++++++++++++++ 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/ChangeLog | 4 ++ sim/common/sim-trace.c | 6 ++- 118 files changed, 360 insertions(+), 311 deletions(-) create mode 100644 opcodes/disassemble.h First 500 lines of diff: diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 60a199a..b2f0f11 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2017-05-24 Yao Qi + + * objdump.c (disassemble_data): Caller update. + 2017-05-19 Jose E. Marchesi * objcopy.c (merge_gnu_build_notes): Remove workaround that diff --git a/binutils/objdump.c b/binutils/objdump.c index 5972da1..81d47a0 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -2386,7 +2386,9 @@ disassemble_data (bfd *abfd) } /* Use libopcodes to locate a suitable disassembler. */ - aux.disassemble_fn = disassembler (abfd); + aux.disassemble_fn = disassembler (bfd_get_arch (abfd), + bfd_big_endian (abfd), + bfd_get_mach (abfd), abfd); if (!aux.disassemble_fn) { non_fatal (_("can't disassemble for architecture %s\n"), diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c8bd6fd..a96e71f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,66 @@ +2017-05-24 Yao Qi + + * rs6000-tdep.c (gdb_print_insn_powerpc): Remove. + (rs6000_gdbarch_init): Don't call set_gdbarch_print_insn. + +2017-05-24 Yao Qi + + * rl78-tdep.c (rl78_gdbarch_init): Don't call + set_gdbarch_print_insn. + +2017-05-24 Yao Qi + + * h8300-tdep.c (h8300_gdbarch_init): Don't call + set_gdbarch_print_insn. + +2017-05-24 Yao Qi + + * alpha-tdep.c (alpha_gdbarch_init): Don't call + set_gdbarch_print_insn. + * arc-tdep.c (arc_gdbarch_init): Likewise. + * arch-utils.c: include dis-asm.h. + (default_print_insn): New function. + * arch-utils.h (default_print_insn): Declare. + * avr-tdep.c (avr_gdbarch_init): Don't call set_gdbarch_print_insn. + * bfin-tdep.c (bfin_gdbarch_init): Likewise. + * cris-tdep.c (cris_delayed_get_disassembler): Remove. + (cris_gdbarch_init): Don't call set_gdbarch_print_insn. + * frv-tdep.c (frv_gdbarch_init): Likewise. + * ft32-tdep.c (ft32_gdbarch_init): Likewise. + * gdbarch.sh (print_insn): Use default_print_insn. + * gdbarch.c: Regenerated. + * hppa-tdep.c (hppa_gdbarch_init): Likewise. + * iq2000-tdep.c (iq2000_gdbarch_init): Likewise. + * lm32-tdep.c (lm32_gdbarch_init): Likewise. + * m32c-tdep.c (m32c_gdbarch_init): Likewise. + * m32r-tdep.c (m32r_gdbarch_init): Likewise. + * m68hc11-tdep.c (gdb_print_insn_m68hc11): Remove. + (m68hc11_gdbarch_init): Don't call set_gdbarch_print_insn. + * m68k-tdep.c (m68k_gdbarch_init): Likewise. + * m88k-tdep.c (m88k_gdbarch_init): Likewise. + * microblaze-tdep.c (microblaze_gdbarch_init): Likewise. + * mn10300-tdep.c (mn10300_gdbarch_init): Likewise. + * moxie-tdep.c (moxie_gdbarch_init): Likewise. + * msp430-tdep.c (msp430_gdbarch_init): Likewise. + * mt-tdep.c (mt_gdbarch_init): Likewise. + * nds32-tdep.c (nds32_gdbarch_init): Likewise. + * nios2-tdep.c (nios2_print_insn): Remove. + (nios2_gdbarch_init): Don't call set_gdbarch_print_insn. + * rx-tdep.c (rx_gdbarch_init): Likewise. + * s390-linux-tdep.c (s390_gdbarch_init): Likewise. + * score-tdep.c (score_print_insn): Remove. + (score_gdbarch_init): Don't call set_gdbarch_print_insn. + * sh-tdep.c (sh_gdbarch_init): Likewise. + * sh64-tdep.c (sh64_gdbarch_init): Likewise. + * sparc-tdep.c (sparc32_gdbarch_init): Likewise. + * tic6x-tdep.c (tic6x_print_insn): Remove. + (tic6x_gdbarch_init): Don't call set_gdbarch_print_insn. + * tilegx-tdep.c (tilegx_gdbarch_init): Likewise. + * v850-tdep.c (v850_gdbarch_init): Likewise. + * vax-tdep.c (vax_gdbarch_init): Likewise. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. + * xtensa-tdep.c (xtensa_gdbarch_init): Likewise. + 2017-05-23 John Baldwin * mips-fbsd-tdep.c (MIPS_PC_REGNUM): Remove. diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index d62566c..b1bc6a1 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -1798,9 +1798,6 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Prologue heuristics. */ set_gdbarch_skip_prologue (gdbarch, alpha_skip_prologue); - /* Disassembler. */ - set_gdbarch_print_insn (gdbarch, print_insn_alpha); - /* Call info. */ set_gdbarch_return_value (gdbarch, alpha_return_value); diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c index 4f866a9..d9ee5c6 100644 --- a/gdb/arc-tdep.c +++ b/gdb/arc-tdep.c @@ -2013,8 +2013,6 @@ arc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_align (gdbarch, arc_frame_align); - set_gdbarch_print_insn (gdbarch, arc_delayed_print_insn); - set_gdbarch_cannot_step_breakpoint (gdbarch, 1); /* "nonsteppable" watchpoint means that watchpoint triggers before diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index b1cec80..c011b0f 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -37,6 +37,7 @@ #include "floatformat.h" +#include "dis-asm.h" struct displaced_step_closure * simple_displaced_step_copy_insn (struct gdbarch *gdbarch, @@ -973,6 +974,25 @@ default_guess_tracepoint_registers (struct gdbarch *gdbarch, regcache_raw_supply (regcache, pc_regno, regs); } +int +default_print_insn (bfd_vma memaddr, disassemble_info *info) +{ + disassembler_ftype disassemble_fn; + + if (exec_bfd != NULL) + { + gdb_assert (info->arch == bfd_get_arch (exec_bfd)); + gdb_assert (info->endian == (bfd_big_endian (exec_bfd) + ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE)); + gdb_assert (info->mach == bfd_get_mach (exec_bfd)); + } + disassemble_fn = disassembler (info->arch, info->endian == BFD_ENDIAN_BIG, + info->mach, exec_bfd); + + gdb_assert (disassemble_fn != NULL); + return (*disassemble_fn) (memaddr, info); +} + /* -Wmissing-prototypes */ extern initialize_file_ftype _initialize_gdbarch_utils; diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 967a4b1..040afca 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -273,4 +273,6 @@ extern void default_guess_tracepoint_registers (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr); +extern int default_print_insn (bfd_vma memaddr, disassemble_info *info); + #endif diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index ec9db1c..3d041c6 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -1499,7 +1499,6 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pseudo_register_write (gdbarch, avr_pseudo_register_write); set_gdbarch_return_value (gdbarch, avr_return_value); - set_gdbarch_print_insn (gdbarch, print_insn_avr); set_gdbarch_push_dummy_call (gdbarch, avr_push_dummy_call); diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c index c590a91..bfb5d57 100644 --- a/gdb/bfin-tdep.c +++ b/gdb/bfin-tdep.c @@ -838,7 +838,6 @@ bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 8); set_gdbarch_unwind_pc (gdbarch, bfin_unwind_pc); set_gdbarch_frame_align (gdbarch, bfin_frame_align); - set_gdbarch_print_insn (gdbarch, print_insn_bfin); /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index eb39772..e554e24 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -3785,19 +3785,6 @@ cris_gdb_func (struct gdbarch *gdbarch, enum cris_op_type op_type, } } -/* This wrapper is to avoid cris_get_assembler being called before - exec_bfd has been set. */ - -static int -cris_delayed_get_disassembler (bfd_vma addr, struct disassemble_info *info) -{ - int (*print_insn) (bfd_vma addr, struct disassemble_info *info); - - print_insn = cris_get_disassembler (exec_bfd); - gdb_assert (print_insn != NULL); - return print_insn (addr, info); -} - /* Originally from . */ typedef unsigned char cris_elf_greg_t[4]; @@ -4134,10 +4121,5 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); - /* FIXME: cagney/2003-08-27: It should be possible to select a CRIS - disassembler, even when there is no BFD. Does something like - "gdb; target remote; disassmeble *0x123" work? */ - set_gdbarch_print_insn (gdbarch, cris_delayed_get_disassembler); - return gdbarch; } diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 8744733..c0257bd 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -1582,7 +1582,6 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) break; } - set_gdbarch_print_insn (gdbarch, print_insn_frv); if (frv_abi (gdbarch) == FRV_ABI_FDPIC) set_gdbarch_convert_from_func_ptr_addr (gdbarch, frv_convert_from_func_ptr_addr); diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c index 5b28275..966a593 100644 --- a/gdb/ft32-tdep.c +++ b/gdb/ft32-tdep.c @@ -637,8 +637,6 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_unwind_pc (gdbarch, ft32_unwind_pc); - set_gdbarch_print_insn (gdbarch, print_insn_ft32); - /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 9c827ac..257c39f 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -429,6 +429,7 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr; gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity; gdbarch->addr_bits_remove = core_addr_identity; + gdbarch->print_insn = default_print_insn; gdbarch->skip_trampoline_code = generic_skip_trampoline_code; gdbarch->skip_solib_resolver = generic_skip_solib_resolver; gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline; @@ -621,8 +622,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of addr_bits_remove, invalid_p == 0 */ /* Skip verify of software_single_step, has predicate. */ /* Skip verify of single_step_through_delay, has predicate. */ - if (gdbarch->print_insn == 0) - log.puts ("\n\tprint_insn"); + /* Skip verify of print_insn, invalid_p == 0 */ /* Skip verify of skip_trampoline_code, invalid_p == 0 */ /* Skip verify of skip_solib_resolver, invalid_p == 0 */ /* Skip verify of in_solib_return_trampoline, invalid_p == 0 */ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 753819f..7992cbe 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -643,7 +643,7 @@ F;std::vector;software_single_step;struct regcache *regcache;regcache M;int;single_step_through_delay;struct frame_info *frame;frame # FIXME: cagney/2003-08-28: Need to find a better way of selecting the # disassembler. Perhaps objdump can handle it? -f;int;print_insn;bfd_vma vma, struct disassemble_info *info;vma, info;;0; +f;int;print_insn;bfd_vma vma, struct disassemble_info *info;vma, info;;default_print_insn;;0 f;CORE_ADDR;skip_trampoline_code;struct frame_info *frame, CORE_ADDR pc;frame, pc;;generic_skip_trampoline_code;;0 diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index 7b260b1..1e8bde1 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1275,7 +1275,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_return_value (gdbarch, h8300_return_value); - set_gdbarch_print_insn (gdbarch, print_insn_h8300); break; case bfd_mach_h8300h: case bfd_mach_h8300hn: @@ -1296,7 +1295,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); } set_gdbarch_return_value (gdbarch, h8300h_return_value); - set_gdbarch_print_insn (gdbarch, print_insn_h8300h); break; case bfd_mach_h8300s: case bfd_mach_h8300sn: @@ -1317,7 +1315,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); } set_gdbarch_return_value (gdbarch, h8300h_return_value); - set_gdbarch_print_insn (gdbarch, print_insn_h8300s); break; case bfd_mach_h8300sx: case bfd_mach_h8300sxn: @@ -1338,7 +1335,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); } set_gdbarch_return_value (gdbarch, h8300h_return_value); - set_gdbarch_print_insn (gdbarch, print_insn_h8300s); break; } diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 2636a27..229b061 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -3122,8 +3122,6 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Helper for function argument information. */ set_gdbarch_fetch_pointer_argument (gdbarch, hppa_fetch_pointer_argument); - set_gdbarch_print_insn (gdbarch, print_insn_hppa); - /* When a hardware watchpoint triggers, we'll move the inferior past it by removing all eventpoints; stepping past the instruction that caused the trigger; reinserting eventpoints; and checking diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c index 7d8ed3c..99824b7 100644 --- a/gdb/iq2000-tdep.c +++ b/gdb/iq2000-tdep.c @@ -838,7 +838,6 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_skip_prologue (gdbarch, iq2000_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - set_gdbarch_print_insn (gdbarch, print_insn_iq2000); set_gdbarch_register_type (gdbarch, iq2000_register_type); set_gdbarch_frame_align (gdbarch, iq2000_frame_align); set_gdbarch_unwind_sp (gdbarch, iq2000_unwind_sp); diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c index bd3e182..84ece3e 100644 --- a/gdb/lm32-tdep.c +++ b/gdb/lm32-tdep.c @@ -565,9 +565,6 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_push_dummy_call (gdbarch, lm32_push_dummy_call); set_gdbarch_return_value (gdbarch, lm32_return_value); - /* Instruction disassembler. */ - set_gdbarch_print_insn (gdbarch, print_insn_lm32); - lm32_add_reggroups (gdbarch); set_gdbarch_register_reggroup_p (gdbarch, lm32_register_reggroup_p); diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 7376372..1bc5950 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -2639,9 +2639,6 @@ m32c_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Register set. */ make_regs (gdbarch); - /* Disassembly. */ - set_gdbarch_print_insn (gdbarch, print_insn_m32c); - /* Breakpoints. */ set_gdbarch_breakpoint_kind_from_pc (gdbarch, m32c_breakpoint::kind_from_pc); set_gdbarch_sw_breakpoint_from_kind (gdbarch, m32c_breakpoint::bp_from_kind); diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index 0820af9..2d14ced 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -947,8 +947,6 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Return the unwound PC value. */ set_gdbarch_unwind_pc (gdbarch, m32r_unwind_pc); - set_gdbarch_print_insn (gdbarch, print_insn_m32r); - /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 893d9c2..b19ddf7 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1344,16 +1344,6 @@ m68hc11_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym) if (flags & STO_M68HC12_INTERRUPT) MSYMBOL_SET_RTI (msym); } - -static int -gdb_print_insn_m68hc11 (bfd_vma memaddr, disassemble_info *info) -{ - if (info->arch == bfd_arch_m68hc11) - return print_insn_m68hc11 (memaddr, info); - else - return print_insn_m68hc12 (memaddr, info); -} - /* 68HC11/68HC12 register groups. @@ -1525,7 +1515,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info, m68hc11_breakpoint::kind_from_pc); set_gdbarch_sw_breakpoint_from_kind (gdbarch, m68hc11_breakpoint::bp_from_kind); - set_gdbarch_print_insn (gdbarch, gdb_print_insn_m68hc11); m68hc11_add_reggroups (gdbarch); set_gdbarch_register_reggroup_p (gdbarch, m68hc11_register_reggroup_p); diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 7c3bf4c..5b4736d 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -1240,10 +1240,6 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_return_in_first_hidden_param_p (gdbarch, m68k_return_in_first_hidden_param_p); - - /* Disassembler. */ - set_gdbarch_print_insn (gdbarch, print_insn_m68k); - #if defined JB_PC && defined JB_ELEMENT_SIZE tdep->jb_pc = JB_PC; tdep->jb_elt_size = JB_ELEMENT_SIZE; diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c index 57fe644..d08a913 100644 --- a/gdb/m88k-tdep.c +++ b/gdb/m88k-tdep.c @@ -838,8 +838,6 @@ m88k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_iterate_over_regset_sections (gdbarch, m88k_iterate_over_regset_sections); - set_gdbarch_print_insn (gdbarch, print_insn_m88k); - set_gdbarch_skip_prologue (gdbarch, m88k_skip_prologue); /* Stack grows downward. */ diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c index 59f94c5..86cb090 100644 --- a/gdb/microblaze-tdep.c +++ b/gdb/microblaze-tdep.c @@ -738,8 +738,6 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 8); - set_gdbarch_print_insn (gdbarch, print_insn_microblaze); - set_gdbarch_write_pc (gdbarch, microblaze_write_pc); set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc); diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 0f5e10f..1e2526f 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -1444,8 +1444,6 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_sw_breakpoint_from_kind (gdbarch, mn10300_breakpoint::bp_from_kind); /* decr_pc_after_break? */ - /* Disassembly. */ - set_gdbarch_print_insn (gdbarch, print_insn_mn10300); /* Stage 2 */ set_gdbarch_return_value (gdbarch, mn10300_return_value); diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c index 2972d52..91248cc 100644 --- a/gdb/moxie-tdep.c +++ b/gdb/moxie-tdep.c @@ -1142,8 +1142,6 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_unwind_pc (gdbarch, moxie_unwind_pc); - set_gdbarch_print_insn (gdbarch, print_insn_moxie); - /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c index d9eebf0..d730e1b 100644 --- a/gdb/msp430-tdep.c +++ b/gdb/msp430-tdep.c @@ -997,9 +997,6 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) msp430_breakpoint::bp_from_kind); set_gdbarch_decr_pc_after_break (gdbarch, 1); - /* Disassembly. */ hooks/post-receive -- Repository for Project Archer.