summaryrefslogtreecommitdiff
path: root/gdb/i386-linux-nat.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-05-12 00:17:05 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-05-12 00:17:05 +0000
commit66669ffc29df4da1efd5930cbac48fa1be72515a (patch)
tree577933a897bf1d0df7f0c9cc5c5b7c16789558ed /gdb/i386-linux-nat.c
parent0db187629533a46f56f08a5d2474c881120a2811 (diff)
downloadgdb-66669ffc29df4da1efd5930cbac48fa1be72515a.tar.gz
* i386-linux-nat.c (i386_linux_resume): Use regcache functions
instead of read_register and read_register_pid. * ia64-linux-nat.c (enable_watchpoints_in_psr): Use REGCACHE argument instead of PTID. Use regcache functions instead of read_register_pid. (ia64_linux_insert_watchpoint): Update call. (ia64_linux_stopped_data_address): Use regcache functions instead of read_register_pid and write_register_pid.
Diffstat (limited to 'gdb/i386-linux-nat.c')
-rw-r--r--gdb/i386-linux-nat.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 7a71c605285..3275ccb4b87 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -736,11 +736,16 @@ i386_linux_resume (ptid_t ptid, int step, enum target_signal signal)
if (step)
{
- CORE_ADDR pc = read_pc_pid (pid_to_ptid (pid));
+ struct cleanup *old_chain = save_inferior_ptid ();
+ struct regcache *regcache = current_regcache;
+ ULONGEST pc;
gdb_byte buf[LINUX_SYSCALL_LEN];
request = PTRACE_SINGLESTEP;
+ inferior_ptid = pid_to_ptid (pid);
+ regcache_cooked_read_unsigned (regcache, PC_REGNUM, &pc);
+
/* Returning from a signal trampoline is done by calling a
special system call (sigreturn or rt_sigreturn, see
i386-linux-tdep.c for more information). This system call
@@ -753,18 +758,21 @@ i386_linux_resume (ptid_t ptid, int step, enum target_signal signal)
if (read_memory_nobpt (pc, buf, LINUX_SYSCALL_LEN) == 0
&& memcmp (buf, linux_syscall, LINUX_SYSCALL_LEN) == 0)
{
- int syscall = read_register_pid (LINUX_SYSCALL_REGNUM,
- pid_to_ptid (pid));
+ ULONGEST syscall;
+ regcache_cooked_read_unsigned (regcache,
+ LINUX_SYSCALL_REGNUM, &syscall);
/* Then check the system call number. */
if (syscall == SYS_sigreturn || syscall == SYS_rt_sigreturn)
{
- CORE_ADDR sp = read_register (I386_ESP_REGNUM);
- CORE_ADDR addr = sp;
+ ULONGEST sp, addr;
unsigned long int eflags;
+ regcache_cooked_read_unsigned (regcache, I386_ESP_REGNUM, &sp);
if (syscall == SYS_rt_sigreturn)
addr = read_memory_integer (sp + 8, 4) + 20;
+ else
+ addr = sp;
/* Set the trace flag in the context that's about to be
restored. */
@@ -774,6 +782,8 @@ i386_linux_resume (ptid_t ptid, int step, enum target_signal signal)
write_memory (addr, (gdb_byte *) &eflags, 4);
}
}
+
+ do_cleanups (old_chain);
}
if (ptrace (request, pid, 0, target_signal_to_host (signal)) == -1)