From: Yao Qi Date: Fri, 24 Jul 2015 13:40:34 +0000 (+0100) Subject: Refactor start_inferior X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eb97750bce2bf37176f745636815600177fbdba8;p=binutils-gdb.git Refactor start_inferior This patch is to refactor function start_inferior that signal_pid is return in one place. gdb/gdbserver: 2015-07-24 Yao Qi * server.c (start_inferior): Code refactor. --- diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 72277c12894..6fbd6640796 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2015-07-24 Yao Qi + + * server.c (start_inferior): Code refactor. + 2015-07-24 Yao Qi * server.c (process_serial_event): Set general_thread. diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index fd5f6dc7458..36e8987d831 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -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; }