* linux-low.c (linux_kill): Handle being called with no threads.
authorDaniel Jacobowitz <drow@false.org>
Wed, 3 Jan 2007 17:57:16 +0000 (17:57 +0000)
committerDaniel Jacobowitz <drow@false.org>
Wed, 3 Jan 2007 17:57:16 +0000 (17:57 +0000)
* win32-i386-low.c (win32_kill): Likewise.
(get_child_debug_event): Clear current_process_handle.

gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-low.c
gdb/gdbserver/win32-i386-low.c

index d2b7d3b67b428978ec5c8ca5edc78ec708e7acd2..2035473d5d7044464a664ea579150d16f4a6ac22 100644 (file)
@@ -1,4 +1,11 @@
-2006-12-30  Denis PILAT <denis.pilat@st.com>
+2007-01-03  Denis Pilat  <denis.pilat@st.com>
+           Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * linux-low.c (linux_kill): Handle being called with no threads.
+       * win32-i386-low.c (win32_kill): Likewise.
+       (get_child_debug_event): Clear current_process_handle.
+
+2006-12-30  Denis PILAT  <denis.pilat@st.com>
            Daniel Jacobowitz  <dan@codesourcery.com>
 
        * remote-utils.c (remote_open): Check the type of specified
index 83a56aa1faa84aaacb68fc7b827123c1fbddb953..64273b50ae92d46199443429f6e088a59194f3af 100644 (file)
@@ -255,13 +255,17 @@ static void
 linux_kill (void)
 {
   struct thread_info *thread = (struct thread_info *) all_threads.head;
-  struct process_info *process = get_thread_process (thread);
+  struct process_info *process;
   int wstat;
 
+  if (thread == NULL)
+    return;
+
   for_each_inferior (&all_threads, linux_kill_one_process);
 
   /* See the comment in linux_kill_one_process.  We did not kill the first
      thread in the list, so do so now.  */
+  process = get_thread_process (thread);
   do
     {
       ptrace (PTRACE_KILL, pid_of (process), 0, 0);
index de6ef0b84610382878ca71981ae05edea7627dfc..ee2d2d19c04966c44e1d7a745526a969fa77c413 100644 (file)
@@ -582,6 +582,9 @@ win32_attach (unsigned long pid)
 static void
 win32_kill (void)
 {
+  if (current_process_handle == NULL)
+    return;
+
   TerminateProcess (current_process_handle, 0);
   for (;;)
     {
@@ -901,6 +904,7 @@ in:
       ourstatus->kind = TARGET_WAITKIND_EXITED;
       ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode;
       CloseHandle (current_process_handle);
+      current_process_handle = NULL;
       retval = main_thread_id;
       break;