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));
}