0c7e1a4602
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 17, no regressions. The mi-solib.exp test no longer fails in async mode with this patch, so the patch removes the kfail. 2014-03-18 Pedro Alves <palves@redhat.com> PR gdb/13860 * 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. 2014-03-18 Pedro Alves <palves@redhat.com> PR gdb/13860 * gdb.mi/mi-solib.exp: Remove gdb/13860 kfail. * lib/mi-support.exp (mi_expect_stop): Add special handling for solib-event. |
||
---|---|---|
.. | ||
array.f | ||
basics.c | ||
ChangeLog-1999-2003 | ||
dw2-ref-missing-frame-func.c | ||
dw2-ref-missing-frame-main.c | ||
dw2-ref-missing-frame.exp | ||
dw2-ref-missing-frame.S | ||
gdb669.exp | ||
gdb680.exp | ||
gdb701.c | ||
gdb701.exp | ||
gdb792.cc | ||
gdb792.exp | ||
gdb2549.exp | ||
Makefile.in | ||
mi-async.exp | ||
mi-basics.exp | ||
mi-break.exp | ||
mi-breakpoint-changed.exp | ||
mi-catch-load-so.c | ||
mi-catch-load.c | ||
mi-catch-load.exp | ||
mi-cli.exp | ||
mi-cmd-param-changed.exp | ||
mi-console.c | ||
mi-console.exp | ||
mi-disassemble.exp | ||
mi-dprintf.c | ||
mi-dprintf.exp | ||
mi-eval.exp | ||
mi-file-transfer.exp | ||
mi-file.exp | ||
mi-fill-memory.exp | ||
mi-fullname-deleted.exp | ||
mi-hack-cli.exp | ||
mi-i-cmd.exp | ||
mi-info-os.exp | ||
mi-inheritance-syntax-error.cc | ||
mi-inheritance-syntax-error.exp | ||
mi-language.exp | ||
mi-logging.exp | ||
mi-memory-changed.exp | ||
mi-nonstop-exit.exp | ||
mi-nonstop.exp | ||
mi-ns-stale-regcache.exp | ||
mi-nsintrall.exp | ||
mi-nsmoribund.exp | ||
mi-nsthrexec.exp | ||
mi-pending.c | ||
mi-pending.exp | ||
mi-pendshr.c | ||
mi-pthreads.exp | ||
mi-read-memory.c | ||
mi-read-memory.exp | ||
mi-record-changed.exp | ||
mi-reg-undefined.c | ||
mi-reg-undefined.exp | ||
mi-reg-undefined.S | ||
mi-regs.exp | ||
mi-return.exp | ||
mi-reverse.exp | ||
mi-simplerun.exp | ||
mi-solib.exp | ||
mi-stack.c | ||
mi-stack.exp | ||
mi-start.c | ||
mi-start.exp | ||
mi-stepi.exp | ||
mi-stepn.c | ||
mi-stepn.exp | ||
mi-syn-frame.c | ||
mi-syn-frame.exp | ||
mi-undefined-cmd.exp | ||
mi-until.exp | ||
mi-var-block.exp | ||
mi-var-child-f.exp | ||
mi-var-child.c | ||
mi-var-child.exp | ||
mi-var-cmd.exp | ||
mi-var-cp.cc | ||
mi-var-cp.exp | ||
mi-var-create-rtti.c | ||
mi-var-create-rtti.exp | ||
mi-var-display.exp | ||
mi-var-invalidate.exp | ||
mi-var-rtti.cc | ||
mi-var-rtti.exp | ||
mi-watch-nonstop.exp | ||
mi-watch.exp | ||
mi2-amd64-entry-value.c | ||
mi2-amd64-entry-value.exp | ||
mi2-amd64-entry-value.s | ||
mi2-prompt.exp | ||
mi2-var-child.exp | ||
non-stop-exit.c | ||
non-stop.c | ||
ns-stale-regcache.c | ||
nsintrall.c | ||
nsmoribund.c | ||
nsthrexec.c | ||
pending.c | ||
pendshr1.c | ||
pendshr2.c | ||
pr11022.c | ||
pr11022.exp | ||
pthreads.c | ||
solib-lib.c | ||
solib-main.c | ||
testcmds | ||
until.c | ||
var-cmd.c | ||
watch-nonstop.c |