Rename common to gdbsupport
[deliverable/binutils-gdb.git] / gdb / windows-nat.c
index 50094187bd111f90f285a3431a755a0a9353fcb7..3431181a88cb630fc19dd8b68e9dfc37bb636a74 100644 (file)
@@ -67,8 +67,8 @@
 #include "x86-nat.h"
 #include "complaints.h"
 #include "inf-child.h"
-#include "common/gdb_tilde_expand.h"
-#include "common/pathstuff.h"
+#include "gdbsupport/gdb_tilde_expand.h"
+#include "gdbsupport/pathstuff.h"
 
 #define AdjustTokenPrivileges          dyn_AdjustTokenPrivileges
 #define DebugActiveProcessStop         dyn_DebugActiveProcessStop
@@ -237,7 +237,6 @@ static DEBUG_EVENT current_event;   /* The current debug event from
                                           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;
@@ -1030,7 +1029,7 @@ handle_output_debug_string (struct target_waitstatus *ourstatus)
          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,
@@ -1406,14 +1405,13 @@ fake_create_process (void)
        (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
@@ -1611,7 +1609,6 @@ get_windows_debug_event (struct target_ops *ops,
        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,
@@ -1637,11 +1634,11 @@ 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),
+                                        current_event.dwThreadId),
                                 0, true /* main_thread_p */);
          ourstatus->kind = TARGET_WAITKIND_EXITED;
          ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode;
-         thread_id = main_thread_id;
+         thread_id = current_event.dwThreadId;
        }
       break;
 
@@ -1656,7 +1653,7 @@ get_windows_debug_event (struct target_ops *ops,
       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:
@@ -1669,7 +1666,7 @@ get_windows_debug_event (struct target_ops *ops,
       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:
This page took 0.027996 seconds and 4 git commands to generate.