* Makefile.in (gencode): Provide explicit path to gencode.c.
[deliverable/binutils-gdb.git] / gdb / i386gnu-nat.c
index bc13229d9909eca32105a2d5c1c86ed33b045813..da5ef0e6e85154fd723c8b0afb3a87bc88bfc334 100644 (file)
@@ -1,5 +1,6 @@
 /* Low level interface to i386 running the GNU Hurd.
-   Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc.
+   Copyright 1992, 1995, 1996, 1998, 2000, 2001
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -21,8 +22,9 @@
 #include "defs.h"
 #include "inferior.h"
 #include "floatformat.h"
+#include "regcache.h"
 
-#include <assert.h>
+#include "gdb_assert.h"
 #include <stdio.h>
 #include <errno.h>
 
@@ -130,10 +132,10 @@ gnu_fetch_registers (int regno)
   /* Make sure we know about new threads.  */
   inf_update_procs (current_inferior);
 
-  thread = inf_tid_to_thread (current_inferior, inferior_pid);
+  thread = inf_tid_to_thread (current_inferior, PIDGET (inferior_ptid));
   if (!thread)
     error ("Can't fetch registers from thread %d: No such thread",
-          inferior_pid);
+          PIDGET (inferior_ptid));
 
   if (regno < NUM_GREGS || regno == -1)
     {
@@ -254,10 +256,10 @@ gnu_store_registers (int regno)
   /* Make sure we know about new threads.  */
   inf_update_procs (current_inferior);
 
-  thread = inf_tid_to_thread (current_inferior, inferior_pid);
+  thread = inf_tid_to_thread (current_inferior, PIDGET (inferior_ptid));
   if (!thread)
     error ("Couldn't store registers into thread %d: No such thread",
-          inferior_pid);
+          PIDGET (inferior_ptid));
 
   if (regno < NUM_GREGS || regno == -1)
     {
@@ -265,6 +267,7 @@ gnu_store_registers (int regno)
       thread_state_data_t old_state;
       int was_aborted = thread->aborted;
       int was_valid = thread->state_valid;
+      int trace;
 
       if (!was_aborted && was_valid)
        memcpy (&old_state, &thread->state, sizeof (old_state));
@@ -276,6 +279,10 @@ gnu_store_registers (int regno)
          return;
        }
 
+      /* Save the T bit.  We might try to restore the %eflags register
+         below, but changing the T bit would seriously confuse GDB.  */
+      trace = ((struct i386_thread_state *)state)->efl & 0x100;
+
       if (!was_aborted && was_valid)
        /* See which registers have changed after aborting the thread.  */
        {
@@ -316,9 +323,13 @@ gnu_store_registers (int regno)
        {
          proc_debug (thread, "storing register %s", REGISTER_NAME (regno));
 
-         assert (register_valid[regno]);
+         gdb_assert (register_valid[regno]);
          fill (state, regno);
        }
+
+      /* Restore the T bit.  */
+      ((struct i386_thread_state *)state)->efl &= ~0x100;
+      ((struct i386_thread_state *)state)->efl |= trace;
     }
 
 #undef fill
This page took 0.025964 seconds and 4 git commands to generate.