Announce thread death on MS-Windows.
authorEli Zaretskii <eliz@gnu.org>
Sat, 4 May 2013 13:36:18 +0000 (13:36 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 4 May 2013 13:36:18 +0000 (13:36 +0000)
* windows-nat.c (windows_delete_thread): Accept an additional
argument, the thread's exit code, and announce thread death when
print_thread_events is non-zero and we are deleting a thread that
is not the main thread.
(get_windows_debug_event): Pass thread exit code to
windows_delete_thread.

gdb/ChangeLog
gdb/windows-nat.c

index ceaf838b942e1fd6b90d5ba398c096b12d7e793e..44d028e72d7106b2db54e7dafbe534ca27022bce 100644 (file)
@@ -1,3 +1,12 @@
+2013-05-04  Eli Zaretskii  <eliz@gnu.org>
+
+       * windows-nat.c (windows_delete_thread): Accept an additional
+       argument, the thread's exit code, and announce thread death when
+       print_thread_events is non-zero and we are deleting a thread that
+       is not the main thread.
+       (get_windows_debug_event): Pass thread exit code to
+       windows_delete_thread.
+
 2013-05-03  Kevin Buettner  <kevinb@redhat.com>
 
        * v850-tdep.c (elf-bfd.h, elf/v850.h): Include.
index c44314b953f69d9adc7700da025971bb8829d8af..7eec2cfed61ef9d0be6bf36db36c3f635fcb7223 100644 (file)
@@ -386,7 +386,7 @@ windows_init_thread_list (void)
 
 /* Delete a thread from the list of threads.  */
 static void
-windows_delete_thread (ptid_t ptid)
+windows_delete_thread (ptid_t ptid, DWORD exit_code)
 {
   thread_info *th;
   DWORD id;
@@ -397,6 +397,9 @@ windows_delete_thread (ptid_t ptid)
 
   if (info_verbose)
     printf_unfiltered ("[Deleting %s]\n", target_pid_to_str (ptid));
+  else if (print_thread_events && id != main_thread_id)
+    printf_unfiltered (_("[%s exited with code %u]\n"),
+                      target_pid_to_str (ptid), (unsigned)exit_code);
   delete_thread (ptid);
 
   for (th = &thread_head;
@@ -1498,7 +1501,8 @@ get_windows_debug_event (struct target_ops *ops,
       if (current_event.dwThreadId != main_thread_id)
        {
          windows_delete_thread (ptid_build (current_event.dwProcessId, 0,
-                                          current_event.dwThreadId));
+                                            current_event.dwThreadId),
+                                current_event.u.ExitThread.dwExitCode);
          th = &dummy_thread_info;
        }
       break;
@@ -1515,7 +1519,8 @@ get_windows_debug_event (struct target_ops *ops,
       current_process_handle = current_event.u.CreateProcessInfo.hProcess;
       if (main_thread_id)
        windows_delete_thread (ptid_build (current_event.dwProcessId, 0,
-                                          main_thread_id));
+                                          main_thread_id),
+                              0);
       main_thread_id = current_event.dwThreadId;
       /* Add the main thread.  */
       th = windows_add_thread (ptid_build (current_event.dwProcessId, 0,