This is the mail archive of the gdb-patches@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]

[PATCH] PR 17147: Help user cope with running target


Hi.

PR 17147 is about the user now being able to do, e.g.,
"c &" without having to explicitly enable it, and then,
tripping over some remaining issues.
In all-stop mode with gdbserver no further commands can be
done before the target stops, even "kill" and "quit" are
unusable.

bash1$ gdbserver --once :1234 forever-threads.x64
bash2$ gdb forever-threads.x64
(gdb) tar rem :1234
(gdb) b all_threads_running
(gdb) c
[breakpoint hit]
(gdb) c &
(gdb) q
A debugging session is active.

        Inferior 1 [process 29047] will be killed.

Quit anyway? (y or n) y
Cannot execute this command while the target is running.
(gdb) k
Kill the program being debugged? (y or n) y
Cannot execute this command while the target is running.
(gdb) 

[the forever-threads testcase is filed with the pr]

While this isn't a regression per se, the fact that async
is now enabled by default might make the user wonder
why one still has to "interrupt" the target first before
doing anything else ("Why doesn't this work better?").
This patch addresses the issue by giving the user instructions
on what to do.

I think there is still a bug here, one shouldn't have
to first stop the target before one can exit gdb,
but I think this is sufficient for 7.8.

2014-07-17  Doug Evans  <dje@google.com>

	PR server/17147
	* remote.c (putpkt_binary): Add text to error message.

diff --git a/gdb/remote.c b/gdb/remote.c
index 76efefa..29c03bc 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -7149,7 +7149,11 @@ putpkt_binary (char *buf, int cnt)
      running.  This is not a problem in non-stop mode, because in that
      case, the stub is always ready to process serial input.  */
   if (!non_stop && target_can_async_p () && rs->waiting_for_stop_reply)
-    error (_("Cannot execute this command while the target is running."));
+    {
+      error (_("Cannot execute this command while the target is running.\n"
+	       "Use the \"interrupt\" command to stop the target\n"
+	       "and then try again."));
+    }
 
   /* We're sending out a new packet.  Make sure we don't look at a
      stale cached response.  */


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