From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20017 invoked by alias); 24 Jul 2013 20:59:41 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 19969 invoked by uid 306); 24 Jul 2013 20:59:41 -0000 Date: Wed, 24 Jul 2013 20:59:00 -0000 Message-ID: <20130724205941.19918.qmail@sourceware.org> From: tromey@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] tromey/always-async: more hacks to make it work X-Git-Refname: refs/heads/tromey/always-async X-Git-Reftype: branch X-Git-Oldrev: 0bd5e1d72af96246377132d0b66cd3042f961a5e X-Git-Newrev: 5f6c234ae1c5b12923dc0a4028284a864c5bd307 X-SW-Source: 2013-q3/txt/msg00009.txt.bz2 List-Id: The branch, tromey/always-async has been updated discards 0bd5e1d72af96246377132d0b66cd3042f961a5e (commit) discards 92787aabc88ee6f7f2082a2bb233b6a4dcb70675 (commit) discards 858309f807277eac6af7e2b5f47f588a755596d9 (commit) discards 5a7aee45e21886338cc6043fc1e57cad4c6a1fa4 (commit) discards 4f15ec118a2a3bbec5f01e0218c4eaed7f4a9db2 (commit) discards 43c20a4ea94ab2beb1d6f9c4a7bb9d35daa36dc8 (commit) discards 01ab8a038a226a2a7432150bc1c5a03fe3a95355 (commit) discards bdd70eefffd25bef83333a9a34cd9ccaa51691e0 (commit) discards e47c6a37f173c4c5f657f6cee4df32a64626fa07 (commit) discards a5becb7a7f9ff95ebb777c753880c70b3c14f52e (commit) via 5f6c234ae1c5b12923dc0a4028284a864c5bd307 (commit) via 61d5819038600bf117a00aa9de01ee5b40d0a888 (commit) via f76323f207f8582907a1dd8cd16abaafa9c28450 (commit) via b0704f7dce201dc07eb17c5577c15544f3591b73 (commit) via 173433defb21f2d5e3649c888bf33895007517b5 (commit) via 4ac436c1c099e4d02cdb950a207146d9ef9c349f (commit) via 79ac36c37d082568d3aa2c13ba41bf4895178937 (commit) via e2f61a606a77d561af560e073cf0c5278320952c (commit) via 322b7eed1d4716c5f747142ca694e3439861aa7c (commit) via 03baae232bc37f2acd787f3e01f3d30949b3d4ae (commit) via 5253f7732eaf4157dc464d8c76a9a26a2c3334a1 (commit) via 31fd10e11165df02a399b8e263215e479c46dae8 (commit) from 0bd5e1d72af96246377132d0b66cd3042f961a5e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 5f6c234ae1c5b12923dc0a4028284a864c5bd307 Author: Tom Tromey Date: Wed Jul 24 14:49:36 2013 -0600 more hacks to make it work commit 61d5819038600bf117a00aa9de01ee5b40d0a888 Author: Tom Tromey Date: Wed Jul 24 10:29:21 2013 -0600 Revert "use mi_target_*_p" This reverts commit 5df3ec6ff5623fad88192562b45fab2e5d4dce11. commit f76323f207f8582907a1dd8cd16abaafa9c28450 Author: Tom Tromey Date: Wed Jul 24 09:35:54 2013 -0600 use mi_target_*_p commit b0704f7dce201dc07eb17c5577c15544f3591b73 Author: Tom Tromey Date: Fri Jul 12 08:21:03 2013 -0600 rework target-async docs commit 173433defb21f2d5e3649c888bf33895007517b5 Author: Tom Tromey Date: Tue Jul 9 12:23:08 2013 -0600 add README.archer commit 4ac436c1c099e4d02cdb950a207146d9ef9c349f Author: Tom Tromey Date: Tue Jul 9 12:21:55 2013 -0600 enable target-async This enables target-async by default. Since MI chose to treat target-async specially, we can't get rid of the option. Instead we have to make it MI-only. This still has a regression in mi-async.exp. The problem seems to be exactly when the MI prompt is emitted. This still needs a doc update commit 79ac36c37d082568d3aa2c13ba41bf4895178937 Author: Tom Tromey Date: Wed Jul 3 10:11:58 2013 -0600 enable target-async by default for CLI commit e2f61a606a77d561af560e073cf0c5278320952c Author: Tom Tromey Date: Mon Jul 8 10:23:33 2013 -0600 fix py-finish-breakpoint.exp with always-async With target async enabled, py-finish-breakpoint.exp will trigger an assertion failure. The failure occurs because execute_command re-enters the event loop in some circumstances, and in this case resets the sync_execution flag. Then later gdb reaches this assertion in normal_stop: gdb_assert (sync_execution || !target_can_async_p ()); execute_command has a comment explaining why it dispatches events: /* If the interpreter is in sync mode (we're running a user command's list, running command hooks or similars), and we just ran a synchronous command that started the target, wait for that command to end. */ However, the code did not follow this comment -- it didn't check to see if the command started the target. This patch fixes the problem by noting whether the target was executing in sync_execution mode before running the command, and then augmenting the condition to test this as well. Built and regtested on x86-64 Fedora 18. * top.c (execute_command): Only dispatch events if command started target. commit 322b7eed1d4716c5f747142ca694e3439861aa7c Author: Tom Tromey Date: Mon Jul 8 09:41:57 2013 -0600 make dprintf.exp pass in always-async mode When target-async is enabled, dprintf.exp fails. This happens because run_inferior_call causes gdb to forget that it is running in sync_execution mode, so something like a breakpoint condition that makes an inferior call causes gdb to enter fully async mode. This patch fixes the problem by noticing when gdb was in sync_execution mode in run_inferior_call, and taking care to restore this state afterward. Built and regtested on x86-64 Fedora 18. PR cli/15718: * infcall.c: Include event-top.h. (run_inferior_call): Call async_disable_stdin if needed. commit 03baae232bc37f2acd787f3e01f3d30949b3d4ae Author: Pedro Alves Date: Wed May 9 14:07:04 2012 +0100 PR gdb/13860: don't lose '-interpreter-exec console EXECUTION_COMMAND''s output in async mode. The other part of PR gdb/13860 is about console execution commands in MI getting their output half lost. E.g., take the finish command, executed on a frontend's GDB console: sync: finish &"finish\n" ~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n" ^running *running,thread-id="1" (gdb) ~"0x00000000004004d7 in foo () at stepinf.c:6\n" ~"6\t usleep (10);\n" ~"Value returned is $1 = 0\n" *stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},thread-id="1",stopped-threads="all",core="1" async: finish &"finish\n" ~"Run till exit from #0 usleep (useconds=10) at ../sysdeps/unix/sysv/linux/usleep.c:27\n" ^running *running,thread-id="1" (gdb) *stopped,reason="function-finished",frame={addr="0x00000000004004d7",func="foo",args=[],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="6"},gdb-result-var="$1",return-value="0",thread-id="1",stopped-threads="all",core="0" Note how all the "Value returned" etc. output is missing in async mode. The same happens with e.g., catchpoints: =breakpoint-modified,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",what="22016",times="1"} ~"\nCatchpoint " ~"1 (forked process 22016), 0x0000003791cbd8a6 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131\n" ~"131\t pid = ARCH_FORK ();\n" *stopped,reason="fork",disp="keep",bkptno="1",newpid="22016",frame={addr="0x0000003791cbd8a6",func="__libc_fork",args=[],file="../nptl/sysdeps/unix/sysv/linux/fork.c",fullname="/usr/src/debug/glibc-2.14-394-g8f3b1ff/nptl/sysdeps/unix/sysv/linux/fork.c",line="131"},thread-id="1",stopped-threads="all",core="0" where all those ~ lines are missing in async mode, or just the "step" current line indication: s &"s\n" ^running *running,thread-id="all" (gdb) ~"13\t foo ();\n" *stopped,frame={addr="0x00000000004004ef",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffdd78"}],file="stepinf.c",fullname="/home/pedro/gdb/tests/stepinf.c",line="13"},thread-id="1",stopped-threads="all",core="3" (gdb) Or in the case of the PRs example, the "Stopped due to shared library event" note: start &"start\n" ~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n" =breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"} ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n" =thread-group-started,id="i1",pid="21990" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" (gdb) =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1" ~"Stopped due to shared library event (no libraries added or removed)\n" *stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="3" (gdb) IMO, if you're typing execution commands in a frontend's console, you expect to see their output. Indeed it's what you get in sync mode. I think async mode should do the same. That's what this patch does. Notes: - mi->out is the same as gdb_stdout when MI is the current interpreter. I think that referring to that directly is cleaner. An earlier revision of this patch made the changes that are now done in mi_on_normal_stop directly in infrun.c:normal_stop, and so not having an obvious place to put the new uiout by then, and not wanting to abuse CLI's uiout, I made a temporary uiout when necessary. - Hopefuly the rest of the patch is more or less obvious given the comments I added. Tested on x86_64 Fedora 16, no regressions. 2012-05-09 Pedro Alves PR gdb/13860 * gdbthread.h (struct thread_control_state): New field `command_interp'. * infrun.c (follow_fork): Copy the new thread control field to the child fork thread. (clear_proceed_status_thread): Clear the new thread control field. (proceed): Set the new thread control field. * interps.h (command_interp): Declare. * interps.c (command_interpreter): New global. (command_interp): New function. (interp_exec): Set `command_interpreter' while here. * cli-out.c (cli_uiout_dtor): New function. (cli_ui_out_impl): Install it. * mi/mi-interp.c: Include cli-out.h. (mi_cmd_interpreter_exec): Add comment. (restore_current_uiout_cleanup): New function. (ui_out_free_cleanup): New function. (mi_on_normal_stop): In async mode, if finishing an execution command started by a CLI command, or any kind of breakpoint-like event triggered, print the stop event to the output (CLI) stream. * mi/mi-out.c (mi_ui_out_impl): Install NULL `dtor' handler. gdb/testsuite/ * gdb.mi/mi-cli.exp: Also expect the new source line to be output after a "next", in async mode. Make it a pass/fail test. * gdb.mi/mi-solib.exp: Test that the CLI solib event note is output. commit 5253f7732eaf4157dc464d8c76a9a26a2c3334a1 Author: Pedro Alves Date: Wed May 9 14:10:30 2012 +0100 PR gdb/13860: make "-exec-foo"'s MI output equal to "foo"'s MI output. Part of PR gdb/13860 is about the mi-solib.exp test's output being different in sync vs async modes. sync: >./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async off" -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..." ~"done.\n" (gdb) &"start\n" ~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n" =breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"} ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n" =thread-group-started,id="i1",pid="17724" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" (gdb) =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1" ~"Stopped due to shared library event (no libraries added or removed)\n" *stopped,reason="solib-event",frame={addr="0x000000379180f990",func="_dl_debug_state",args=[],from="/lib64/ld-linux-x86-64.so.2"},thread-id="1",stopped-threads="all",core="3" (gdb) async: >./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async on" -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..." ~"done.\n" (gdb) start &"start\n" ~"Temporary breakpoint 1 at 0x400608: file ../../../src/gdb/testsuite/gdb.mi/solib-main.c, line 21.\n" =breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0000000000400608",func="main",file="../../../src/gdb/testsuite/gdb.mi/solib-main.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/solib-main.c",line="21",times="0",original-location="main"} ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n" =thread-group-started,id="i1",pid="17729" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1" (gdb) *stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="1" For now, let's focus only on the *stopped event. We see that the async output is missing frame info. And this causes a test failure in async mode, as "mi_expect_stop solib-event" wants to see the frame info. However, if we compare the event output when a real MI execution command is used, compared to a CLI command (e.g., run vs -exec-run, next vs -exec-next, etc.), we see: >./gdb -nx -q ./testsuite/gdb.mi/solib-main -ex "set stop-on-solib-events 1" -ex "set target-async off" -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main..." ~"done.\n" (gdb) r &"r\n" ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/solib-main \n" =thread-group-started,id="i1",pid="17751" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" (gdb) =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1" ~"Stopped due to shared library event (no libraries added or removed)\n" *stopped,reason="solib-event",frame={addr="0x000000379180f990",func="_dl_debug_state",args=[],from="/lib64/ld-linux-x86-64.so.2"},thread-id="1",stopped-threads="all",core="3" (gdb) -exec-run =thread-exited,id="1",group-id="i1" =thread-group-exited,id="i1" =library-unloaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",thread-group="i1" =thread-group-started,id="i1",pid="17754" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" (gdb) =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1" *stopped,reason="solib-event",thread-id="1",stopped-threads="all",core="1" =thread-selected,id="1" (gdb) As seen above, with MI commands, the *stopped event _doesn't_ have frame info. This is because normal_stop, as commanded by the result of bpstat_print, skips printing frame info in this case (it's an "event", not a "breakpoint"), and when the interpreter is MI, mi_on_normal_stop skips calling print_stack_frame, as the normal_stop call was already done with the MI uiout. This explains why the async output is different even with a CLI command. Its because in async mode, the mi_on_normal_stop path is always taken; it is always reached with the MI uiout, because the stop is handled from the event loop, instead of from within `proceed -> wait_for_inferior -> normal_stop' with the interpreter overridden, as in sync mode. This patch fixes the issue by making all cases output the same *stopped event, by factoring out the print code from normal_stop, and using it from mi_on_normal_stop as well. I chose the *stopped output without a frame, mainly because that is what you already get if you use MI execution commands, the commands frontends are supposed to use (except when implementing a console). This patch makes it simpler to tweak the MI output differently if desired, as we only have to change the centralized print_stop_event (taking into account whether the uiout is MI-like), and all different modes will change accordingly. Tested on x86_64 Fedora 16, no regressions. The mi-solib.exp test no longer fails in async mode with this patch, so the patch removes the kfail. 2012-05-09 Pedro Alves PR gdb/13860 gdb/ * inferior.h (print_stop_event): Declare. * infrun.c (print_stop_event): New, factored out from ... (normal_stop): ... this. * mi/mi-interp.c (mi_on_normal_stop): Use print_stop_event instead of bpstat_print/print_stack_frame. gdb/testsuite/ * gdb.mi/mi-solib.exp: Remove gdb/13860 kfail. * lib/mi-support.exp (mi_expect_stop): Add special handling for solib-event. commit 31fd10e11165df02a399b8e263215e479c46dae8 Author: Pedro Alves Date: Wed May 9 17:28:12 2012 +0100 PR gdb/13860: make -interpreter-exec console "list" behave more like "list". Patch 3 in this series made me notice that "list" behaves differently in CLI vs MI. Particularly: >./gdb -nx -q ./testsuite/gdb.mi/mi-cli Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli...done. (gdb) start Temporary breakpoint 1 at 0x40054d: file ../../../src/gdb/testsuite/gdb.mi/basics.c, line 62. Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli Temporary breakpoint 1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62 62 callee1 (2, "A string argument.", 3.5); (gdb) list 57 { 58 } 59 60 main () 61 { 62 callee1 (2, "A string argument.", 3.5); 63 callee1 (2, "A string argument.", 3.5); 64 65 do_nothing (); /* Hello, World! */ 66 (gdb) Note the list started at line 57. IOW, the program stopped at line 62, and GDB centered the list on that. compare with: >./gdb -nx -q ./testsuite/gdb.mi/mi-cli -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli..." ~"done.\n" (gdb) start &"start\n" ~"Temporary breakpoint 1 at 0x40054d: file ../../../src/gdb/testsuite/gdb.mi/basics.c, line 62.\n" =breakpoint-created,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x000000000040054d",func="main",file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/basics.c",line="62",times="0",original-location="main"} ~"Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli \n" =thread-group-started,id="i1",pid="14221" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" (gdb) =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1" =library-loaded,id="/lib64/libm.so.6",target-name="/lib64/libm.so.6",host-name="/lib64/libm.so.6",symbols-loaded="0",thread-group="i1" =library-loaded,id="/lib64/libc.so.6",target-name="/lib64/libc.so.6",host-name="/lib64/libc.so.6",symbols-loaded="0",thread-group="i1" =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x000000000040054d",func="main",file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/basics.c",line="62",times="1",original-location="main"} ~"\nTemporary breakpoint " ~"1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62\n" ~"62\t callee1 (2, \"A string argument.\", 3.5);\n" *stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x000000000040054d",func="main",args=[],file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/basics.c",line="62"},thread-id="1",stopped-threads="all",core="0" =breakpoint-deleted,id="1" (gdb) -interpreter-exec console list ~"62\t callee1 (2, \"A string argument.\", 3.5);\n" ~"63\t callee1 (2, \"A string argument.\", 3.5);\n" ~"64\t\n" ~"65\t do_nothing (); /* Hello, World! */\n" ~"66\t\n" ~"67\t callme (1);\n" ~"68\t callme (2);\n" ~"69\t\n" ~"70\t return 0;\n" ~"71\t}\n" ^done (gdb) Here the list starts at line 62, where the program was stopped. This happens because print_stack_frame, called from both normal_stop and mi_on_normal_stop, is the function responsible for setting the current sal from the selected frame, overrides the PRINT_WHAT argument, and only after that does it decide whether to center the current sal line or not, based on the overriden value, and it will always decide false. (The print_stack_frame call in mi_on_normal_stop is a little different from the call in normal_stop, in that it is an unconditional SRC_AND_LOC call. The next patch will make those uniform.) Tested on x86_64 Fedora 16, no regressions. gdb/ 2012-05-09 Pedro Alves * stack.c (print_stack_frame): Compute CENTER before overriding PRINT_WHAT. gdb/testsuite/ 2012-05-09 Pedro Alves * gdb.mi/mi-cli.exp: Adjust expected output of "list". ----------------------------------------------------------------------- Summary of changes: gdb/mi/mi-interp.c | 17 +++++++++++++---- gdb/mi/mi-main.c | 3 +++ 2 files changed, 16 insertions(+), 4 deletions(-) First 500 lines of diff: diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 73651f1..886fde1 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -222,16 +222,23 @@ mi_interpreter_exec (void *data, const char *command) return exception_none; } +int mi_last_was_cli; + /* Never display the default GDB prompt in MI case. */ static int mi_interpreter_prompt_p (void *data) { - if (!interp_quiet_p (NULL) - && (!target_is_async_p () || !sync_execution)) + if (!interp_quiet_p (NULL)) { - fputs_unfiltered ("(gdb) \n", raw_stdout); - gdb_flush (raw_stdout); + if (!target_is_async_p () + || (!sync_execution && (!target_async_permitted || !mi_last_was_cli))) + /* && (!running_result_record_printed */ + /* || !mi_proceeded )))) */ + { + fputs_unfiltered ("(gdb) \n", raw_stdout); + gdb_flush (raw_stdout); + } } return 0; @@ -259,6 +266,8 @@ mi_cmd_interpreter_exec (char *command, char **argv, int argc) "does not support command execution"), argv[0]); + mi_last_was_cli = strcmp (argv[0], "console") == 0; + /* Note that unlike the CLI version of this command, we don't actually set INTERP_TO_USE as the current interpreter, as we still want gdb_stdout, etc. to point at MI streams. */ diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 2e6d5af..7c67468 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -1909,6 +1909,8 @@ mi_cmd_remove_inferior (char *command, char **argv, int argc) to perfrom after the given command has executed (display/suppress prompt, display error). */ +extern int mi_last_was_cli; + static void captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context) { @@ -1922,6 +1924,7 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context) running_result_record_printed = 0; mi_proceeded = 0; + mi_last_was_cli = 0; switch (context->op) { case MI_COMMAND: hooks/post-receive -- Repository for Project Archer.