aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/thread.c10
-rw-r--r--gdb/windows-nat.c21
3 files changed, 27 insertions, 17 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 12305ef..09485a0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,16 @@
+2019-01-05 Joel Brobecker <brobecker@adacore.com>
+
+ * thread.c (delete_thread_1): Add gdb_assert that THR is not
+ NULL. Initialize tpprev to NULL instead of assigning it
+ to NULL on the next statement.
+ * windows-nat.c (windows_delete_thread): Remove check for
+ main_thread_id before printing thread exit notifications.
+ (get_windows_debug_event) <EXIT_THREAD_DEBUG_EVENT>:
+ Remove thread ID check against main_thread_id.
+ <CREATE_PROCESS_DEBUG_EVENT>: Remove call to
+ windows_delete_thread.
+ <EXIT_PROCESS_DEBUG_EVENT>: Add call to windows_delete_thread.
+
2019-01-04 Tom Tromey <tom@tromey.com>
* compile/compile.c (_initialize_compile): Use upper case for
diff --git a/gdb/thread.c b/gdb/thread.c
index e026d7d..a9105f5 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -442,15 +442,17 @@ thread_step_over_chain_remove (struct thread_info *tp)
step_over_chain_remove (&step_over_queue_head, tp);
}
-/* Delete thread TP. If SILENT, don't notify the observer of this
- exit. */
+/* Delete the thread referenced by THR. If SILENT, don't notifyi
+ the observer of this exit.
+
+ THR must not be NULL or a failed assertion will be raised. */
static void
delete_thread_1 (thread_info *thr, bool silent)
{
- struct thread_info *tp, *tpprev;
+ gdb_assert (thr != nullptr);
- tpprev = NULL;
+ struct thread_info *tp, *tpprev = NULL;
for (tp = thr->inf->thread_list; tp; tpprev = tp, tp = tp->next)
if (tp == thr)
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 086bdb4..57a59b8 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -496,7 +496,7 @@ windows_delete_thread (ptid_t ptid, DWORD exit_code)
if (info_verbose)
printf_unfiltered ("[Deleting %s]\n", target_pid_to_str (ptid));
- else if (print_thread_events && id != main_thread_id)
+ else if (print_thread_events)
printf_unfiltered (_("[%s exited with code %u]\n"),
target_pid_to_str (ptid), (unsigned) exit_code);
delete_thread (find_thread_ptid (ptid));
@@ -1560,14 +1560,10 @@ get_windows_debug_event (struct target_ops *ops,
(unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId,
"EXIT_THREAD_DEBUG_EVENT"));
-
- if (current_event.dwThreadId != main_thread_id)
- {
- windows_delete_thread (ptid_t (current_event.dwProcessId, 0,
- current_event.dwThreadId),
- current_event.u.ExitThread.dwExitCode);
- th = &dummy_thread_info;
- }
+ windows_delete_thread (ptid_t (current_event.dwProcessId, 0,
+ current_event.dwThreadId),
+ current_event.u.ExitThread.dwExitCode);
+ th = &dummy_thread_info;
break;
case CREATE_PROCESS_DEBUG_EVENT:
@@ -1580,10 +1576,6 @@ get_windows_debug_event (struct target_ops *ops,
break;
current_process_handle = current_event.u.CreateProcessInfo.hProcess;
- if (main_thread_id)
- windows_delete_thread (ptid_t (current_event.dwProcessId, 0,
- main_thread_id),
- 0);
main_thread_id = current_event.dwThreadId;
/* Add the main thread. */
th = windows_add_thread (ptid_t (current_event.dwProcessId, 0,
@@ -1607,6 +1599,9 @@ get_windows_debug_event (struct target_ops *ops,
}
else if (saw_create == 1)
{
+ windows_delete_thread (ptid_t (current_event.dwProcessId, 0,
+ main_thread_id),
+ 0);
ourstatus->kind = TARGET_WAITKIND_EXITED;
ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode;
thread_id = main_thread_id;