From: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: binutils@sourceware.org, amodra@gmail.com
Subject: [PATCH] Fix gdb disassemble for power6/power7 instructions
Date: Tue, 13 Nov 2012 05:46:00 -0000 [thread overview]
Message-ID: <1352785540-22911-1-git-send-email-emachado@linux.vnet.ibm.com> (raw)
Hi,
upstream gdb is unable to disassemble power6 and power7 instructions due to a
change on binutils (http://sourceware.org/ml/binutils/2012-03/msg00170.html). It
happens because powerpc_init_dialect() is currently being called before
disassembler_options is configured (it used to be called every time
print_insn_[little|big]_powerpc() was called). The patch below intends to fix
this issue moving the logic to set disassembler_options to
powerpc_init_dialect().
Moreover, with this patch, objdump is also able to disassemble power6 and power7
instructions without the additional parameter -M <option>.
Comments/sugggestions are welcome.
Thanks,
--
Edjunior
gdb/ChangeLog
2012-11-13 Edjunior Machado <emachado@linux.vnet.ibm.com>
* rs6000-tdep.c (gdb_print_insn_powerpc): Move logic to set
info->disassembler_options to binutils' powerpc_init_dialect().
opcodes/ChangeLog
2012-11-13 Edjunior Machado <emachado@linux.vnet.ibm.com>
* ppc-dis.c (powerpc_init_dialect): If not defined, set
info->disassembler_options to "any" or, if debugging an E500 binary,
to "e500x2".
---
gdb/rs6000-tdep.c | 15 ---------------
opcodes/ppc-dis.c | 15 +++++++++++++++
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 1797cc5..07b81bc 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3084,21 +3084,6 @@ find_variant_by_arch (enum bfd_architecture arch, unsigned long mach)
static int
gdb_print_insn_powerpc (bfd_vma memaddr, disassemble_info *info)
{
- if (!info->disassembler_options)
- {
- /* When debugging E500 binaries and disassembling code containing
- E500-specific (SPE) instructions, one sometimes sees AltiVec
- instructions instead. The opcode spaces for SPE instructions
- and AltiVec instructions overlap, and specifiying the "any" cpu
- looks for AltiVec instructions first. If we know we're
- debugging an E500 binary, however, we can specify the "e500x2"
- cpu and get much more sane disassembly output. */
- if (info->mach == bfd_mach_ppc_e500)
- info->disassembler_options = "e500x2";
- else
- info->disassembler_options = "any";
- }
-
if (info->endian == BFD_ENDIAN_BIG)
return print_insn_big_powerpc (memaddr, info);
else
diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c
index 03b3160..63b71e5 100644
--- a/opcodes/ppc-dis.c
+++ b/opcodes/ppc-dis.c
@@ -251,6 +251,21 @@ powerpc_init_dialect (struct disassemble_info *info)
if (priv == NULL)
priv = &private;
+ if (!info->disassembler_options)
+ {
+ /* When debugging E500 binaries and disassembling code containing
+ E500-specific (SPE) instructions, one sometimes sees AltiVec
+ instructions instead. The opcode spaces for SPE instructions
+ and AltiVec instructions overlap, and specifiying the "any" cpu
+ looks for AltiVec instructions first. If we know we're
+ debugging an E500 binary, however, we can specify the "e500x2"
+ cpu and get much more sane disassembly output. */
+ if (info->mach == bfd_mach_ppc_e500)
+ info->disassembler_options = "e500x2";
+ else
+ info->disassembler_options = "any";
+ }
+
arg = info->disassembler_options;
while (arg != NULL)
{
--
1.7.1
next reply other threads:[~2012-11-13 5:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-13 5:46 Edjunior Barbosa Machado [this message]
2012-11-13 23:46 ` Alan Modra
2012-11-23 3:29 ` Alan Modra
2012-11-23 17:07 ` Edjunior Barbosa Machado
2012-11-28 18:38 ` Ulrich Weigand
2012-11-28 20:17 ` Edjunior Barbosa 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=1352785540-22911-1-git-send-email-emachado@linux.vnet.ibm.com \
--to=emachado@linux.vnet.ibm.com \
--cc=amodra@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