gdb.python/py-events.exp and normal_stop observers ordering
authorPedro Alves <palves@redhat.com>
Fri, 24 Jul 2015 18:34:17 +0000 (19:34 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 24 Jul 2015 18:34:17 +0000 (19:34 +0100)
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  <palves@redhat.com>

* 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

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-events.exp
gdb/testsuite/gdb.python/py-evsignal.exp
gdb/testsuite/gdb.python/py-evthreads.exp

index 535a540a2686b1cd893a6cb413be6ffc1d1ad206..8e878f1893cb89f3b881ffd0e6f5e50a1a97b4f6 100644 (file)
@@ -1,3 +1,10 @@
+2015-07-24  Pedro Alves  <palves@redhat.com>
+
+       * 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  <palves@redhat.com>
 
        PR gdb/18717
index 2d89eb675b17abd082d9e4fe1884c679f1b62485..f880b8412ea8c3232e45d799280dcfe30a7e2213 100644 (file)
@@ -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
 
index c90be8ae48f9fd95579becd11845c18c78af6ff9..ea7b73b3a92e4c314e0e9728efe58be11803a591 100644 (file)
@@ -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"  {
index 4c9a53a4162c58d4b3a51e2eac617e2486166c01..deefda544efab9d0989ca5edf3d9a8969b227165 100644 (file)
@@ -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
     }
 }
This page took 0.033841 seconds and 4 git commands to generate.