From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway34.websitewelcome.com (gateway34.websitewelcome.com [192.185.148.142]) by sourceware.org (Postfix) with ESMTPS id 6F8063857C70 for ; Thu, 4 Nov 2021 18:09:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6F8063857C70 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 cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 4DA9D578FC17 for ; Thu, 4 Nov 2021 13:09:10 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id ihAkm5vwRgm2UihAkmuW3O; Thu, 04 Nov 2021 13:09:10 -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=9MvvCLv4gbYXN88OY7uUDmAVrKrNU9AL6Byin8lh/Xg=; b=CQhzxrPTy4DjyePLMWbchZ0PH/ i75dEnhs3SeReMWHPnnpRcLdwc8Wx4cd9fwnxFNZdI7BiD4H3jLez4o467rS2duY5aS/jt6OMvdpI 63HaLyrRXM3E68sNDAJIY6Ucu; Received: from 75-166-134-234.hlrn.qwest.net ([75.166.134.234]:51956 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 1mihAj-003Gss-US; Thu, 04 Nov 2021 12:09:10 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 05/32] Allow ada_decode not to decode operators Date: Thu, 4 Nov 2021 12:08:40 -0600 Message-Id: <20211104180907.2360627-6-tom@tromey.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211104180907.2360627-1-tom@tromey.com> References: <20211104180907.2360627-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: 75.166.134.234 X-Source-L: No X-Exim-ID: 1mihAj-003Gss-US X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-134-234.hlrn.qwest.net (localhost.localdomain) [75.166.134.234]:51956 X-Source-Auth: tom+tromey.com X-Email-Count: 10 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3031.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NEUTRAL, TXREP 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, 04 Nov 2021 18:09:13 -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 d964dae42cf..649a1b3f897 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1002,7 +1002,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; @@ -1096,7 +1096,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; @@ -1233,9 +1233,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 0f52ba70649..f3cf9343f05 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -218,8 +218,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