]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix gdb.threads/step-over-thread-exit.exp race users/palves/step-over-thread-exit-test-race
authorPedro Alves <pedro@palves.net>
Mon, 13 Nov 2023 16:30:31 +0000 (16:30 +0000)
committerPedro Alves <pedro@palves.net>
Mon, 13 Nov 2023 16:57:48 +0000 (16:57 +0000)
Change-Id: I9d0a6fab069a02ac5557525b93b129940dbd4bf7

gdb/testsuite/gdb.threads/step-over-thread-exit.exp

index 615bd838763166d41b22733f1b13a03d5873fc43..19723e7b411f8e4164f7b69833b7a5a53d392296 100644 (file)
@@ -96,6 +96,16 @@ proc test {displaced-stepping non-stop target-non-stop schedlock cmd ns_stop_all
            if {${non-stop}} {
                gdb_test -nopass "thread $thread" "Switching to thread .*" \
                    "switch to event thread"
+
+               # Once we continue, the current thread exits, and the
+               # main thread thus unblocks from its pthread_join, and
+               # spawns a new thread.  That new thread may hit the
+               # breakpoint at my_exit_syscall very quickly.  GDB
+               # could then see/process that breakpoint event before
+               # the thread exit event for the thread we care about,
+               # which would result in a failure in the test below.
+               # Just delete the breakpoint to avoid it.
+               delete_breakpoints
            }
 
            gdb_test_multiple $cmd "command aborts when thread exits" {