From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 8B2133858C2F; Sat, 2 Jul 2022 09:50:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B2133858C2F Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix gdb.base/early-init-file.exp with -fsanitize=thread X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: f15f0ddd10ed6d7c5bc08b3364abef4bd4c8a0f1 X-Git-Newrev: 47226049bb7cdbc93543db13e6305c0091f4f642 Message-Id: <20220702095006.8B2133858C2F@sourceware.org> Date: Sat, 2 Jul 2022 09:50:06 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jul 2022 09:50:06 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D47226049bb7c= dbc93543db13e6305c0091f4f642 commit 47226049bb7cdbc93543db13e6305c0091f4f642 Author: Tom de Vries Date: Sat Jul 2 11:50:03 2022 +0200 [gdb/testsuite] Fix gdb.base/early-init-file.exp with -fsanitize=3Dthre= ad =20 When building gdb with -fsanitize=3Dthread, I run into: ... FAIL: gdb.base/early-init-file.exp: check startup version string has st= yle \ version ... due to this: ... warning: Found custom handler for signal 7 (Bus error) preinstalled.^M warning: Found custom handler for signal 8 (Floating point exception) \ preinstalled.^M warning: Found custom handler for signal 11 (Segmentation fault) \ preinstalled.^M Some signal dispositions inherited from the environment (SIG_DFL/SIG_IG= N)^M won't be propagated to spawned programs.^M ... appearing before the "GNU gdb (GDB) $version" line. =20 This is similar to the problem fixed by commit f0bbba7886f ("gdb.debuginfod/fetch_src_and_symbols.exp: fix when GDB is built with AddressSanitizer"). =20 In that commit, the problem was fixed by starting gdb with -quiet, but = using that would mean the "GNU gdb (GDB) $version" line that we're trying to = check would disappear. =20 Fix this instead by updating the regexp to allow the message. =20 Tested on x86_64-linux. Diff: --- gdb/testsuite/gdb.base/early-init-file.exp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.base/early-init-file.exp b/gdb/testsuite/gdb= .base/early-init-file.exp index 1bc6cea13e3..b5aa5583615 100644 --- a/gdb/testsuite/gdb.base/early-init-file.exp +++ b/gdb/testsuite/gdb.base/early-init-file.exp @@ -22,9 +22,23 @@ if {[build_executable "failed to build" $testfile $srcfi= le]} { return -1 } =20 +set custom_signal_handle_re \ + "warning: Found custom handler for signal $decimal \(\[^\r\n\]+\) prei= nstalled\." +set signal_dispositions_re \ + [multi_line \ + "Some signal dispositions inherited from the environment \(\[^\r\n\]+\)"= \ + "won't be propagated to spawned programs\." ] +set gdb_sanitizer_msg_re \ + [multi_line \ + "($custom_signal_handle_re" \ + ")+$signal_dispositions_re" \ + ""] + # Start gdb and ensure that the initial version string is styled in # STYLE, use MESSAGE as the name of the test. proc check_gdb_startup_version_string { style { message "" } } { + global gdb_sanitizer_msg_re + if { $message =3D=3D "" } { set message "check startup version string has style $style" } @@ -32,7 +46,7 @@ proc check_gdb_startup_version_string { style { message "= " } } { gdb_exit gdb_spawn set vers [style "GNU gdb.*" $style] - gdb_test "" "^${vers}.*" $message + gdb_test "" "^(${gdb_sanitizer_msg_re})?${vers}.*" $message } =20 # Return a list containing two directory paths for newly created home @@ -70,12 +84,13 @@ proc setup_home_directories { prefix content } { # drop straight to the prompt. proc check_gdb_startups_up_quietly { message } { global gdb_prompt + global gdb_sanitizer_msg_re =20 gdb_exit gdb_spawn =20 gdb_test_multiple "" $message { - -re "^$gdb_prompt $" { + -re "^(${gdb_sanitizer_msg_re})?$gdb_prompt $" { pass $gdb_test_name } }