binutils-gdb/gdb/mi
Simon Marchi 28addb40c7 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
2016-05-18 10:12:54 -04:00
..
ChangeLog-1999-2003
mi-cmd-break.c Enable/update legacy linespecs in MI. 2016-02-09 14:31:04 -08:00
mi-cmd-break.h GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-cmd-catch.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-cmd-disas.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-cmd-env.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-cmd-file.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-cmd-info.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-cmd-stack.c remove trivialy unused variables 2016-05-07 20:12:53 -04:00
mi-cmd-target.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-cmd-var.c varobj: Cleanup dead code 2016-02-07 09:45:02 -05:00
mi-cmds.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-cmds.h GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-common.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-common.h GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-console.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-console.h GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-getopt.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-getopt.h GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-interp.c Fix double prompt output after run control MI commands with mi-async on (PR 20045) 2016-05-18 10:12:54 -04:00
mi-main.c Fix -exec-run not running asynchronously with mi-async on (PR gdb/18077) 2016-05-17 16:46:18 -04:00
mi-main.h GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-out.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-out.h GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-parse.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-parse.h GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00
mi-symbol-cmds.c GDB copyright headers update after running GDB's copyright.py script. 2016-01-01 08:43:22 +04:00