From: Simon Marchi Date: Tue, 28 Sep 2021 17:22:53 +0000 (-0400) Subject: gdb.base/foll-fork.exp: accept "info breakpoints" output in any order X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4872f9a1b553445165dc49eaa091ca8400c130a0;p=binutils-gdb.git gdb.base/foll-fork.exp: accept "info breakpoints" output in any order The test currently requires the "inf 1" breakpoint to be before the "inf 2" breakpoint. This is not always the case: info breakpoints 2 Num Type Disp Enb Address What 2 breakpoint keep y 2.1 y 0x0000555555554730 in callee at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/foll-fork.c:9 inf 2 2.2 y 0x0000555555554730 in callee at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/foll-fork.c:9 inf 1 (gdb) FAIL: gdb.base/foll-fork.exp: follow-fork-mode=parent: detach-on-fork=off: cmd=next 2: test_follow_fork: info breakpoints Since add_location_to_breakpoint uses only the address as a criterion to sort locations, the order of locations at the same address is not stable: it will depend on the insertion order. Here, the insertion order comes from the order of SALs when creating the breakpoint, which can vary from machine to machine. While it would be more user-friendly to have a more stable order for printed breakpoint locations, it doesn't really matter for this test, and it would be hard to define an order that will be the same everywhere, all the time. So, loosen the regexp to accept "inf 1" and "inf 2" in any order. Co-Authored-By: Pedro Alves Change-Id: I5ada2e0c6ad0669e0d161bfb6b767229c0970d16 --- diff --git a/gdb/testsuite/gdb.base/foll-fork.exp b/gdb/testsuite/gdb.base/foll-fork.exp index 7f9e1cf87c6..d6d32f63121 100644 --- a/gdb/testsuite/gdb.base/foll-fork.exp +++ b/gdb/testsuite/gdb.base/foll-fork.exp @@ -193,10 +193,17 @@ proc_with_prefix test_follow_fork { follow-fork-mode detach-on-fork cmd } { pass $gdb_test_name } } + + set any {[^\r\n]+} + + set loc1_inf1 "$bpnum\\.1 $any inf 1" + set loc1_inf2 "$bpnum\\.1 $any inf 2" + + set loc2_inf1 "$bpnum\\.2 $any inf 1" + set loc2_inf2 "$bpnum\\.2 $any inf 2" + gdb_test "info breakpoints $bpnum" \ - [multi_line \ - "$bpnum\\.1 .* inf 1" \ - "$bpnum\\.2 .* inf 2"] \ + "($loc1_inf1\r\n$loc2_inf2|$loc1_inf2\r\n$loc2_inf1)" \ "info breakpoints" } }