This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch, i386] 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 10:08:48 +0800
- Subject: [patch, i386] Use read_memory_unsigned_integer to get address
The address on i386 is unsigned, so we should use
read_memory_unsigned_integer to fetch address from memory.
OK to apply?
--
Yao (éå)
gdb/
* i386-linux-nat.c (i386_linux_resume): Use read_memory_unsigned_integer
to get address.
* i386obsd-nat.c (i386obsd_supply_pcb): Likewise.
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index e32a119..6257931 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -893,7 +893,8 @@ i386_linux_resume (struct target_ops *ops,
regcache_cooked_read_unsigned (regcache, I386_ESP_REGNUM, &sp);
if (syscall == SYS_rt_sigreturn)
- addr = read_memory_integer (sp + 8, 4, byte_order) + 20;
+ addr = read_memory_unsigned_integer (sp + 8, 4, byte_order)
+ + 20;
else
addr = sp;
diff --git a/gdb/i386obsd-nat.c b/gdb/i386obsd-nat.c
index db1f693..1c0d047 100644
--- a/gdb/i386obsd-nat.c
+++ b/gdb/i386obsd-nat.c
@@ -78,8 +78,8 @@ i386obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
{
/* No, the pcb must have been last updated by savectx(). */
pcb->pcb_esp = pcb->pcb_ebp;
- pcb->pcb_ebp = read_memory_integer(pcb->pcb_esp, 4, byte_order);
- sf.sf_eip = read_memory_integer(pcb->pcb_esp + 4, 4, byte_order);
+ pcb->pcb_ebp = read_memory_unsigned_integer (pcb->pcb_esp, 4, byte_order);
+ sf.sf_eip = read_memory_unsigned_integer (pcb->pcb_esp + 4, 4, byte_order);
regcache_raw_supply (regcache, I386_EIP_REGNUM, &sf.sf_eip);
}