From e0ea48a0d7d1f20f2e40252119e0b8536785c28b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 4 May 2013 13:36:18 +0000 Subject: [PATCH] Announce thread death on MS-Windows. * 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 | 9 +++++++++ gdb/windows-nat.c | 11 ++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ceaf838b942..44d028e72d7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2013-05-04 Eli Zaretskii + + * 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 * v850-tdep.c (elf-bfd.h, elf/v850.h): Include. diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index c44314b953f..7eec2cfed61 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -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, -- 2.30.2