* gdbthread.h (struct thread_info): Add comments around
[deliverable/binutils-gdb.git] / gdb / i386gnu-nat.c
index b8b98a3e06cec5430732f60cfcc3ec1df359164f..6545d08604ebb9afa053f89a7819ff8ec2e15e12 100644 (file)
@@ -1,6 +1,6 @@
 /* Low level interface to i386 running the GNU Hurd.
 
-   Copyright (C) 1992, 1995, 1996, 1998, 2000, 2001, 2004, 2007
+   Copyright (C) 1992, 1995, 1996, 1998, 2000, 2001, 2004, 2007, 2008
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -118,10 +118,11 @@ gnu_fetch_registers (struct regcache *regcache, int regno)
   /* Make sure we know about new threads.  */
   inf_update_procs (current_inferior);
 
-  thread = inf_tid_to_thread (current_inferior, PIDGET (inferior_ptid));
+  thread = inf_tid_to_thread (current_inferior,
+                             ptid_get_tid (inferior_ptid));
   if (!thread)
-    error (_("Can't fetch registers from thread %d: No such thread"),
-          PIDGET (inferior_ptid));
+    error (_("Can't fetch registers from thread %s: No such thread"),
+          target_pid_to_str (inferior_ptid));
 
   if (regno < I386_NUM_GREGS || regno == -1)
     {
@@ -149,7 +150,8 @@ gnu_fetch_registers (struct regcache *regcache, int regno)
       else
        {
          proc_debug (thread, "fetching register %s",
-                     gdbarch_register_name (current_gdbarch, regno));
+                     gdbarch_register_name (get_regcache_arch (regcache),
+                                            regno));
 
          regcache_raw_supply (regcache, regno,
                               REG_ADDR (state, regno));
@@ -203,14 +205,16 @@ void
 gnu_store_registers (struct regcache *regcache, int regno)
 {
   struct proc *thread;
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
 
   /* Make sure we know about new threads.  */
   inf_update_procs (current_inferior);
 
-  thread = inf_tid_to_thread (current_inferior, PIDGET (inferior_ptid));
+  thread = inf_tid_to_thread (current_inferior,
+                             ptid_get_tid (inferior_ptid));
   if (!thread)
-    error (_("Couldn't store registers into thread %d: No such thread"),
-          PIDGET (inferior_ptid));
+    error (_("Couldn't store registers into thread %s: No such thread"),
+          target_pid_to_str (inferior_ptid));
 
   if (regno < I386_NUM_GREGS || regno == -1)
     {
@@ -243,11 +247,11 @@ gnu_store_registers (struct regcache *regcache, int regno)
            if ((thread->fetched_regs & (1 << check_regno))
                && memcpy (REG_ADDR (&old_state, check_regno),
                           REG_ADDR (state, check_regno),
-                          register_size (current_gdbarch, check_regno)))
+                          register_size (gdbarch, check_regno)))
              /* Register CHECK_REGNO has changed!  Ack!  */
              {
                warning (_("Register %s changed after the thread was aborted"),
-                        gdbarch_register_name (current_gdbarch, check_regno));
+                        gdbarch_register_name (gdbarch, check_regno));
                if (regno >= 0 && regno != check_regno)
                  /* Update GDB's copy of the register.  */
                  regcache_raw_supply (regcache, check_regno,
@@ -270,7 +274,7 @@ gnu_store_registers (struct regcache *regcache, int regno)
       else
        {
          proc_debug (thread, "storing register %s",
-                     gdbarch_register_name (current_gdbarch, regno));
+                     gdbarch_register_name (gdbarch, regno));
 
          gdb_assert (regcache_valid_p (regcache, regno));
          regcache_raw_collect (regcache, regno, REG_ADDR (state, regno));
This page took 0.034206 seconds and 4 git commands to generate.