This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Refactor start_inferior
- From: Yao Qi <qiyao at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 24 Jul 2015 13:43:45 -0000
- Subject: [binutils-gdb] Refactor start_inferior
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=eb97750bce2bf37176f745636815600177fbdba8
commit eb97750bce2bf37176f745636815600177fbdba8
Author: Yao Qi <yao.qi@linaro.org>
Date: Fri Jul 24 14:40:34 2015 +0100
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.
Diff:
---
gdb/gdbserver/ChangeLog | 4 ++++
gdb/gdbserver/server.c | 23 +++++++++++------------
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;
}