aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2016-05-17 17:07:20 -0400
committerSimon Marchi <simon.marchi@ericsson.com>2016-05-18 10:19:09 -0400
commitf0a8d0dc70eddbf1e323e8c07f5092ff5e327548 (patch)
treeee52efc831dea3732ec4b2ee6694ee6b4522321b
parent2ef476ed0a8e4778e56607173dab87a96cdbf0e7 (diff)
downloadbinutils-f0a8d0dc70eddbf1e323e8c07f5092ff5e327548.zip
binutils-f0a8d0dc70eddbf1e323e8c07f5092ff5e327548.tar.gz
binutils-f0a8d0dc70eddbf1e323e8c07f5092ff5e327548.tar.bz2
Fix double prompt output after run control MI commands with mi-async on (PR 20045)
When you use a run control command (-exec-run, -exec-continue, -exec-next, ...) with mi-async on, an extra (gdb) prompt is displayed: -exec-continue ^running *running,thread-id="all" (gdb) (gdb) It doesn't seem to be a big problem for front-ends, since this behavior started in gdb 7.9 and we haven't heard anything about that. However, it caused me some trouble while writing a test for PR 20039 [1]. The problem comes from an extra (gdb) prompt that we write when running in mi-async off mode to emulate a past buggy behavior. When executing a run control command synchronously, previous gdbs always printed a prompt right away, even though they are not ready to accept new MI commands until the target stops. Only at this time should they display a prompt. But to keep backwards compatibility apparently, we print it anyway. Since commit 198297aaf, the condition that decides whether we should print that "bogus" prompt or not has become true, even when running with mi-async on. Since we already print a prompt at the end of the asynchronous command execution, it results in two prompts for one command. The proposed fix is to call target_can_async_p instead of target_is_async_p, to make the condition: if (!target_can_async_p () || sync_execution) ... show prompt ... That shows the prompt if we are emulating a synchronous command on top of an asynchronous target (sync_execution) or if the target simply can't run asynchronously (!target_can_async_p ()). Note that this code is changed and this bug fixed by Pedro's separate console series, but I think it would be nice to have it fixed in the mean time. I ran the gdb.mi directory of the testsuite with mi-async on and off, I didn't see any regressions. gdb/ChangeLog: * mi/mi-main.c (mi_on_resume): Call target_can_async_p instead of target_is_async_p. [1] https://sourceware.org/ml/gdb-patches/2016-05/msg00075.html
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/mi/mi-interp.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 30c6e4b..3ee9cb4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2016-05-17 Simon Marchi <simon.marchi@ericsson.com>
+ PR gdb/20045
+ * mi/mi-main.c (mi_on_resume): Call target_can_async_p instead
+ of target_is_async_p.
+
+2016-05-17 Simon Marchi <simon.marchi@ericsson.com>
+
PR gdb/18077
* mi/mi-main.c (run_one_inferior): Use run target to determine
whether to run async or not.
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 8de0c34..3e8ac42 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -998,7 +998,7 @@ mi_on_resume (ptid_t ptid)
for MI3, and may be removed even earlier. SYNC_EXECUTION is
checked here because we only need to emit a prompt if a
synchronous command was issued when the target is async. */
- if (!target_is_async_p () || sync_execution)
+ if (!target_can_async_p () || sync_execution)
fputs_unfiltered ("(gdb) \n", raw_stdout);
}
gdb_flush (raw_stdout);