From patchwork Thu Jan 2 23:12:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Barrett X-Patchwork-Id: 37161 Received: (qmail 124632 invoked by alias); 2 Jan 2020 23:34:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 124538 invoked by uid 89); 2 Jan 2020 23:34:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_PASS autolearn=ham version=3.3.1 spammy=2020-01-03, 20200103, George X-HELO: mail.bob131.so Received: from server2.bob131.so (HELO mail.bob131.so) (128.199.153.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 02 Jan 2020 23:34:23 +0000 Received: from internal.mail.bob131.so (localhost [127.0.0.1]) by mail.bob131.so (Postfix) with ESMTP id 1FD0452E2B for ; Thu, 2 Jan 2020 23:34:21 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.bob131.so 1FD0452E2B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bob131.so; s=default; t=1578008061; bh=sy58Pl8kcdGXlmgkiNyQaAYkCl68NcS4NS57KLD+Ezc=; h=In-Reply-To:References:From:Date:Subject:To:From; b=NB8A8Huqb5B0Hk0+oaHdJ+G5BdmERUhRjl/sQIANKFgA00G0hUO3rXLhFuW9CVx5H DmuvfLr/Yd/XRAueN+KqzFTYOktFLPRODys+lC82U0MHAynahygcqkcpaql1wnCur6 6BWHzTs54So03IiLqCsOZjhYerfiRwL+9Eao0+oJcaYiJsQ5XaScBYn2NH4hZ0MWnW bAA83vhzzllQzT7Qt8OdAgQsuMS4/s6Wg/05c8oqPCIf+3xCurEcICZieYapt6q54R YSNudoALXe3Xx3fQVBT1aZBTt3jiHrW1ZigvSsn00BEPXyzV6Gjh3gFs8iphEQSgOg p6CM763HMm/fA== Message-Id: In-Reply-To: <26056otsm6hu3octnbb1znmaooyq1x0&si&f67z1--1xu5_ssse/@mail.bob131.so> References: <26056otsm6hu3octnbb1znmaooyq1x0&si&f67z1--1xu5_ssse/@mail.bob131.so> From: George Barrett Date: Fri, 03 Jan 2020 10:12:45 +1100 Subject: [PATCH v2 1/2] gdb/testsuite/gdb.base/stap-probe: Minor clean-up To: gdb-patches@sourceware.org This patch resolves a couple of issues with the test case for SystemTap user-space probe points: 1. The preprocessor macro guarding the semaphore variables in the C file is (rather confusingly) named USE_PROBES. This has been renamed to USE_SEMAPHORES, to better reflect its function. 2. The test procedures in the expect file improperly pass the flag defining USE_PROBES to prepare_for_testing; as such, the test binary that's supposed to have probes with semaphores is the same as the one without. This has also been fixed. 3. No test is performed to check that `info probes' returns information about probe semaphores. Such a test is included in this patch. gdb/testsuite/ChangeLog 2020-01-03 George Barrett * gdb.base/stap-probe.c: Rename USE_PROBES to USE_SEMAPHORES. * gdb.base/stap-probe.exp: Likewise. (stap_test): Pass argument as an additional flag. (stap_test_no_debuginfo): Likewise. (stap_test): Check `info probes stap' output for semaphore addresses if the test binary is supposed to have them. --- gdb/testsuite/gdb.base/stap-probe.c | 2 +- gdb/testsuite/gdb.base/stap-probe.exp | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/gdb/testsuite/gdb.base/stap-probe.c b/gdb/testsuite/gdb.base/stap-probe.c index 276403d75d..d197e570d1 100644 --- a/gdb/testsuite/gdb.base/stap-probe.c +++ b/gdb/testsuite/gdb.base/stap-probe.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#if USE_PROBES +#if USE_SEMAPHORES #define _SDT_HAS_SEMAPHORES __extension__ unsigned short test_user_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); diff --git a/gdb/testsuite/gdb.base/stap-probe.exp b/gdb/testsuite/gdb.base/stap-probe.exp index 7571482e04..30a4425c04 100644 --- a/gdb/testsuite/gdb.base/stap-probe.exp +++ b/gdb/testsuite/gdb.base/stap-probe.exp @@ -22,7 +22,7 @@ proc stap_test {exec_name {arg ""}} { global testfile hex srcfile if {[prepare_for_testing "failed to prepare" ${exec_name} $srcfile \ - [concat $arg debug]]} { + [concat additional_flags=$arg debug]]} { return -1 } @@ -33,9 +33,14 @@ proc stap_test {exec_name {arg ""}} { gdb_test "print \$_probe_argc" "No probe at PC $hex" \ "check argument not at probe point" - gdb_test "info probes stap" \ - "test *user *$hex .*" - + if {[string first "-DUSE_SEMAPHORES" $arg] != -1} { + gdb_test "info probes stap" \ + "test *user *$hex *$hex .*" + } else { + gdb_test "info probes stap" \ + "test *user *$hex .*" + } + if {[runto "-pstap test:user"]} { pass "run to -pstap test:user" } else { @@ -96,7 +101,7 @@ proc stap_test_no_debuginfo {exec_name {arg ""}} { global testfile hex if {[prepare_for_testing "failed to prepare" ${exec_name} ${testfile}.c \ - {$arg nodebug optimize=-O2}]} { + [concat additional_flags=$arg nodebug optimize=-O2]]} { return -1 } @@ -166,7 +171,7 @@ with_test_prefix "without semaphore, not optimized" { } with_test_prefix "with semaphore, not optimized" { - stap_test "stap-probe-sem-noopt" "-DUSE_PROBES" + stap_test "stap-probe-sem-noopt" "-DUSE_SEMAPHORES" } with_test_prefix "without semaphore, optimized" { @@ -174,5 +179,5 @@ with_test_prefix "without semaphore, optimized" { } with_test_prefix "with semaphore, optimized" { - stap_test_no_debuginfo "stap-probe-sem-opt" "-DUSE_PROBES" + stap_test_no_debuginfo "stap-probe-sem-opt" "-DUSE_SEMAPHORES" }