public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Allow ada_decode not to decode operators
@ 2022-04-12 15:39 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2022-04-12 15:39 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5c94f93871a094ab4bce2f3c49ccdc8ae322e277

commit 5c94f93871a094ab4bce2f3c49ccdc8ae322e277
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Jun 5 09:24:52 2021 -0600

    Allow ada_decode not to decode operators
    
    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.

Diff:
---
 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 ffe35500d68..7623d0eb48d 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -1304,7 +1304,7 @@ convert_from_hex_encoded (std::string &out, const char *str, int n)
 /* See ada-lang.h.  */
 
 std::string
-ada_decode (const char *encoded, bool wrap)
+ada_decode (const char *encoded, bool wrap, bool operators)
 {
   int i;
   int len0;
@@ -1399,7 +1399,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;
 
@@ -1558,9 +1558,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 a6caf35b826..0dcdb56c198 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<struct block_symbol> ada_lookup_symbol_list
      (const char *, const struct block *, domain_enum);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-12 15:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 15:39 [binutils-gdb] Allow ada_decode not to decode operators Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).