This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch, arm] Use read_memory_unsigned_integer to get address
- From: Yao Qi <yao at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 22 Sep 2011 09:25:35 +0800
- Subject: [patch, arm] Use read_memory_unsigned_integer to get address
When looking at a problem reported here
<http://sourceware.org/ml/gdb/2011-09/msg00045.html>, we find that this
problem is caused by signed extension done by read_memory_integer for
PC value.
This patch is obvious, so I didn't run regression testsuite. Ok for
mainline?
--
Yao (éå)
gdb/
* arm-tdep.c (arm_get_next_pc_raw): Use read_memory_unsigned_integer
to get address.
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 278e6e9..add6be8 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -4779,8 +4779,9 @@ arm_get_next_pc_raw (struct frame_info *frame, CORE_ADDR pc)
else
base -= offset;
}
- nextpc = (CORE_ADDR) read_memory_integer ((CORE_ADDR) base,
- 4, byte_order);
+ nextpc =
+ (CORE_ADDR) read_memory_unsigned_integer ((CORE_ADDR) base,
+ 4, byte_order);
}
}
break;
@@ -4794,6 +4795,9 @@ arm_get_next_pc_raw (struct frame_info *frame, CORE_ADDR pc)
{
/* loading pc */
int offset = 0;
+ unsigned long rn_val
+ = get_frame_register_unsigned (frame,
+ bits (this_instr, 16, 19));
if (bit (this_instr, 23))
{
@@ -4806,15 +4810,10 @@ arm_get_next_pc_raw (struct frame_info *frame, CORE_ADDR pc)
else if (bit (this_instr, 24))
offset = -4;
- {
- unsigned long rn_val =
- get_frame_register_unsigned (frame,
- bits (this_instr, 16, 19));
- nextpc =
- (CORE_ADDR) read_memory_integer ((CORE_ADDR) (rn_val
- + offset),
- 4, byte_order);
- }
+ nextpc =
+ (CORE_ADDR) read_memory_unsigned_integer ((CORE_ADDR)
+ (rn_val + offset),
+ 4, byte_order);
}
}
break;