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

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-15  Yao Qi  <yao.qi@linaro.org>

	* rl78-tdep.c (rl78_gdbarch_init): Don't call
	set_gdbarch_print_insn.

opcodes:

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

	* rl78-dis.c (rl78_get_disassembler): If parameter abfd
	is NULL, set cpu to E_FLAG_RL78_ANY_CPU.
---
 gdb/rl78-tdep.c    | 3 ---
 opcodes/rl78-dis.c | 6 +++++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index 307a760..5775f96 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -1470,9 +1470,6 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, rl78_breakpoint::bp_from_kind);
   set_gdbarch_decr_pc_after_break (gdbarch, 1);
 
-  /* Disassembly.  */
-  set_gdbarch_print_insn (gdbarch, print_insn_rl78);
-
   /* Frames, prologues, etc.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_prologue (gdbarch, rl78_skip_prologue);
diff --git a/opcodes/rl78-dis.c b/opcodes/rl78-dis.c
index 1839436..799cd38 100644
--- a/opcodes/rl78-dis.c
+++ b/opcodes/rl78-dis.c
@@ -406,7 +406,11 @@ print_insn_rl78_g14 (bfd_vma addr, disassemble_info * dis)
 disassembler_ftype
 rl78_get_disassembler (bfd *abfd)
 {
-  int cpu = abfd->tdata.elf_obj_data->elf_header->e_flags & E_FLAG_RL78_CPU_MASK;
+  int cpu = E_FLAG_RL78_ANY_CPU;
+
+  if (abfd != NULL)
+    cpu = abfd->tdata.elf_obj_data->elf_header->e_flags & E_FLAG_RL78_CPU_MASK;
+
   switch (cpu)
     {
     case E_FLAG_RL78_G10:
-- 
1.9.1

  parent 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 ` [PATCH 5/6] Use disassble.c:disassembler select rs6000 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:48 ` Yao Qi [this message]
2017-05-16 10:49 ` [PATCH 3/6] Use disassble.c:disassembler select h8300 disassembler Yao Qi
2017-05-16 10:49 ` [PATCH 1/6] Refactor disassembler selection 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-5-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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).