This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Check input interrupt first when reading packet


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5a0dd67a459338efb77f8d82bb3650d801ff0dd5

commit 5a0dd67a459338efb77f8d82bb3650d801ff0dd5
Author: Yao Qi <yao.qi@linaro.org>
Date:   Fri Jan 8 11:06:00 2016 +0000

    Check input interrupt first when reading packet
    
    Hi,
    I see timeout in one of several runs of random-signal.exp like this,
    
     $ (set -e; while true; do make check RUNTESTFLAGS="--target_board=native-gdbserver random-signal.exp"; done)
    
    In about every five runs, we can see a fail,
    
    PASS: gdb.base/random-signal.exp: continue
    ^CFAIL: gdb.base/random-signal.exp: stop with control-c (timeout)
    
    after some investigation, I find '\003' may be discarded by GDBserver when
    it is expecting '$'.  In GDB side, both normal packets and '\003' are sent
    via function send, but GDBserver may receive them at any time, that is to
    say, in the receive buffer in GDBserver, '\003' may appear before or after
    normal packet.  However, current GDBserver doesn't handle this case.
    
    With this patch applied, I don't see this fail in multiple runs.
    Although there is still timeout fail, that is a different problem, the
    next patch will fix it.
    
    gdb/gdbserver:
    
    2016-01-08  Yao Qi  <yao.qi@linaro.org>
    
    	* remote-utils.c (getpkt): If c is '\003', call target hook
    	request_interrupt.

Diff:
---
 gdb/gdbserver/ChangeLog      | 5 +++++
 gdb/gdbserver/remote-utils.c | 9 +++++++++
 2 files changed, 14 insertions(+)

diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 0c9e73e..1c73f8b 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2016-01-08  Yao Qi  <yao.qi@linaro.org>
+
+	* remote-utils.c (getpkt): If c is '\003', call target hook
+	request_interrupt.
+
 2016-01-06  Yao Qi  <yao.qi@linaro.org>
 
 	* linux-aarch32-low.h (arm_abi_breakpoint): Move to
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 5f43820..c5f4647 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -959,6 +959,15 @@ getpkt (char *buf)
       while (1)
 	{
 	  c = readchar ();
+
+	  /* The '\003' may appear before or after each packet, so
+	     check for an input interrupt.  */
+	  if (c == '\003')
+	    {
+	      (*the_target->request_interrupt) ();
+	      continue;
+	    }
+
 	  if (c == '$')
 	    break;
 	  if (remote_debug)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]