Phase 1 of the ptid_t changes.
[deliverable/binutils-gdb.git] / gdb / wince.c
index 83112d9db0808abce49ca6f308f681289c8012a3..d931ddc23354eb82bd375b908c09211d3995280d 100644 (file)
@@ -129,7 +129,7 @@ static int remote_add_host = 0;
 /* Forward declaration */
 extern struct target_ops child_ops;
 
-static int win32_child_thread_alive (int);
+static int win32_child_thread_alive (ptid_t);
 void child_kill_inferior (void);
 
 static int last_sig = 0;       /* Set if a signal was received from the
@@ -1131,7 +1131,7 @@ do_child_fetch_inferior_registers (int r)
 static void
 child_fetch_inferior_registers (int r)
 {
-  current_thread = thread_rec (inferior_pid, TRUE);
+  current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
   do_child_fetch_inferior_registers (r);
 }
 
@@ -1151,7 +1151,7 @@ do_child_store_inferior_registers (int r)
 static void
 child_store_inferior_registers (int r)
 {
-  current_thread = thread_rec (inferior_pid, TRUE);
+  current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
   do_child_store_inferior_registers (r);
 }
 
@@ -1412,9 +1412,10 @@ get_child_debug_event (int pid, struct target_waitstatus *ourstatus,
                     "CREATE_PROCESS_DEBUG_EVENT"));
       current_process_handle = current_event.u.CreateProcessInfo.hProcess;
 
-      main_thread_id = inferior_pid = current_event.dwThreadId;
+      main_thread_id = current_event.dwThreadId;
+      inferior_ptid = pid_to_ptid (main_thread_id);
       /* Add the main thread */
-      th = child_add_thread (inferior_pid,
+      th = child_add_thread (PIDGET (inferior_ptid),
                             current_event.u.CreateProcessInfo.hThread);
       break;
 
@@ -1486,11 +1487,12 @@ out:
 }
 
 /* Wait for interesting events to occur in the target process. */
-static int
-child_wait (int pid, struct target_waitstatus *ourstatus)
+static ptid_t
+child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
 {
   DWORD event_code;
   int retval;
+  int pid = PIDGET (ptid);
 
   /* We loop when we get a non-standard exception rather than return
      with a SPURIOUS because resume can try and step or modify things,
@@ -1500,7 +1502,7 @@ child_wait (int pid, struct target_waitstatus *ourstatus)
 
   while (1)
     if (get_child_debug_event (pid, ourstatus, EXCEPTION_DEBUG_EVENT, &retval))
-      return retval;
+      return pid_to_ptid (retval);
     else
       {
        int detach = 0;
@@ -1519,7 +1521,7 @@ static void
 child_files_info (struct target_ops *ignore)
 {
   printf_unfiltered ("\tUsing the running image of child %s.\n",
-                    target_pid_to_str (inferior_pid));
+                    target_pid_to_str (inferior_ptid));
 }
 
 /* ARGSUSED */
@@ -1711,7 +1713,7 @@ wince_initialize (void)
   close (s0);
 }
 
-/* Start an inferior win32 child process and sets inferior_pid to its pid.
+/* Start an inferior win32 child process and sets inferior_ptid to its pid.
    EXEC_FILE is the file to run.
    ALLARGS is a string containing the arguments to the program.
    ENV is the environment vector to pass.  Errors reported with error().  */
@@ -1759,7 +1761,8 @@ child_create_inferior (char *exec_file, char *args, char **env)
   current_process_handle = pi.hProcess;
   current_event.dwProcessId = pi.dwProcessId;
   memset (&current_event, 0, sizeof (current_event));
-  inferior_pid = current_event.dwThreadId = pi.dwThreadId;
+  current_event.dwThreadId = pi.dwThreadId;
+  inferior_ptid = pid_to_ptid (current_event.dwThreadId);
   push_target (&child_ops);
   child_init_thread_list ();
   child_add_thread (pi.dwThreadId, pi.hThread);
@@ -1769,7 +1772,7 @@ child_create_inferior (char *exec_file, char *args, char **env)
   target_terminal_inferior ();
 
   /* Run until process and threads are loaded */
-  while (!get_child_debug_event (inferior_pid, &dummy,
+  while (!get_child_debug_event (PIDGET (inferior_ptid), &dummy,
                                 CREATE_PROCESS_DEBUG_EVENT, &ret))
     continue;
 
@@ -1828,11 +1831,12 @@ child_kill_inferior (void)
 
 /* Resume the child after an exception. */
 void
-child_resume (int pid, int step, enum target_signal sig)
+child_resume (ptid_t ptid, int step, enum target_signal sig)
 {
   thread_info *th;
   DWORD continue_status = last_sig > 0 && last_sig < NSIG ?
   DBG_EXCEPTION_NOT_HANDLED : DBG_CONTINUE;
+  int pid = PIDGET (ptid);
 
   DEBUG_EXEC (("gdb: child_resume (pid=%d, step=%d, sig=%d);\n",
               pid, step, sig));
@@ -1870,7 +1874,8 @@ child_can_run (void)
 static void
 child_close (void)
 {
-  DEBUG_EVENTS (("gdb: child_close, inferior_pid=%d\n", inferior_pid));
+  DEBUG_EVENTS (("gdb: child_close, inferior_ptid=%d\n",
+                PIDGET (inferior_ptid)));
 }
 
 /* Explicitly upload file to remotedir */
@@ -2023,8 +2028,9 @@ debugging over a network.", &setlist),
    by "polling" it.  If WaitForSingleObject returns WAIT_OBJECT_0
    it means that the pid has died.  Otherwise it is assumed to be alive. */
 static int
-win32_child_thread_alive (int pid)
+win32_child_thread_alive (ptid_t ptid)
 {
+  int pid = PIDGET (ptid);
   return thread_alive (thread_rec (pid, FALSE)->h);
 }
 
This page took 0.028156 seconds and 4 git commands to generate.