* lib/gdb.exp (build_id_debug_filename_get): Improve check for
[deliverable/binutils-gdb.git] / gdb / i386-linux-nat.c
index 1541cfc890414ff3e05a68acb0ae510817b5bc5b..83484e8a413351b1d30ede8db4bb9749bfcd4ccf 100644 (file)
@@ -7,7 +7,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -16,9 +16,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
 #include "inferior.h"
@@ -246,6 +244,7 @@ static void
 fetch_regs (struct regcache *regcache, int tid)
 {
   elf_gregset_t regs;
+  elf_gregset_t *regs_p = &regs;
 
   if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
     {
@@ -260,7 +259,7 @@ fetch_regs (struct regcache *regcache, int tid)
       perror_with_name (_("Couldn't get registers"));
     }
 
-  supply_gregset (regcache, (const elf_gregset_t *) &regs);
+  supply_gregset (regcache, (const elf_gregset_t *) regs_p);
 }
 
 /* Store all valid general-purpose registers in GDB's register array
@@ -738,15 +737,14 @@ i386_linux_resume (ptid_t ptid, int step, enum target_signal signal)
 
   if (step)
     {
-      struct cleanup *old_chain = save_inferior_ptid ();
-      struct regcache *regcache = current_regcache;
+      struct regcache *regcache = get_thread_regcache (pid_to_ptid (pid));
       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);
+      regcache_cooked_read_unsigned (regcache,
+                                    gdbarch_pc_regnum (current_gdbarch), &pc);
 
       /* Returning from a signal trampoline is done by calling a
          special system call (sigreturn or rt_sigreturn, see
@@ -784,8 +782,6 @@ 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)
This page took 0.02415 seconds and 4 git commands to generate.