This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Remove duplicated writes to current_inferior
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Mon, 11 Jun 2012 15:36:45 +0800
- Subject: [PATCH] Remove duplicated writes to current_inferior
Hi, this patch is to remove two statements [1] in the following snip
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;
current_inferior->last_resume_kind = resume_stop; <-- [2]
current_inferior->last_status = last_status;
}
while (last_status.value.sig != GDB_SIGNAL_TRAP);
current_inferior->last_resume_kind = resume_stop; <--- [1]
current_inferior->last_status = last_status;
As we can see, if [1] are executed, [2] must have been executed, so these
two statements in [1] can be removed safely.
b.t.w, both [1] and [2] were introduced by this patch,
[gdbserver 2/N] move a bit of code from the linux backend to common code
http://sourceware.org/ml/gdb-patches/2010-08/msg00433.html
It is obvious, and I'll commit it in two days.
gdb/gdbserver:
2012-06-11 Yao Qi <yao@codesourcery.com>
* server.c (start_inferior): Remove duplicated writes to fields
'last_resume_kind' and 'last_status' of 'current_inferior'.
---
gdb/gdbserver/server.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 9fd550b..fe74e2a 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -322,8 +322,6 @@ start_inferior (char **argv)
}
while (last_status.value.sig != GDB_SIGNAL_TRAP);
- current_inferior->last_resume_kind = resume_stop;
- current_inferior->last_status = last_status;
return signal_pid;
}
--
1.7.0.4