public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] fix disassembly of E500 instructions
@ 2010-10-29 19:20 Nathan Froyd
  2010-11-02 18:09 ` Joel Brobecker
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Froyd @ 2010-10-29 19:20 UTC (permalink / raw)
  To: gdb-patches

This patch addresses a usability nit: 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 in gdb_print_insn_powerpc 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.

Tested manually with cross to powerpc-linux-gnu.  OK to commit?

-Nathan

	* rs6000-tdep.c (gdb_print_insn_powerpc): Disassemble e500
	instructions if debugging an e500 binary.
---
 gdb/rs6000-tdep.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 09c7f8f..ef049d9 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3029,7 +3029,12 @@ static int
 gdb_print_insn_powerpc (bfd_vma memaddr, disassemble_info *info)
 {
   if (!info->disassembler_options)
-    info->disassembler_options = "any";
+    {
+      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);
-- 
1.6.3.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix disassembly of E500 instructions
  2010-10-29 19:20 [PATCH] fix disassembly of E500 instructions Nathan Froyd
@ 2010-11-02 18:09 ` Joel Brobecker
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Brobecker @ 2010-11-02 18:09 UTC (permalink / raw)
  To: Nathan Froyd; +Cc: gdb-patches

> 	* rs6000-tdep.c (gdb_print_insn_powerpc): Disassemble e500
> 	instructions if debugging an e500 binary.


This seems OK to me, but I think it would be useful to embed your
description in the code as a comment:

> This patch addresses a usability nit: 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 in gdb_print_insn_powerpc 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.

-- 
Joel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-02 18:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-29 19:20 [PATCH] fix disassembly of E500 instructions Nathan Froyd
2010-11-02 18:09 ` Joel Brobecker

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).