aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2015-07-24 14:40:34 +0100
committerYao Qi <yao.qi@linaro.org>2015-07-24 14:40:34 +0100
commiteb97750bce2bf37176f745636815600177fbdba8 (patch)
tree72d1546753d7bf99bccc7538c0d6dfefcd4a6dd8 /gdb
parent11e6c98f1b6318d27ad55f9ac7d362fe7a668872 (diff)
downloadgdb-eb97750bce2bf37176f745636815600177fbdba8.zip
gdb-eb97750bce2bf37176f745636815600177fbdba8.tar.gz
gdb-eb97750bce2bf37176f745636815600177fbdba8.tar.bz2
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 <yao.qi@linaro.org> * server.c (start_inferior): Code refactor.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/gdbserver/ChangeLog4
-rw-r--r--gdb/gdbserver/server.c23
2 files changed, 15 insertions, 12 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 72277c1..6fbd664 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,9 @@
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.
2015-07-21 Yao Qi <yao.qi@linaro.org>
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index fd5f6dc..36e8987 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;
}