From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76985 invoked by alias); 4 Sep 2017 09:58:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 76647 invoked by uid 89); 4 Sep 2017 09:58:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:209.85.128.193, H*RU:209.85.128.193, unions, pdi X-HELO: mail-wr0-f193.google.com Received: from mail-wr0-f193.google.com (HELO mail-wr0-f193.google.com) (209.85.128.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Sep 2017 09:58:20 +0000 Received: by mail-wr0-f193.google.com with SMTP id z4so33945wrb.1 for ; Mon, 04 Sep 2017 02:58:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=/EOT+CwrDoi4VypnUZcHmqRRWuUDYUBCfg7di07XyUA=; b=HSU5V1osMFAmqqZHeSEQcjTEBug0CPw/R7aPIf55GOHebcZStYnXJ6zEkeSwr2W/wd Q5e8rpBizlSwFg25WSq5FRHHmPBCtDNDTVnZGRNUiVq1y51TsTdpdWuaNl6Y17yLJmz7 /5wSHOx0bD7gcMRwbiUK4Do7jGE7+in8EaVdDvO6nmfSub540t1JduGYn+Y+eLRCJuyn Evw4sZ3MczzYm4FEl8b0xONrhhZGqV0JN2m2za36EAixu3ft09D6q0DhQuEdIht7Jo5S 9CpeqD9dB0bfGWGnIo8aX1mvj6aYrTyAmInz95AankHrlmQy0pv7Rc0uD8wIYAu251n0 SkzA== X-Gm-Message-State: AHPjjUgQ2hKxC5LmGEgbGiw/jLGkmIMkvbpwl1N3wJ3vCf/j3ibQ4T31 XRDCPh9tLTXAMrbc X-Google-Smtp-Source: ADKCNb6IgfJF1PNGFFwxqg7nrjqJIyhKGgvBpUTy7o7CyS+FGPJicVTs1OyxiSNj8Ro1BrlIM8YY8Q== X-Received: by 10.223.128.165 with SMTP id 34mr5530177wrl.209.1504519098123; Mon, 04 Sep 2017 02:58:18 -0700 (PDT) Received: from 1170ee0b50d5 (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id g70sm11575816wrd.4.2017.09.04.02.58.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Sep 2017 02:58:17 -0700 (PDT) Date: Mon, 04 Sep 2017 09:58:00 -0000 From: Yao Qi To: Tim Wiederhake Cc: gdb-patches@sourceware.org, Bernhard Heckel Subject: Re: [PATCH v3 6/6] Fortran: Nested functions, add scope parameter. Message-ID: <20170904095816.GB8425@1170ee0b50d5> References: <1502449611-8865-1-git-send-email-tim.wiederhake@intel.com> <1502449611-8865-7-git-send-email-tim.wiederhake@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1502449611-8865-7-git-send-email-tim.wiederhake@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00032.txt.bz2 On 17-08-11 13:06:51, Tim Wiederhake wrote: > From: Bernhard Heckel > > In order to avoid name clashing in GDB, we add a scope > to nested subroutines. Enveloping function gives the > scope. Hi Tim, Is there any reason that you split it from patch #5? IMO, both #5 and #6 should be a single patch, and we need a NEWS entry. According to your patch #5, I think both Ada and Fortran have the similar feature here. I think we need to keep semantics same in both languages, like, "break func::nest_func"? > > --- > gdb/doc/gdb.texinfo | 3 ++ > gdb/dwarf2read.c | 26 +++++++++++- > gdb/testsuite/gdb.fortran/nested-funcs.exp | 28 +++++++++++-- > gdb/testsuite/gdb.fortran/nested-funcs.f90 | 66 ++++++++++++++++++++++++++++-- > 4 files changed, 114 insertions(+), 9 deletions(-) > mode change 100755 => 100644 gdb/testsuite/gdb.fortran/nested-funcs.f90 > > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index d098eba..983a570 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -15259,6 +15259,9 @@ The access component operator. Normally used to access elements in derived > types. Also suitable for unions. As unions aren't part of regular Fortran, > this can only happen when accessing a register that uses a gdbarch-defined > union type. > +@item :: > +The scope operator. Normally used to access variables in modules or to set > +breakpoints on subroutines nested in modules or in other (internal) subroutines. > @end table > > @node Fortran Defaults > diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c > index 894e6a0..92a9c49 100644 > --- a/gdb/dwarf2read.c > +++ b/gdb/dwarf2read.c > @@ -7042,6 +7042,7 @@ partial_die_parent_scope (struct partial_die_info *pdi, > return NULL; > } > > + /* Internal (nested) subroutines in Fortran get a prefix. */ > if (pdi->tag == DW_TAG_enumerator) > /* Enumerators should not get the name of the enumeration as a prefix. */ > parent->scope = grandparent_scope; > @@ -7051,7 +7052,10 @@ partial_die_parent_scope (struct partial_die_info *pdi, > || parent->tag == DW_TAG_class_type > || parent->tag == DW_TAG_interface_type > || parent->tag == DW_TAG_union_type > - || parent->tag == DW_TAG_enumeration_type) > + || parent->tag == DW_TAG_enumeration_type > + || (cu->language == language_fortran > + && parent->tag == DW_TAG_subprogram > + && pdi->tag == DW_TAG_subprogram)) > { > if (grandparent_scope == NULL) > parent->scope = parent->name; > @@ -8560,8 +8564,13 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) > case DW_TAG_type_unit: > read_type_unit_scope (die, cu); > break; > - case DW_TAG_entry_point: > case DW_TAG_subprogram: > + /* Internal subprograms in Fortran get a prefix. */ > + if (cu->language == language_fortran > + && die->parent != NULL > + && die->parent->tag == DW_TAG_subprogram) > + cu->processing_has_namespace_info = 1; We need some fall-through annotation to suppress warning in GCC 7. > + case DW_TAG_entry_point: > case DW_TAG_inlined_subroutine: > read_func_scope (die, cu); > break; > @@ -20169,6 +20178,19 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu) > return TYPE_TAG_NAME (parent_type); > return ""; > } > + case DW_TAG_subprogram: > + /* Only internal subroutines in Fortran get a prefix with the name > + of the parent's subroutine. */ > + if (cu->language == language_fortran) > + { > + if ((die->tag == DW_TAG_subprogram) > + && (dwarf2_name (parent, cu) != NULL)) > + return dwarf2_name (parent, cu); > + else > + return ""; > + } > + else > + return determine_prefix (parent, cu); > /* Fall through. */ > default: > return determine_prefix (parent, cu); > diff --git a/gdb/testsuite/gdb.fortran/nested-funcs.exp b/gdb/testsuite/gdb.fortran/nested-funcs.exp > index 4c2ee2a..0c8a416 100644 > --- a/gdb/testsuite/gdb.fortran/nested-funcs.exp > +++ b/gdb/testsuite/gdb.fortran/nested-funcs.exp > @@ -31,8 +31,8 @@ if ![runto MAIN__] then { > } > > # Test if we can set a breakpoint in a nested function > -gdb_breakpoint "sub_nested_outer" > -gdb_continue_to_breakpoint "sub_nested_outer" ".*local_int = 19" > +gdb_breakpoint "testnestedfuncs::sub_nested_outer" > +gdb_continue_to_breakpoint "testnestedfuncs::sub_nested_outer" ".*local_int = 19" > > # Test if we can access local and > # non-local variables defined one level up. > @@ -43,13 +43,16 @@ gdb_test "set index = 42" > gdb_test "print index" "= 42" "print index at BP_outer, manipulated" > gdb_test "print local_int" "= 19" "print local_int in outer function" > > + Unnecessary change, multiple instances. > # Non-local variable should be affected in one frame up as well. > gdb_test "up" -- Yao (齐尧)