Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Udma Catalin-Dan-B32721 <B32721@freescale.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: gdb 7.5.1: broken powerpc disassemble initialization
Date: Thu, 30 May 2013 14:03:00 -0000	[thread overview]
Message-ID: <FE751157F0442848A159F3AB4CB1F55B3B9FB7@039-SN1MPN1-005.039d.mgd.msft.net> (raw)

Hi,

I found the powerpc disassemble initialization issue introduced in gdb 7.5.1. Everything seems correctly for previous gdb versions.
What was changed in gdb 7.5.1:

In opcodes/ppc-dis.c has been added the function disassemble_init_powerpc. At the end of the function is done the powerpc dialect initialization (powerpc_init_dialect).
With this change, the dialect initialization is done before the function gdb_print_insn_powerpc is called and therefore  disassembler_options set here are ignored being set before the dialect initialization.

The patch that fixes this issue is below. Please let me know your comments.

Regards,
Catalin


Subject: [PATCH] fix gdb disassembly initialization

The dialect initialization is broken in gdb 7.5.1 only: the dialect 
initialization is done before gdb-print-instruction, therefore the 
disassembly options set here are always ignored. This patch fixes 
this problem by moving  powerpc dialect initialization after the
disassembly option is set in gdb-print-instruction.

Signed-off-by: Catalin Udma <catalin.udma@freescale.com>
---
 opcodes/ppc-dis.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c
index 0905744..67ec5ca 100644
--- a/opcodes/ppc-dis.c
+++ b/opcodes/ppc-dis.c
@@ -339,8 +339,6 @@ disassemble_init_powerpc (struct disassemble_info *info)
       last = vle_opcd_indices[i];
     }
 
-  if (info->arch == bfd_arch_powerpc)
-    powerpc_init_dialect (info);
 }
 
 /* Print a big endian PowerPC instruction.  */
@@ -348,6 +346,8 @@ disassemble_init_powerpc (struct disassemble_info *info)
 int
 print_insn_big_powerpc (bfd_vma memaddr, struct disassemble_info *info)
 {
+  if (info->private_data == NULL)
+    powerpc_init_dialect (info);
   return print_insn_powerpc (memaddr, info, 1, get_powerpc_dialect (info));
 }
 
@@ -356,6 +356,8 @@ print_insn_big_powerpc (bfd_vma memaddr, struct disassemble_info *info)
 int
 print_insn_little_powerpc (bfd_vma memaddr, struct disassemble_info *info)
 {
+  if (info->private_data == NULL)
+    powerpc_init_dialect (info);
   return print_insn_powerpc (memaddr, info, 0, get_powerpc_dialect (info));
 }



             reply	other threads:[~2013-05-30 14:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 14:03 Udma Catalin-Dan-B32721 [this message]
2013-05-30 14:28 ` Luis Machado

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=FE751157F0442848A159F3AB4CB1F55B3B9FB7@039-SN1MPN1-005.039d.mgd.msft.net \
    --to=b32721@freescale.com \
    --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