Refactor start_inferior
authorYao Qi <yao.qi@linaro.org>
Fri, 24 Jul 2015 13:40:34 +0000 (14:40 +0100)
committerYao Qi <yao.qi@linaro.org>
Fri, 24 Jul 2015 13:40:34 +0000 (14:40 +0100)
This patch is to refactor function start_inferior that signal_pid
is return in one place.

gdb/gdbserver:

2015-07-24  Yao Qi  <yao.qi@linaro.org>

* server.c (start_inferior): Code refactor.

gdb/gdbserver/ChangeLog
gdb/gdbserver/server.c

index 72277c1289419027b588e33ba8b6176cdb516c85..6fbd6640796f05bb401e228744e0536956c97f18 100644 (file)
@@ -1,3 +1,7 @@
+2015-07-24  Yao Qi  <yao.qi@linaro.org>
+
+       * server.c (start_inferior): Code refactor.
+
 2015-07-24  Yao Qi  <yao.qi@linaro.org>
 
        * server.c (process_serial_event): Set general_thread.
index fd5f6dc7458750b55fd19c13dc00470b1741290c..36e8987d8312baa48cc1dd1166c972ed960d380a 100644 (file)
@@ -257,22 +257,21 @@ start_inferior (char **argv)
 
       last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
 
-      if (last_status.kind != TARGET_WAITKIND_STOPPED)
-       return signal_pid;
-
-      do
+      if (last_status.kind == TARGET_WAITKIND_STOPPED)
        {
-         (*the_target->resume) (&resume_info, 1);
+         do
+           {
+             (*the_target->resume) (&resume_info, 1);
 
-         last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
-         if (last_status.kind != TARGET_WAITKIND_STOPPED)
-           return signal_pid;
+             last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
+             if (last_status.kind != TARGET_WAITKIND_STOPPED)
+               break;
 
-         current_thread->last_resume_kind = resume_stop;
-         current_thread->last_status = last_status;
+             current_thread->last_resume_kind = resume_stop;
+             current_thread->last_status = last_status;
+           }
+         while (last_status.value.sig != GDB_SIGNAL_TRAP);
        }
-      while (last_status.value.sig != GDB_SIGNAL_TRAP);
-
       return signal_pid;
     }
 
This page took 0.033016 seconds and 4 git commands to generate.