From patchwork Sat Jul 27 16:22:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 33833 Received: (qmail 30025 invoked by alias); 27 Jul 2019 16:23:01 -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 29943 invoked by uid 89); 27 Jul 2019 16:23:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=appearing X-HELO: mail-wm1-f65.google.com Received: from mail-wm1-f65.google.com (HELO mail-wm1-f65.google.com) (209.85.128.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 27 Jul 2019 16:22:58 +0000 Received: by mail-wm1-f65.google.com with SMTP id s3so50335558wms.2 for ; Sat, 27 Jul 2019 09:22:58 -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=O6MFF8NAWumPmlHmdd7aYJdHs9YJPGOvecwGvPbKM1I=; b=GyRitLCU6wLdW8Qdl7JCKFG4xrhDcpfJqZCnJwNrrmF2oq8RVWgRySKUSQkO1cugAC xd0IwjTHv7/UBN+Pd8BVq3Kt4y5W2kvr0GdVjQlGqcyA0Gg4gi7AC4vd/z7q5DUQpj2i Yr5dZJgPiP4SJHXZjjnW5exqxRR/qZ7BDJhFU2CBiULjZnGLeFJIRmD1PreAf3SXYAzG +ZZifvpWCYJjiHvEbqsWnEC7ZFhJeEuIJ8p7KbBP+vwbTNNy7i/sCr8DA4CJKJ7bwr/C FTc8OJH+oXB6wkWlXhipZ6MDSYtx3X+kqvfPPdJKmZvsYx9TSUebamLoKdTbtpRo+JQv mOZA== Return-Path: Received: from localhost (188.29.165.26.threembb.co.uk. [188.29.165.26]) by smtp.gmail.com with ESMTPSA id f3sm39207711wrt.56.2019.07.27.09.22.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 27 Jul 2019 09:22:56 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Richard Bunt , Andrew Burgess Subject: [PATCH 5/7] gdb/fortran: Don't include module symbols when searching for types Date: Sat, 27 Jul 2019 17:22:33 +0100 Message-Id: <5184ae288c08432d0e873fd48b8c56619e3d2699.1564243858.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes Currently the 'info types' command will return symbols that correspond to Fortran modules. This because the symbols are created with domain MODULE_DOMAIN, but address_class LOC_TYPEDEF, which is the same address_class as type symbols. This commit explicitly prevents MODULE_DOMAIN symbols from appearing when we search for symbols in the TYPES_DOMAIN, this prevents the module symbols from appearing in the output of 'info types'. gdb/ChangeLog: * symtab.c (search_symbols): Don't include MODULE_DOMAIN symbols when searching for types. gdb/testsuite/ChangeLog: * gdb.fortran/info-types.exp: Add module. * gdb.fortran/info-types.f90: Update expected results. --- gdb/ChangeLog | 5 +++++ gdb/symtab.c | 3 ++- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.fortran/info-types.exp | 4 +++- gdb/testsuite/gdb.fortran/info-types.f90 | 11 +++++++++++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/gdb/symtab.c b/gdb/symtab.c index 84038d15dff..d3a209608b7 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4539,7 +4539,8 @@ search_symbols (const char *regexp, enum search_domain kind, || treg_matches_sym_type_name (*treg, sym))) || (kind == TYPES_DOMAIN - && SYMBOL_CLASS (sym) == LOC_TYPEDEF)))) + && SYMBOL_CLASS (sym) == LOC_TYPEDEF + && SYMBOL_DOMAIN (sym) != MODULE_DOMAIN)))) { /* match */ result.emplace_back (i, sym); diff --git a/gdb/testsuite/gdb.fortran/info-types.exp b/gdb/testsuite/gdb.fortran/info-types.exp index 9571dc45593..81e67395e8a 100644 --- a/gdb/testsuite/gdb.fortran/info-types.exp +++ b/gdb/testsuite/gdb.fortran/info-types.exp @@ -42,4 +42,6 @@ gdb_test "info types" \ "\[\t \]+${character1}" \ "\[\t \]+${integer4}" \ "\[\t \]+${logical4}" \ - "16:\[\t \]+Type s1;" ] + "20:\[\t \]+Type __vtype_mod1_M1t1;" \ + "17:\[\t \]+Type m1t1;" \ + "22:\[\t \]+Type s1;" ] diff --git a/gdb/testsuite/gdb.fortran/info-types.f90 b/gdb/testsuite/gdb.fortran/info-types.f90 index 21c9d9df63c..0e27e1ddf08 100644 --- a/gdb/testsuite/gdb.fortran/info-types.f90 +++ b/gdb/testsuite/gdb.fortran/info-types.f90 @@ -13,13 +13,24 @@ ! You should have received a copy of the GNU General Public License ! along with this program. If not, see . +module mod1 + type :: m1t1 + integer :: b + end type m1t1 +end module mod1 + program info_types_test + use mod1 + type :: s1 integer :: a end type s1 logical :: l type (s1) :: var_a + type (m1t1) :: var_b + var_a%a = 1 + var_b%b = 2 l = .FALSE. end program info_types_test