From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 6AE633858D35 for ; Fri, 8 Mar 2024 09:35:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6AE633858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6AE633858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709890553; cv=none; b=aY5dOq6Sx1mNpdx5tbMk3aRwj6Ix2efl5nucfYcmaSrv6UN1ghZWjSOS9qtvGMcYgdg1FxnHyMiGfplGt+rn16TTrqIPQfzLvmvnKd8Rsc5KcCxQgG2j/CmzAqfjJ8JUVGeWZsQvIyxW6LQaeQSGxlmfV/dzSNUp3AxzVSdkjwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709890553; c=relaxed/simple; bh=2TTDivlMXHvVWiQQ64psTSWnZO3824MaRXPzBz0zr9E=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=G2RdpB722qm+ZxzPElUtmWWhA2GHK/qsp5UQ0n0WfBIT6f03bg1qfZF3fT+kJHvQBzNfUV8pNpfhxxiM1AeYq8egNVn2iLB1scE/bxRdxQRuXUZ/gKSX6Xu/svvAXeRaii8g2rlT+iq36jKUCcjA2MVl7oOnMbBh7j1qpasEQJU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 5DD8175A95 for ; Fri, 8 Mar 2024 09:33:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709890386; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kxuNR5Hu4ooEBzhWe83CkNnC6lHqMbyKynIjuWxcRr0=; b=jC/z1ZLXNfGDempGVs1q9SGN+9lUPXz1oA69pNLYvLUIpk5QxgD165FC7CKmNoi17MAOki lvlpxRFnsU+VbFxFP4+GGh5ZQKMvbSgamH3852yN8+sIHqvoSAT1Fhk+5idUnty0KNs17Y dbzZ1//q0q6wBN+zW12UZNWMS57g0mI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709890386; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kxuNR5Hu4ooEBzhWe83CkNnC6lHqMbyKynIjuWxcRr0=; b=XbXfjSe5AGNUlF0N2/SWGFD3PVHAyI3bIKYH7QC1krNfPGphFPAeAAl2B64dVUKPGkJoMc 2outcqpIAQaM8bCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709890386; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kxuNR5Hu4ooEBzhWe83CkNnC6lHqMbyKynIjuWxcRr0=; b=jC/z1ZLXNfGDempGVs1q9SGN+9lUPXz1oA69pNLYvLUIpk5QxgD165FC7CKmNoi17MAOki lvlpxRFnsU+VbFxFP4+GGh5ZQKMvbSgamH3852yN8+sIHqvoSAT1Fhk+5idUnty0KNs17Y dbzZ1//q0q6wBN+zW12UZNWMS57g0mI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709890386; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kxuNR5Hu4ooEBzhWe83CkNnC6lHqMbyKynIjuWxcRr0=; b=XbXfjSe5AGNUlF0N2/SWGFD3PVHAyI3bIKYH7QC1krNfPGphFPAeAAl2B64dVUKPGkJoMc 2outcqpIAQaM8bCg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7E4AC137AC for ; Fri, 8 Mar 2024 09:33:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id +P2RHVHb6mWLYAAAD6G6ig (envelope-from ) for ; Fri, 08 Mar 2024 09:33:05 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH v4 5/6] gdb/testsuite: Reduce gdb.threads/threadcrash.exp reliance on libc symbols Date: Fri, 8 Mar 2024 10:33:41 +0100 Message-Id: <20240308093342.26745-6-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240308093342.26745-1-tdevries@suse.de> References: <20240308093342.26745-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Bar: + Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="jC/z1ZLX"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=XbXfjSe5 X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [1.49 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; R_MISSING_CHARSET(2.50)[]; TO_DN_NONE(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.00)[26.57%]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_MED(-2.00)[suse.de:dkim]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCPT_COUNT_ONE(0.00)[1]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: 1.49 X-Rspamd-Queue-Id: 5DD8175A95 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Guinevere Larsen The test gdb.threads/threadcrash.exp demanded GDB to fully unwind and print the names of all functions. However, some of the functions are from the libc library, and so the test implicitly demanded libc symbols to be available, and would fail otherwise, as was raised in PR gdb/31293. This commit changes it so we only explicitly check for functions that are not provided by threadcrash.c if they are indeed available. Tested on arm-linux and x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31293 --- gdb/testsuite/gdb.threads/threadcrash.exp | 48 +++++++++++++++++++---- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.threads/threadcrash.exp index 16fd7eb4e23..c72ce73fd6d 100644 --- a/gdb/testsuite/gdb.threads/threadcrash.exp +++ b/gdb/testsuite/gdb.threads/threadcrash.exp @@ -20,6 +20,9 @@ # a gcore. +set have_sleep -1 +set have_pthread_kill -1 + # Use 'thread apply all backtrace' to check if all expected threads # are present, and stopped in the expected locations. Set the global # TEST_LIST to be the a list of regexps expected to match all the @@ -27,6 +30,8 @@ # GDB sees the threads. proc thread_apply_all {} { + global have_sleep + global have_pthread_kill global test_list set test_list { } @@ -73,6 +78,14 @@ proc thread_apply_all {} { lappend test_list 7 exp_continue } + -re "^\r\n${hs} in sleep $hs$eol" { + set have_sleep 1 + exp_continue + } + -re "^\r\n${hs} in pthread_kill $hs$eol" { + set have_pthread_kill 1 + exp_continue + } -re "^\r\n$hs$eol" { exp_continue } @@ -82,6 +95,13 @@ proc thread_apply_all {} { } gdb_assert {$unwind_fail == false} + + if { $have_sleep == -1 } { + set have_sleep 0 + } + if { $have_pthread_kill == -1 } { + set have_pthread_kill 0 + } } # Perform all the tests we're interested in. They are: @@ -90,6 +110,8 @@ proc thread_apply_all {} { # * testing if GDB recreated the full backtrace we expect for all threads proc do_full_test {} { + global have_sleep + global have_pthread_kill global test_list set thread_count [get_valueof "" "\$_inferior_thread_count" 0] gdb_assert {$thread_count == 7} @@ -98,6 +120,18 @@ proc do_full_test {} { gdb_assert {$thread_count == [llength $test_list]} + if { $have_sleep } { + set sleep ".*sleep.*" + } else { + set sleep ".*" + } + + if { $have_pthread_kill } { + set pthread_kill ".*pthread_kill.*" + } else { + set pthread_kill ".*" + } + for {set i 0} {$i < $thread_count } {incr i} { set thread_num [expr [llength $test_list] - $i] @@ -105,25 +139,25 @@ proc do_full_test {} { if { $type == 1 } { set re \ [multi_line \ - ".sleep.*" \ + $sleep \ ".*do_syscall_task .location=SIGNAL_ALT_STACK.*" \ ".*signal_handler.*" \ ".*signal handler called.*" \ - ".*pthread_kill.*" \ + $pthread_kill \ ".*thread_function.*"] } elseif { $type == 2 } { set re \ [multi_line \ - ".*sleep.*" \ + $sleep \ ".*do_syscall_task .location=SIGNAL_HANDLER.*" \ ".*signal_handler.*" \ ".*signal handler called.*" \ - ".*pthread_kill.*" \ + $pthread_kill \ ".*thread_function.*"] } elseif { $type == 3 } { set re \ [multi_line \ - ".*sleep.*" \ + $sleep \ ".*do_syscall_task .location=NORMAL.*" \ ".*thread_function.*"] } elseif { $type == 4 } { @@ -132,7 +166,7 @@ proc do_full_test {} { ".*do_spin_task .location=SIGNAL_ALT_STACK.*" \ ".*signal_handler.*" \ ".*signal handler called.*" \ - ".*pthread_kill.*" \ + $pthread_kill \ ".*thread_function.*"] } elseif { $type == 5 } { set re \ @@ -140,7 +174,7 @@ proc do_full_test {} { ".*do_spin_task .location=SIGNAL_HANDLER.*" \ ".*signal_handler.*" \ ".*signal handler called.*" \ - ".*pthread_kill.*" \ + $pthread_kill \ ".*thread_function.*"] } elseif { $type == 6 } { set re \ -- 2.35.3