2001-04-03 David Mosberger <davidm@hpl.hp.com>
[deliverable/binutils-gdb.git] / gdb / lin-lwp.c
index 59de1180c8edeed2793d7f9ca734ac7abb76515d..42e98de701d970aaf140c1c4e15afcb510e272c1 100644 (file)
@@ -1,5 +1,5 @@
 /* Multi-threaded debugging support for Linux (LWP layer).
-   Copyright 2000 Free Software Foundation, Inc.
+   Copyright 2000, 2001 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -29,6 +29,7 @@
 #include "gdbthread.h"
 #include "inferior.h"
 #include "target.h"
+#include "regcache.h"
 
 #define DEBUG 1
 
@@ -164,7 +165,7 @@ init_lwp_list (void)
   for (lp = lwp_list; lp; lp = lpnext)
     {
       lpnext = lp->next;
-      free (lp);
+      xfree (lp);
     }
 
   lwp_list = NULL;
@@ -222,7 +223,7 @@ delete_lwp (int pid)
   else
     lwp_list = lp->next;
 
-  free (lp);
+  xfree (lp);
 }
 
 /* Return a pointer to the structure describing the LWP corresponding
@@ -268,7 +269,7 @@ restore_inferior_pid (void *arg)
 {
   int *saved_pid_ptr = arg;
   inferior_pid = *saved_pid_ptr;
-  free (arg);
+  xfree (arg);
 }
 
 static struct cleanup *
@@ -438,10 +439,6 @@ lin_lwp_resume (int pid, int step, enum target_signal signo)
     {
       pid = GET_LWP (lp->pid);
 
-      /* Mark LWP as not stopped to prevent it from being continued by
-        resume_callback.  */
-      lp->stopped = 0;
-
       /* Remember if we're stepping.  */
       lp->step = step;
 
@@ -454,6 +451,10 @@ lin_lwp_resume (int pid, int step, enum target_signal signo)
          gdb_assert (signo == TARGET_SIGNAL_0);
          return;
        }
+
+      /* Mark LWP as not stopped to prevent it from being continued by
+        resume_callback.  */
+      lp->stopped = 0;
     }
 
   if (resume_all)
@@ -506,14 +507,19 @@ stop_wait_callback (struct lwp_info *lp, void *data)
       if (WIFEXITED (status) || WIFSIGNALED (status))
        {
          gdb_assert (num_lwps > 1);
-         gdb_assert (! is_cloned (lp->pid));
-
-         gdb_assert (in_thread_list (lp->pid));
-         if (lp->pid != inferior_pid)
-           delete_thread (lp->pid);
-         printf_unfiltered ("[%s exited]\n",
-                            target_pid_to_str (lp->pid));
 
+         if (in_thread_list (lp->pid))
+           {
+             /* Core GDB cannot deal with us deleting the current
+                thread.  */
+             if (lp->pid != inferior_pid)
+               delete_thread (lp->pid);
+             printf_unfiltered ("[%s exited]\n",
+                                target_pid_to_str (lp->pid));
+           }
+#if DEBUG
+         printf ("%s exited.\n", target_pid_to_str (lp->pid));
+#endif
          delete_lwp (lp->pid);
          return 0;
        }
@@ -708,7 +714,7 @@ lin_lwp_wait (int pid, struct target_waitstatus *ourstatus)
            {
              if (in_thread_list (lp->pid))
                {
-                 /* Core GDB cannot deal with us deeting the current
+                 /* Core GDB cannot deal with us deleting the current
                      thread.  */
                  if (lp->pid != inferior_pid)
                    delete_thread (lp->pid);
@@ -930,6 +936,7 @@ lin_lwp_store_registers (int regno)
 
 static int
 lin_lwp_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+                    struct mem_attrib *attrib,
                     struct target_ops *target)
 {
   struct cleanup *old_chain = save_inferior_pid ();
@@ -938,7 +945,7 @@ lin_lwp_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
   if (is_lwp (inferior_pid))
     inferior_pid = GET_LWP (inferior_pid);
 
-  xfer = child_xfer_memory (memaddr, myaddr, len, write, target);
+  xfer = child_xfer_memory (memaddr, myaddr, len, write, attrib, target);
 
   do_cleanups (old_chain);
   return xfer;
This page took 0.025622 seconds and 4 git commands to generate.