Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: binutils@sourceware.org,	gdb-patches@sourceware.org
Subject: [PATCH 5/6] Use disassble.c:disassembler select rs6000 disassembler
Date: Tue, 16 May 2017 10:48:00 -0000	[thread overview]
Message-ID: <1494931698-15309-6-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1494931698-15309-1-git-send-email-yao.qi@linaro.org>

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.  In fact, this changes gdb
to align with objdump on disassembler selection.

gdb:

2017-05-15  Yao Qi  <yao.qi@linaro.org>

	* rs6000-tdep.c (gdb_print_insn_powerpc): Remove.
	(rs6000_gdbarch_init): Don't call set_gdbarch_print_insn.
---
 gdb/rs6000-tdep.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 4072464..0bd65fc 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3233,14 +3233,6 @@ find_variant_by_arch (enum bfd_architecture arch, unsigned long mach)
   return NULL;
 }
 
-static int
-gdb_print_insn_powerpc (bfd_vma memaddr, disassemble_info *info)
-{
-  if (info->endian == BFD_ENDIAN_BIG)
-    return print_insn_big_powerpc (memaddr, info);
-  else
-    return print_insn_little_powerpc (memaddr, info);
-}
 \f
 static CORE_ADDR
 rs6000_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
@@ -6449,12 +6441,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
 
-  /* Select instruction printer.  */
-  if (arch == bfd_arch_rs6000)
-    set_gdbarch_print_insn (gdbarch, print_insn_rs6000);
-  else
-    set_gdbarch_print_insn (gdbarch, gdb_print_insn_powerpc);
-
   set_gdbarch_num_regs (gdbarch, PPC_NUM_REGS);
 
   if (have_spe)
-- 
1.9.1


  reply	other threads:[~2017-05-16 10:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16 10:49 [PATCH 0/6] Unify the disassembler selection in gdb and objdump Yao Qi
2017-05-16 10:48 ` Yao Qi [this message]
2017-05-16 10:48 ` [PATCH 4/6] Use disassble.c:disassembler select rl78 disassembler Yao Qi
2017-05-16 10:48 ` [PATCH 2/6] Delegate opcodes to select disassembler in GDB Yao Qi
2017-06-30  0:19   ` Maciej W. Rozycki
2017-06-30  7:38     ` Yao Qi
2017-07-05 23:53       ` Maciej W. Rozycki
2017-07-07 16:41         ` Yao Qi
2017-08-01 16:31           ` Maciej W. Rozycki
2017-05-16 10:49 ` [PATCH 1/6] Refactor disassembler selection Yao Qi
2017-05-16 10:49 ` [PATCH 3/6] Use disassble.c:disassembler select h8300 disassembler Yao Qi
2017-05-16 10:49 ` [RFC 6/6] Move print_insn_XXX to an opcodes internal header Yao Qi
2017-05-17  3:00 ` [PATCH 0/6] Unify the disassembler selection in gdb and objdump Alan Modra
2017-05-24 16:26   ` Yao Qi
2017-05-23  9:19 ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1494931698-15309-6-git-send-email-yao.qi@linaro.org \
    --to=qiyaoltc@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox