Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* (not) disassembling power[456] instructions in GDB
@ 2007-02-01  0:23 Thiago Jung Bauermann
  2007-02-01 17:11 ` [PATCH] " Thiago Jung Bauermann
  2007-02-06 15:06 ` Thiago Jung Bauermann
  0 siblings, 2 replies; 4+ messages in thread
From: Thiago Jung Bauermann @ 2007-02-01  0:23 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 2291 bytes --]

Hi,

I found out that GDB is not currently disassembling instructions which
are available on power4, power5 or power6 processors even though it has
support to do so. GDB copies the disassembler code from binutils, which
provides a -M option to let the user specify the dialect to be used, but
the problem is that GDB itself doesn't provide a command or option to
let
the user specify the dialect. The result is that the powerpc_dialect()
function in ppc-dis.c will always return the same value, which doesn't
include any of the PPC_OPCODE_POWER[456] flags.

Example:

(gdb) disassemble main
Dump of assembler code for function main:
0x1000046c <main+0>:    stwu    r1,-48(r1)
0x10000470 <main+4>:    stw     r31,44(r1)
0x10000474 <main+8>:    mr      r31,r1
0x10000478 <main+12>:   stw     r3,24(r31)
0x1000047c <main+16>:   stw     r4,28(r31)
0x10000480 <main+20>:   li      r0,4
0x10000484 <main+24>:   stw     r0,8(r31)
0x10000488 <main+28>:   .long 0x7c284fec
0x1000048c <main+32>:   .long 0xed405834
0x10000490 <main+36>:   lwz     r11,0(r1)
0x10000494 <main+40>:   lwz     r31,-4(r11)
0x10000498 <main+44>:   mr      r1,r11
0x1000049c <main+48>:   blr
End of assembler dump.
(gdb)

In the output above, ".long 0x7c284fec" is an instruction available
only in power4 or later processors (dcbzl), and ".long 0xed405834"
is available only in power5 or later (frsqrtes).

The attached patch makes GDB always use the -Many option of the
disassembler, which will make it disassemble every instruction it
understands.

Here's the output with the patch applied:

(gdb) disassemble main
Dump of assembler code for function main:
0x1000046c <main+0>:    stwu    r1,-48(r1)
0x10000470 <main+4>:    stw     r31,44(r1)
0x10000474 <main+8>:    mr      r31,r1
0x10000478 <main+12>:   stw     r3,24(r31)
0x1000047c <main+16>:   stw     r4,28(r31)
0x10000480 <main+20>:   li      r0,4
0x10000484 <main+24>:   stw     r0,8(r31)
0x10000488 <main+28>:   dcbzl   r8,r9
0x1000048c <main+32>:   frsqrtes f10,f11
0x10000490 <main+36>:   lwz     r11,0(r1)
0x10000494 <main+40>:   lwz     r31,-4(r11)
0x10000498 <main+44>:   mr      r1,r11
0x1000049c <main+48>:   blr
End of assembler dump.
(gdb)

Comments? Can this patch be applied?
-- 
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center

[-- Attachment #2: ppc-disassemble-any.diff --]
[-- Type: text/x-patch, Size: 440 bytes --]

--- rs6000-tdep.c.orig	2007-01-31 21:10:19.000000000 -0200
+++ rs6000-tdep.c	2007-01-31 21:10:22.000000000 -0200
@@ -2904,6 +2904,9 @@ find_variant_by_arch (enum bfd_architect
 static int
 gdb_print_insn_powerpc (bfd_vma memaddr, disassemble_info *info)
 {
+  if (!info->disassembler_options)
+    info->disassembler_options = "any";
+
   if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     return print_insn_big_powerpc (memaddr, info);
   else

[-- Attachment #3: ChangeLog --]
[-- Type: text/x-changelog, Size: 157 bytes --]

2007-01-31  Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* rs6000-tdep.c (gdb_print_insn_powerpc): ensure
	info->disassembler_options has the "any" value.

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

* Re: [PATCH] (not) disassembling power[456] instructions in GDB
  2007-02-01  0:23 (not) disassembling power[456] instructions in GDB Thiago Jung Bauermann
@ 2007-02-01 17:11 ` Thiago Jung Bauermann
  2007-02-06 15:06 ` Thiago Jung Bauermann
  1 sibling, 0 replies; 4+ messages in thread
From: Thiago Jung Bauermann @ 2007-02-01 17:11 UTC (permalink / raw)
  To: gdb-patches

On Wed, 2007-01-31 at 22:22 -0200, Thiago Jung Bauermann wrote:
> Comments? Can this patch be applied?

Sorry, I forgot to tag this message as [PATCH], and I also forgot to
mention that I ran the testsuite with no regressions on a power5
machine:

               === gdb tests ===
@@ -180,7 +181,6 @@
 Running ../.././gdb/testsuite/gdb.base/mips_pro.exp ...
 Running ../.././gdb/testsuite/gdb.base/miscexprs.exp ...
 Running ../.././gdb/testsuite/gdb.base/multi-forks.exp ...
-FAIL: gdb.base/multi-forks.exp: follow parent, print pids
 Running ../.././gdb/testsuite/gdb.base/nodebug.exp ...
 Running ../.././gdb/testsuite/gdb.base/opaque.exp ...
 Running ../.././gdb/testsuite/gdb.base/overlays.exp ...
@@ -694,14 +694,14 @@

                === gdb Summary ===

-# of expected passes           10845
-# of unexpected failures       305
+# of expected passes           10846
+# of unexpected failures       304
 # of expected failures         41
 # of known failures            63
 # of unresolved testcases      13
 # of untested testcases                4
 # of unsupported tests         11
-/home/bauermann/gdb-6.6.orig/gdb/testsuite/../../gdb/gdb version  6.6
-nx
+/home/bauermann/gdb-6.6.patched/gdb/testsuite/../../gdb/gdb version
6.6 -nx

I don't think that the FAIL which went away is related to my patch, BTW.
-- 
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center


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

* Re: (not) disassembling power[456] instructions in GDB
  2007-02-01  0:23 (not) disassembling power[456] instructions in GDB Thiago Jung Bauermann
  2007-02-01 17:11 ` [PATCH] " Thiago Jung Bauermann
@ 2007-02-06 15:06 ` Thiago Jung Bauermann
  2007-02-08 18:05   ` Daniel Jacobowitz
  1 sibling, 1 reply; 4+ messages in thread
From: Thiago Jung Bauermann @ 2007-02-06 15:06 UTC (permalink / raw)
  To: gdb-patches

Hi folks,

On Wed, 2007-01-31 at 22:22 -0200, Thiago Jung Bauermann wrote:
> The attached patch makes GDB always use the -Many option of the
> disassembler, which will make it disassemble every instruction it
> understands.

<skip>

> Comments? Can this patch be applied?

Any news on this? If there is a better way to approach this problem I
could implement it, but since I'm rather new to GDB hacking, I need some
input... :-)
-- 
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center


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

* Re: (not) disassembling power[456] instructions in GDB
  2007-02-06 15:06 ` Thiago Jung Bauermann
@ 2007-02-08 18:05   ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2007-02-08 18:05 UTC (permalink / raw)
  To: Thiago Jung Bauermann; +Cc: gdb-patches

On Tue, Feb 06, 2007 at 01:05:33PM -0200, Thiago Jung Bauermann wrote:
> Any news on this? If there is a better way to approach this problem I
> could implement it, but since I'm rather new to GDB hacking, I need some
> input... :-)

Thanks for the patch.  I'd been hoping someone who was more familiar
with PowerPC would comment, but it seems right to me, and no one has -
so I applied it.

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2007-02-08 18:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-01  0:23 (not) disassembling power[456] instructions in GDB Thiago Jung Bauermann
2007-02-01 17:11 ` [PATCH] " Thiago Jung Bauermann
2007-02-06 15:06 ` Thiago Jung Bauermann
2007-02-08 18:05   ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox