From patchwork Tue Oct 8 09:39:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 34865 Received: (qmail 28178 invoked by alias); 8 Oct 2019 09:39:27 -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 28123 invoked by uid 89); 8 Oct 2019 09:39:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-wr1-f48.google.com Received: from mail-wr1-f48.google.com (HELO mail-wr1-f48.google.com) (209.85.221.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 08 Oct 2019 09:39:25 +0000 Received: by mail-wr1-f48.google.com with SMTP id y19so18588612wrd.3 for ; Tue, 08 Oct 2019 02:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=OTr2uGn9/m6lsW2R2qdhVgJbzFUw3j8T8aVlKwAINWg=; b=IwN/sgFOyV5BTcTw7S98HAR5oCBdmc82zG5mntVUC/fWP/lrqCd9j3RBc2XFflMrf+ 8ynZMlBdbJN92PBbhW0IM7VgqdJYE0QX+4UAGknaDrCx9YN2Y+wPMzwHn2CIuzet0lj0 +IBMXbbdkdlhsp/kqGwooYrs9UzV3rkGSo/e4Ygqp1MCWXcP0c2g7PT8wVZuYewfzPjI bGc8l8fCFOgHMEjoipQrXOT4R0XIocJGXnb2UaUz6oBD9zvC6P3T5aj9v6zaqqraU3rO TwT6Ym5EqJGipMTNN6aT7MagGABftEs44Lg7z41IvEMh1TreRoj/bIUO5Ldv1HqBVQYd ohAQ== Return-Path: Received: from localhost (cust64-dsl91-135-5.idnet.net. [91.135.5.64]) by smtp.gmail.com with ESMTPSA id y19sm5376664wmi.13.2019.10.08.02.39.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2019 02:39:22 -0700 (PDT) From: Andrew Burgess To: gdb-patches Cc: Weimin Pan , Simon Marchi , Andrew Burgess Subject: [PATCH 1/2] gdb/testsuite: Introduce compiler_supports_ctf_debug guard function Date: Tue, 8 Oct 2019 10:39:18 +0100 Message-Id: <698b8b98fa0455cf5abe6c0573b05ea82644d01c.1570526677.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes Most versions of GCC in the wild don't support CTF debug format right now, so, rather than attempting to compile the tests and failing each time, this patch introduces a guard function to check if the compiler supports CTF. If we don't have CTF support then the CTF tests are skipped. This patch only updates 3 of the 4 CTF tests, the fourth will be handled in the next patch. gdb/testsuite/ChangeLog: * gdb.base/ctf-constvars.exp: Skip test if CTF is not supported in the compiler. Clean up header comment a little. * gdb.base/ctf-ptype.exp: Likewise. * gdb.base/ctf-whatis.exp: Likewise. * lib/gdb.exp (compiler_supports_ctf_debug): New proc. --- gdb/testsuite/ChangeLog | 8 ++++++++ gdb/testsuite/gdb.base/ctf-constvars.exp | 20 ++++++++++---------- gdb/testsuite/gdb.base/ctf-ptype.exp | 10 +++++----- gdb/testsuite/gdb.base/ctf-whatis.exp | 10 +++++----- gdb/testsuite/lib/gdb.exp | 11 +++++++++++ 5 files changed, 39 insertions(+), 20 deletions(-) diff --git a/gdb/testsuite/gdb.base/ctf-constvars.exp b/gdb/testsuite/gdb.base/ctf-constvars.exp index 4a81a94ddb4..58c0badc0c2 100644 --- a/gdb/testsuite/gdb.base/ctf-constvars.exp +++ b/gdb/testsuite/gdb.base/ctf-constvars.exp @@ -18,20 +18,20 @@ # # This file is part of the gdb testsuite # -# tests for const variables -# const pointers to vars -# pointers to const variables -# const pointers to const vars -# with mixed types +# Tests for: const variables, +# const pointers to vars +# pointers to const variables +# const pointers to const vars +# with mixed types. -# -# test running programs -# -# -gt generates full-fledged CTF. +if ![compiler_supports_ctf_debug] { + return 0 +} standard_testfile .c -set opts "additional_flags=-gt" +# Using `-gt` generates full-fledged CTF debug information. +set opts "additional_flags=-gt" if { [prepare_for_testing "failed to prepare" ${testfile} \ [list $srcfile] [list $opts nowarnings]] } { return 0 diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp index 9f545824224..172f6d13a18 100644 --- a/gdb/testsuite/gdb.base/ctf-ptype.exp +++ b/gdb/testsuite/gdb.base/ctf-ptype.exp @@ -15,14 +15,14 @@ # This file is a subset of ptype.exp written by Rob Savoye. (rob@cygnus.com) -# -# test running programs -# -# -gt generates full-fledged CTF. +if ![compiler_supports_ctf_debug] { + return 0 +} standard_testfile .c -set opts "additional_flags=-gt" +# Using `-gt` generates full-fledged CTF debug information. +set opts "additional_flags=-gt" if { [prepare_for_testing "failed to prepare" ${testfile} \ [list $srcfile] [list $opts nowarnings]] } { return 0 diff --git a/gdb/testsuite/gdb.base/ctf-whatis.exp b/gdb/testsuite/gdb.base/ctf-whatis.exp index 3f26fc326e3..377eeb3314f 100644 --- a/gdb/testsuite/gdb.base/ctf-whatis.exp +++ b/gdb/testsuite/gdb.base/ctf-whatis.exp @@ -15,14 +15,14 @@ # This file is a subset of whatis.exp written by Rob Savoye. (rob@cygnus.com) -# -# test running programs -# -# -gt generates full-fledged CTF. +if ![compiler_supports_ctf_debug] { + return 0 +} standard_testfile .c -set opts "additional_flags=-gt" +# Using `-gt` generates full-fledged CTF debug information. +set opts "additional_flags=-gt" if { [prepare_for_testing "failed to prepare" ${testfile} \ [list $srcfile] [list $opts nowarnings]] } { return 0 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 50db45d1b14..72aab43228b 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -6733,5 +6733,16 @@ proc cmp_file_string { file str msg } { } } +# Does the compiler support CTF debug output using '-gt' compiler +# flag? +gdb_caching_proc compiler_supports_ctf_debug { + verbose -log "APB: Got here." + return [gdb_can_simple_compile ctfdebug { + int main () { + return 0; + } + } executable "additional_flags=-gt"] +} + # Always load compatibility stuff. load_lib future.exp