From patchwork Sat Nov 17 12:04:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 30177 Received: (qmail 32880 invoked by alias); 17 Nov 2018 12:05:00 -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 32745 invoked by uid 89); 17 Nov 2018 12:05:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mailsec112.isp.belgacom.be Received: from mailsec112.isp.belgacom.be (HELO mailsec112.isp.belgacom.be) (195.238.20.108) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 17 Nov 2018 12:04:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1542456299; x=1573992299; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RQgt7Zckx6w/K7G/4iUmx2iNRJVufaWT5fDE1Nzv0Vo=; b=W9mIVDH8FPJLxBH+a/5VVnCv8bxHyb3qsNzvZaeEErsHrzSDB3VJDtyo 8RS4j3ImTtViZvE9lvHqv9ys/2i5+A==; Received: from 110.212-243-81.adsl-dyn.isp.belgacom.be (HELO md.home) ([81.243.212.110]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 17 Nov 2018 13:04:51 +0100 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFAv2 2/5] Use scoped_switch_to_sym_language_if_auto in symtab.c to switch language. Date: Sat, 17 Nov 2018 13:04:42 +0100 Message-Id: <20181117120445.10805-3-philippe.waroquiers@skynet.be> In-Reply-To: <20181117120445.10805-1-philippe.waroquiers@skynet.be> References: <20181117120445.10805-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-IsSubscribed: yes Use scoped_switch_to_sym_language_if_auto in treg_matches_sym_type_name to replace the local logic that was doing the same as the new class scoped_switch_to_sym_language_if_auto. Use scoped_switch_to_sym_language_if_auto inside print_symbol_info, so that symbol information is printed in the symbol language when language mode is auto. This modifies the behaviour of the test dw2-case-insensitive.exp, as the function FUNC_lang is now printed with the Fortran syntax (as declared in the .S file). gdb/ChangeLog 2018-11-17 Philippe Waroquiers * symtab.c (treg_matches_sym_type_name): Use scoped_switch_to_sym_language_if_auto instead of local logic. (print_symbol_info): Use scoped_switch_to_sym_language_if_auto to switch to SYM language when language mode is auto. gdb/testsuite/ChangeLog 2018-11-17 Philippe Waroquiers * gdb.dwarf2/dw2-case-insensitive.exp: Update due to auto switch to FUNC_lang language syntax. --- gdb/symtab.c | 12 +++++------- gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp | 4 +++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gdb/symtab.c b/gdb/symtab.c index 2e9e6325ad..9fbf54a78f 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4288,15 +4288,12 @@ treg_matches_sym_type_name (const compiled_regex &treg, if (sym_type == NULL) return false; - if (language_mode == language_mode_auto) - { - scoped_restore_current_language l; + { + scoped_switch_to_sym_language_if_auto l (sym); - set_language (SYMBOL_LANGUAGE (sym)); - printed_sym_type_name = type_to_string (sym_type); - } - else printed_sym_type_name = type_to_string (sym_type); + } + if (symbol_lookup_debug > 1) { @@ -4601,6 +4598,7 @@ print_symbol_info (enum search_domain kind, struct symbol *sym, int block, const char *last) { + scoped_switch_to_sym_language_if_auto l (sym); struct symtab *s = symbol_symtab (sym); if (last != NULL) diff --git a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp index b15dcafa00..328facd64e 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp @@ -42,8 +42,10 @@ gdb_test "info functions fUnC_lang" \ gdb_test "set case-sensitive off" {warning: the current case sensitivity setting does not match the language\.} # The dot-leading symbol is for ppc64 function descriptors. +# Note that info functions gives the FUNC_lang result using the fortran syntax +# as specified in dw-case-insensitive-debug.S DW_AT_language. gdb_test "info functions fUnC_lang" \ - "All functions matching regular expression \"fUnC_lang\":\[\r\n\]+File file1.txt:\r\n\tfoo FUNC_lang\\(void\\);(\r\n\r\nNon-debugging symbols:\r\n0x\[0-9a-f\]+ +\\.FUNC_lang)?" \ + "All functions matching regular expression \"fUnC_lang\":\[\r\n\]+File file1.txt:\r\n\tfoo FUNC_lang\\(\\);(\r\n\r\nNon-debugging symbols:\r\n0x\[0-9a-f\]+ +\\.FUNC_lang)?" \ "regexp case-sensitive off" gdb_test "p fuNC_lang" { = {foo \(void\)} 0x[0-9a-f]+ }