From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway22.websitewelcome.com (gateway22.websitewelcome.com [192.185.47.144]) by sourceware.org (Postfix) with ESMTPS id 0131E3858405 for ; Thu, 26 Aug 2021 02:19:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0131E3858405 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tromey.com Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway22.websitewelcome.com (Postfix) with ESMTP id A11243B8A for ; Wed, 25 Aug 2021 21:19:40 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id J4zUmVjjUjSwzJ4zUmrmqz; Wed, 25 Aug 2021 21:19:40 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=hBC66YdlJurNWw6Tury0j2fjjpbnYXTlKWR4wJVa+ls=; b=c2D+JIsdyrwVbEJ43ZR4FQbH7z UC5Q9fyKu2eW0npa4jT2OwjbhJ5vPMeYFpkxjFn715BuTqfSVCudtdJmoQxGu4vZyqo73DHpM8mer KdLLwt71PKiZNZm1IWU7dnQIV; Received: from 97-122-86-84.hlrn.qwest.net ([97.122.86.84]:46876 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mJ4zU-003LSg-Di; Wed, 25 Aug 2021 20:19:40 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 05/30] Allow ada_decode not to decode operators Date: Wed, 25 Aug 2021 20:19:12 -0600 Message-Id: <20210826021937.1490292-6-tom@tromey.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826021937.1490292-1-tom@tromey.com> References: <20210826021937.1490292-1-tom@tromey.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.86.84 X-Source-L: No X-Exim-ID: 1mJ4zU-003LSg-Di X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-86-84.hlrn.qwest.net (localhost.localdomain) [97.122.86.84]:46876 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3030.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SBL_CSS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP, URIBL_CSS_A autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Aug 2021 02:19:50 -0000 The new DWARF scanner records names as they appear in DWARF. However, because Ada is unusual, it also decodes the Ada names to synthesize package components for them. In order for this to work out properly, gdb also needs a mode where ada_decode can be instructed not to decode Ada operator names. That is what this patch implements. --- gdb/ada-lang.c | 13 ++++++++----- gdb/ada-lang.h | 6 ++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 6680a4fd657..a44983ef54b 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1020,7 +1020,7 @@ remove_compiler_suffix (const char *encoded, int *len) /* See ada-lang.h. */ std::string -ada_decode (const char *encoded, bool wrap) +ada_decode (const char *encoded, bool wrap, bool operators) { int i, j; int len0; @@ -1114,7 +1114,7 @@ ada_decode (const char *encoded, bool wrap) while (i < len0) { /* Is this a symbol function? */ - if (at_start_name && encoded[i] == 'O') + if (operators && at_start_name && encoded[i] == 'O') { int k; @@ -1251,9 +1251,12 @@ ada_decode (const char *encoded, bool wrap) /* Decoded names should never contain any uppercase character. Double-check this, and abort the decoding if we find one. */ - for (i = 0; i < decoded.length(); ++i) - if (isupper (decoded[i]) || decoded[i] == ' ') - goto Suppress; + if (operators) + { + for (i = 0; i < decoded.length(); ++i) + if (isupper (decoded[i]) || decoded[i] == ' ') + goto Suppress; + } /* If the compiler added a suffix, append it now. */ if (suffix >= 0) diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index a89ed29119a..d3f9b643fb2 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -220,8 +220,10 @@ extern const char *ada_decode_symbol (const struct general_symbol_info *); the name does not appear to be GNAT-encoded, then the result depends on WRAP. If WRAP is true (the default), then the result is simply wrapped in <...>. If WRAP is false, then the empty string - will be returned. */ -extern std::string ada_decode (const char *name, bool wrap = true); + will be returned. Also, when OPERATORS is false, operator names + will not be decoded. */ +extern std::string ada_decode (const char *name, bool wrap = true, + bool operators = true); extern std::vector ada_lookup_symbol_list (const char *, const struct block *, domain_enum); -- 2.31.1