This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Fix power7 ppc64 binaries loading
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Thiago Jung Bauermann <bauerman at br dot ibm dot com>, Peter Bergner <bergner at vnet dot ibm dot com>
- Date: Mon, 2 Mar 2009 22:02:38 +0100
- Subject: [patch] Fix power7 ppc64 binaries loading
Hi,
on the binary from:
./gas/as-new -mpower7 -o /tmp/power7c.o ./gas/testsuite/gas/ppc/power7.s
Class: ELF64
Machine: PowerPC64
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 4] .PPC.EMB.apuinfo PROGBITS 0000000000000000 000001e0
0000000000000018 0000000000000000 0 0 1
FSF GDB HEAD prints:
$ ./gdb -q -nx -ex 'set pagination off' -ex 'x/100i 0' /tmp/power7.o
</dev/null
Architecture of file not recognized.
0x0: Cannot access memory at address 0x0
(gdb) quit
With the attached patch it prints an instruction dump.
It is a regression for power7 ppc64 binaries by:
http://sourceware.org/ml/gdb-patches/2002-08/threads.html#00629
http://sourceware.org/ml/gdb-cvs/2002-08/msg00263.html
> A powerpc executable doesn't have indications of which variant it is meant to
> run on.
There is the tdesc_* infrastructure for this purpose for remote targets, there
is a `info->disassembler_options = "any"' hack for local target by:
http://sourceware.org/ml/gdb-patches/2007-02/msg00000.html
http://sourceware.org/ml/gdb-cvs/2007-02/msg00061.html
Regression tested on powerpc64-unknown-linux-gnu (PPC970MP).
Thanks,
Jan
gdb/
2009-03-02 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix power7 ppc64 binaries loading.
* rs6000-tdep.c (rs6000_gdbarch_init): Remove variable `sect'. Remove
the ppc32 e500 detection from `.PPC.EMB.apuinfo' section existence.
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 926d0b6..1c59a42 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3326,7 +3331,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
enum bfd_architecture arch;
unsigned long mach;
bfd abfd;
- asection *sect;
enum auto_boolean soft_float_flag = powerpc_soft_float_global;
int soft_float;
enum powerpc_vector_abi vector_abi = powerpc_vector_abi_global;
@@ -3375,26 +3379,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
arch = info.bfd_arch_info->arch;
mach = info.bfd_arch_info->mach;
- /* For e500 executables, the apuinfo section is of help here. Such
- section contains the identifier and revision number of each
- Application-specific Processing Unit that is present on the
- chip. The content of the section is determined by the assembler
- which looks at each instruction and determines which unit (and
- which version of it) can execute it. In our case we just look for
- the existance of the section. */
-
- if (info.abfd)
- {
- sect = bfd_get_section_by_name (info.abfd, ".PPC.EMB.apuinfo");
- if (sect)
- {
- arch = info.bfd_arch_info->arch;
- mach = bfd_mach_ppc_e500;
- bfd_default_set_arch_mach (&abfd, arch, mach);
- info.bfd_arch_info = bfd_get_arch_info (&abfd);
- }
- }
-
/* Find a default target description which describes our register
layout, if we do not already have one. */
if (! tdesc_has_registers (tdesc))