From: Pedro Alves Date: Fri, 24 Jul 2015 18:34:17 +0000 (+0100) Subject: gdb.python/py-events.exp and normal_stop observers ordering X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5068630ad34dce5fefbe68d70d3a50cd8b92f71e;p=binutils-gdb.git gdb.python/py-events.exp and normal_stop observers ordering I have patches that: 1 - make the CLI print stop info from a normal_stop observer, like MI does. 2 - happen to change the order in which the Python and CLI/TUI normal_stop observers are installed. With those in place, py-events.exp regresses like shown below [1], because the Python stop events are output before CLI prints stop info, instead of after, and the test doesn't expect that. With the same Python hooks, the order in which MI and Python events is emited today is already undefined, because MI also uses the normal_stop observer for output. I see no reason that we should in general define the order observers, interpreters and scripting languages get their turn at being notified of these events. So this patch makes the test cope with Python->CLI output order too. Tested on x86_64 Fedora 20. gdb/testsuite/ 2015-07-24 Pedro Alves * gdb.python/py-events.exp: Accept output between the stop event and the prompt. * gdb.python/py-evsignal.exp: Likewise. * gdb.python/py-evthreads.exp: Likewise. [1] - The regressions in question look like: Before said patches: (gdb) continue Continuing. event type: continue Breakpoint 2, first () at /home/pedro/gdb/mygit/build/../src/gdb/testsuite/gdb.python/py-events.c:30 30 for (i = 0; i < 2; i++) event type: stop event type: stop stop reason: breakpoint first breakpoint number: 2 breakpoint number: 2 breakpoint number: 3 all threads stopped (gdb) PASS: gdb.python/py-events.exp: continue After said patches: (gdb) continue Continuing. event type: continue event type: stop event type: stop stop reason: breakpoint first breakpoint number: 2 breakpoint number: 2 breakpoint number: 3 all threads stopped Breakpoint 2, first () at /home/pedro/gdb/mygit/build/../src/gdb/testsuite/gdb.python/py-events.c:30 30 for (i = 0; i < 2; i++) (gdb) FAIL: gdb.python/py-events.exp: continue --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 535a540a268..8e878f1893c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2015-07-24 Pedro Alves + + * gdb.python/py-events.exp: Accept output between the stop event + and the prompt. + * gdb.python/py-evsignal.exp: Likewise. + * gdb.python/py-evthreads.exp: Likewise. + 2015-07-24 Pedro Alves PR gdb/18717 diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp index 2d89eb675b1..f880b8412ea 100644 --- a/gdb/testsuite/gdb.python/py-events.exp +++ b/gdb/testsuite/gdb.python/py-events.exp @@ -65,7 +65,7 @@ gdb_test "continue" ".*event type: continue.* .*first breakpoint number: 2.* .*breakpoint number: 2.* .*breakpoint number: 3.* -all threads stopped" +all threads stopped.*" # Test that when "step N" trips on a breakpoint, we get a stop event # with breakpoint stop reason. @@ -75,7 +75,7 @@ gdb_test "step 3" ".*event type: continue.* .*stop reason: breakpoint.* .*first breakpoint number: 4.* .*breakpoint number: 4.* -all threads stopped" +all threads stopped.*" delete_breakpoints diff --git a/gdb/testsuite/gdb.python/py-evsignal.exp b/gdb/testsuite/gdb.python/py-evsignal.exp index c90be8ae48f..ea7b73b3a92 100644 --- a/gdb/testsuite/gdb.python/py-evsignal.exp +++ b/gdb/testsuite/gdb.python/py-evsignal.exp @@ -38,7 +38,7 @@ gdb_test_no_output "set non-stop on" gdb_run_cmd gdb_test_multiple "" "Signal Thread 3" { - -re "event type: stop\r\nstop reason: signal\r\nstop signal: SIGUSR1\r\nthread num: 3\r\nevent type: stop\r\n$gdb_prompt $" { + -re "event type: stop\r\nstop reason: signal\r\nstop signal: SIGUSR1\r\nthread num: 3\r\nevent type: stop\r\n.*$gdb_prompt $" { pass "thread 3 was signaled" } -re "The target does not support running in non-stop mode" { diff --git a/gdb/testsuite/gdb.python/py-evthreads.exp b/gdb/testsuite/gdb.python/py-evthreads.exp index 4c9a53a4162..deefda544ef 100644 --- a/gdb/testsuite/gdb.python/py-evthreads.exp +++ b/gdb/testsuite/gdb.python/py-evthreads.exp @@ -48,7 +48,7 @@ gdb_breakpoint "thread3" gdb_run_cmd set test "Run to breakpoint 1" gdb_test_multiple "" $test { - -re "event type: stop\r\nstop reason: breakpoint\r\nfirst breakpoint number: 1\r\nbreakpoint number: 1\r\nthread num: 1\r\n$gdb_prompt $" { + -re "event type: stop\r\nstop reason: breakpoint\r\nfirst breakpoint number: 1\r\nbreakpoint number: 1\r\nthread num: 1\r\n.*$gdb_prompt $" { pass $test } -re "The target does not support running in non-stop mode" { @@ -57,11 +57,11 @@ gdb_test_multiple "" $test { } } -gdb_test "next" "event type: stop\r\nstop reason: breakpoint\r\nfirst breakpoint number: 2\r\nbreakpoint number: 2\r\nthread num: 2" "reached breakpoint 2" +gdb_test "next" "event type: stop\r\nstop reason: breakpoint\r\nfirst breakpoint number: 2\r\nbreakpoint number: 2\r\nthread num: 2.*" "reached breakpoint 2" gdb_test "thread 2" {\[Switching to thread 2 .*} -gdb_test "next" "event type: stop\r\nstop reason: breakpoint\r\nfirst breakpoint number: 3\r\nbreakpoint number: 3\r\nthread num: 3" "reached breakpoint 3" +gdb_test "next" "event type: stop\r\nstop reason: breakpoint\r\nfirst breakpoint number: 3\r\nbreakpoint number: 3\r\nthread num: 3.*" "reached breakpoint 3" gdb_test "thread 3" {\[Switching to thread 3 .*} @@ -75,7 +75,7 @@ gdb_test_multiple "continue&" $test { set test "thread 3 was signaled" gdb_test_multiple "" $test { - -re "event type: stop\r\nstop reason: signal\r\nstop signal: SIGUSR1\r\nthread num: 3\r\nevent type: stop\r\n$" { + -re "event type: stop\r\nstop reason: signal\r\nstop signal: SIGUSR1\r\nthread num: 3\r\nevent type: stop\r\n" { pass $test } }