2019-04-30 Joel Brobecker <brobecker@adacore.com>
+ * windows-nat.c (main_thread_id): Delete.
+ (handle_output_debug_string): Replace main_thread_id by
+ current_event.dwThreadId.
+ (fake_create_process): Likewise.
+ (get_windows_debug_event) <CREATE_PROCESS_DEBUG_EVENT>:
+ Do not set main_thread_id.
+ <LOAD_DLL_DEBUG_EVENT>: Replace main_thread_id by
+ current_event.dwThreadId.
+ <UNLOAD_DLL_DEBUG_EVENT>: Likewise.
+
+2019-04-30 Joel Brobecker <brobecker@adacore.com>
+
* windows-nat.c (get_windows_debug_event) <EXIT_PROCESS_DEBUG_EVENT>:
Use current_event.dwThreadId instead of main_thread_id.
WaitForDebugEvent */
static HANDLE current_process_handle; /* Currently executing process */
static windows_thread_info *current_thread; /* Info on currently selected thread */
-static DWORD main_thread_id; /* Thread ID of the main thread */
/* Counts of things. */
static int exception_count = 0;
ourstatus->kind = TARGET_WAITKIND_STOPPED;
retval = strtoul (p, &p, 0);
if (!retval)
- retval = main_thread_id;
+ retval = current_event.dwThreadId;
else if ((x = (LPCVOID) (uintptr_t) strtoull (p, NULL, 0))
&& ReadProcessMemory (current_process_handle, x,
&saved_context,
(unsigned) GetLastError ());
/* We can not debug anything in that case. */
}
- main_thread_id = current_event.dwThreadId;
current_thread
= windows_add_thread (ptid_t (current_event.dwProcessId, 0,
current_event.dwThreadId),
current_event.u.CreateThread.hThread,
current_event.u.CreateThread.lpThreadLocalBase,
true /* main_thread_p */);
- return main_thread_id;
+ return current_event.dwThreadId;
}
void
break;
current_process_handle = current_event.u.CreateProcessInfo.hProcess;
- main_thread_id = current_event.dwThreadId;
/* Add the main thread. */
th = windows_add_thread
(ptid_t (current_event.dwProcessId, 0,
catch_errors (handle_load_dll);
ourstatus->kind = TARGET_WAITKIND_LOADED;
ourstatus->value.integer = 0;
- thread_id = main_thread_id;
+ thread_id = current_event.dwThreadId;
break;
case UNLOAD_DLL_DEBUG_EVENT:
catch_errors (handle_unload_dll);
ourstatus->kind = TARGET_WAITKIND_LOADED;
ourstatus->value.integer = 0;
- thread_id = main_thread_id;
+ thread_id = current_event.dwThreadId;
break;
case EXCEPTION_DEBUG_EVENT: