aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2015-10-12 11:28:38 +0100
committerYao Qi <yao.qi@linaro.org>2015-10-12 11:28:38 +0100
commit70b439f0a87b6c42901e49a71b1dbd09300e8260 (patch)
treeb78bf2a5061172f4db95ed9c2ee5c3fb050f0f12
parent8240f4421f7ab761ff5476d16090789d2332b676 (diff)
downloadgdb-70b439f0a87b6c42901e49a71b1dbd09300e8260.zip
gdb-70b439f0a87b6c42901e49a71b1dbd09300e8260.tar.gz
gdb-70b439f0a87b6c42901e49a71b1dbd09300e8260.tar.bz2
Move target_read_uint32 out of aarch64_relocate_instruction
This patch is to move target_read_uint32 out of aarch64_relocate_instruction and pass INSN to aarch64_relocate_instruction, so that it is cleaner, only decode instructions. gdb/gdbserver: 2015-10-12 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (aarch64_relocate_instruction): Add argument insn. Remove local variable insn. Don't call target_read_uint32. (aarch64_install_fast_tracepoint_jump_pad): Call target_read_uint32.
-rw-r--r--gdb/gdbserver/ChangeLog8
-rw-r--r--gdb/gdbserver/linux-aarch64-low.c13
2 files changed, 14 insertions, 7 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index b631894..5d60f54 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,11 @@
+2015-10-12 Yao Qi <yao.qi@linaro.org>
+
+ * linux-aarch64-low.c (aarch64_relocate_instruction): Add
+ argument insn. Remove local variable insn. Don't call
+ target_read_uint32.
+ (aarch64_install_fast_tracepoint_jump_pad): Call
+ target_read_uint32.
+
2015-09-30 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (emit_movk): Shorten a long line.
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index 5592e61..909ba65 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -1924,8 +1924,8 @@ can_encode_int32 (int32_t val, unsigned bits)
return rest == 0 || rest == -1;
}
-/* Relocate an instruction from OLDLOC to *TO. This function will also
- increment TO by the number of bytes the new instruction(s) take(s).
+/* Relocate an instruction INSN from OLDLOC to *TO. This function will
+ also increment TO by the number of bytes the new instruction(s) take(s).
PC relative instructions need to be handled specifically:
@@ -1937,11 +1937,10 @@ can_encode_int32 (int32_t val, unsigned bits)
- LDR/LDRSW (literal) */
static void
-aarch64_relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc)
+aarch64_relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc, uint32_t insn)
{
uint32_t buf[32];
uint32_t *p = buf;
- uint32_t insn;
int is_bl;
int is64;
@@ -1956,8 +1955,6 @@ aarch64_relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc)
unsigned bit;
int32_t offset;
- target_read_uint32 (oldloc, &insn);
-
if (aarch64_decode_b (oldloc, insn, &is_bl, &offset))
{
offset = (oldloc - *to + offset);
@@ -2120,6 +2117,7 @@ aarch64_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
uint32_t *p = buf;
int32_t offset;
int i;
+ uint32_t insn;
CORE_ADDR buildaddr = *jump_entry;
/* We need to save the current state on the stack both to restore it
@@ -2422,7 +2420,8 @@ aarch64_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
/* Now emit the relocated instruction. */
*adjusted_insn_addr = buildaddr;
- aarch64_relocate_instruction (&buildaddr, tpaddr);
+ target_read_uint32 (tpaddr, &insn);
+ aarch64_relocate_instruction (&buildaddr, tpaddr, insn);
*adjusted_insn_addr_end = buildaddr;
/* We may not have been able to relocate the instruction. */