aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/ada-lang.c10
-rw-r--r--gdb/ada-lang.h7
3 files changed, 16 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 820a9d3..9d56f1c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2021-06-25 Tom Tromey <tromey@adacore.com>
+
+ * ada-lang.c (ada_decode): Add wrap parameter.
+ * ada-lang.h (ada_decode): Add wrap parameter.
+
2021-06-25 Luis Machado <luis.machado@linaro.org>
* corelow.c (core_target::core_target) Update to read target
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 6ed6b65..49a7d5b 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -976,12 +976,10 @@ ada_remove_po_subprogram_suffix (const char *encoded, int *len)
*len = *len - 1;
}
-/* If ENCODED follows the GNAT entity encoding conventions, then return
- the decoded form of ENCODED. Otherwise, return "<%s>" where "%s" is
- replaced by ENCODED. */
+/* See ada-lang.h. */
std::string
-ada_decode (const char *encoded)
+ada_decode (const char *encoded, bool wrap)
{
int i, j;
int len0;
@@ -1216,12 +1214,14 @@ ada_decode (const char *encoded)
return decoded;
Suppress:
+ if (!wrap)
+ return {};
+
if (encoded[0] == '<')
decoded = encoded;
else
decoded = '<' + std::string(encoded) + '>';
return decoded;
-
}
/* Table for keeping permanent unique copies of decoded names. Once
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 156c9b0..a89ed29 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -216,7 +216,12 @@ extern struct type *ada_get_decoded_type (struct type *type);
extern const char *ada_decode_symbol (const struct general_symbol_info *);
-extern std::string ada_decode (const char*);
+/* Decode the GNAT-encoded name NAME, returning the decoded name. If
+ 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);
extern std::vector<struct block_symbol> ada_lookup_symbol_list
(const char *, const struct block *, domain_enum);