aboutsummaryrefslogtreecommitdiff
path: root/gdb/rs6000-tdep.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2013-06-04 02:44:35 +0000
committerAlan Modra <amodra@gmail.com>2013-06-04 02:44:35 +0000
commit845d47080b7d7e068e4ec3d11fe6e27b403ac6e3 (patch)
tree91921c847306eb89c9e83e20f6cf65817cb999fc /gdb/rs6000-tdep.c
parent404e278f8d2b72c163f7d5f1555c530d5964fa54 (diff)
downloadgdb-845d47080b7d7e068e4ec3d11fe6e27b403ac6e3.zip
gdb-845d47080b7d7e068e4ec3d11fe6e27b403ac6e3.tar.gz
gdb-845d47080b7d7e068e4ec3d11fe6e27b403ac6e3.tar.bz2
* ppc-tdep.h (ppc_insns_match_pattern): Update prototype.
* rs6000-tdep.c (read_insn): Add frame param, don't assume big-endian. (ppc_insns_match_pattern): Add frame param. Avoid multiple target mem reads on optional insns. * ppc-linux-tdep.c (ppc_skip_trampoline_code): Update ppc_insns_match_pattern calls. * ppc64-tdep.c (ppc64_standard_linkage2, ppc64_standard_linkage3): Add match for power7 thread safety insns, and new order of std 2,40(1) insn. Correct code shown for _dl_runtime_resolve invocation in comment, and update rest of comment. (PPC64_STANDARD_LINKAGE1_LEN, PPC64_STANDARD_LINKAGE2_LEN, PPC64_STANDARD_LINKAGE3_LEN): Delete. (ppc64_standard_linkage2_target): Update insn offsets. (ppc64_skip_trampoline_code): Use a single insn buffer. Match newer stubs first. Update calls.
Diffstat (limited to 'gdb/rs6000-tdep.c')
-rw-r--r--gdb/rs6000-tdep.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index bebbdb5..d3ff09d 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -4238,14 +4238,15 @@ show_powerpc_exact_watchpoints (struct ui_file *file, int from_tty,
fprintf_filtered (file, _("Use of exact watchpoints is %s.\n"), value);
}
-/* Read a PPC instruction from memory. PPC instructions are always
- big-endian, no matter what endianness the program is running in, so
- we can hardcode BFD_ENDIAN_BIG for read_memory_unsigned_integer. */
+/* Read a PPC instruction from memory. */
static unsigned int
-read_insn (CORE_ADDR pc)
+read_insn (struct frame_info *frame, CORE_ADDR pc)
{
- return read_memory_unsigned_integer (pc, 4, BFD_ENDIAN_BIG);
+ struct gdbarch *gdbarch = get_frame_arch (frame);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+
+ return read_memory_unsigned_integer (pc, 4, byte_order);
}
/* Return non-zero if the instructions at PC match the series
@@ -4262,19 +4263,25 @@ read_insn (CORE_ADDR pc)
i'th instruction in memory. */
int
-ppc_insns_match_pattern (CORE_ADDR pc, struct ppc_insn_pattern *pattern,
- unsigned int *insn)
+ppc_insns_match_pattern (struct frame_info *frame, CORE_ADDR pc,
+ struct ppc_insn_pattern *pattern,
+ unsigned int *insns)
{
int i;
+ unsigned int insn;
- for (i = 0; pattern[i].mask; i++)
+ for (i = 0, insn = 0; pattern[i].mask; i++)
{
- insn[i] = read_insn (pc);
- if ((insn[i] & pattern[i].mask) == pattern[i].data)
- pc += 4;
- else if (pattern[i].optional)
- insn[i] = 0;
- else
+ if (insn == 0)
+ insn = read_insn (frame, pc);
+ insns[i] = 0;
+ if ((insn & pattern[i].mask) == pattern[i].data)
+ {
+ insns[i] = insn;
+ pc += 4;
+ insn = 0;
+ }
+ else if (!pattern[i].optional)
return 0;
}