NEWS and manual changes for command options changes
[deliverable/binutils-gdb.git] / gdb / windows-nat.c
index c8acadd398d3581f83e8d47e0a8aa01e3b7320bb..ae4e3d55b308149b17e9606b0c6b9621498fbdf3 100644 (file)
@@ -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;
@@ -778,7 +777,6 @@ windows_make_so (const char *name, LPVOID load_addr)
   if (p >= so->so_name && strcasecmp (p, "/cygwin1.dll") == 0)
     {
       asection *text = NULL;
-      CORE_ADDR text_vma;
 
       gdb_bfd_ref_ptr abfd (gdb_bfd_open (so->so_name, "pei-i386", -1));
 
@@ -944,15 +942,14 @@ handle_unload_dll ()
 static void
 catch_errors (void (*func) ())
 {
-  TRY
+  try
     {
       func ();
     }
-  CATCH (ex, RETURN_MASK_ALL)
+  catch (const gdb_exception &ex)
     {
       exception_print (gdb_stderr, ex);
     }
-  END_CATCH
 }
 
 /* Clear list of loaded DLLs.  */
@@ -1032,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,
@@ -1097,14 +1094,16 @@ display_selector (HANDLE thread, DWORD sel)
          puts_filtered ("Code (Exec/Read, Conf");
          break;
        default:
-         printf_filtered ("Unknown type 0x%lx",info.HighWord.Bits.Type);
+         printf_filtered ("Unknown type 0x%lx",
+                          (unsigned long) info.HighWord.Bits.Type);
        }
       if ((info.HighWord.Bits.Type & 0x1) == 0)
        puts_filtered(", N.Acc");
       puts_filtered (")\n");
       if ((info.HighWord.Bits.Type & 0x10) == 0)
        puts_filtered("System selector ");
-      printf_filtered ("Priviledge level = %ld. ", info.HighWord.Bits.Dpl);
+      printf_filtered ("Priviledge level = %ld. ",
+                      (unsigned long) info.HighWord.Bits.Dpl);
       if (info.HighWord.Bits.Granularity)
        puts_filtered ("Page granular.\n");
       else
@@ -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.02696 seconds and 4 git commands to generate.