aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2012-02-29 19:51:49 +0000
committerJoel Brobecker <brobecker@gnat.com>2012-02-29 19:51:49 +0000
commit739593e0ec988c02057a16da872b32faa992f657 (patch)
tree5cafa6dbe4e8ad7966769dcd2a63cc7189952078
parent852dff6c6724a3a578e9aad70c2185f7f279782f (diff)
downloadgdb-739593e0ec988c02057a16da872b32faa992f657.zip
gdb-739593e0ec988c02057a16da872b32faa992f657.tar.gz
gdb-739593e0ec988c02057a16da872b32faa992f657.tar.bz2
ada-lang.c:ada_find_renaming_symbol minor improvement.
This is a minor improvement in ada_find_renaming_symbol: What we were doing was going from a symbol, get its name, and then search for renamings. But if the original symbol was already itself a renaming, then we'd look the symbol up again to return it. Since we had the symbol in the first place, we shouldn't need to look it up again. This is what this patch does: Modify ada_find_renaming_symbol to take a symbol instead of the symbol's (linkage) name, and then updates the one caller. gdb/ChangeLog: * ada-lang.h (ada_find_renaming_symbol): Replace parameter "name" with "struct symbol *name_sym". * ada-exp.y (write_var_or_type): Update call to ada_find_renaming_symbol. * ada-lang.c (ada_find_renaming_symbol): Replace parameter "name" with "struct symbol *name_sym". Adjust Implementation accordingly. Adjust the function documentation.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/ada-exp.y3
-rw-r--r--gdb/ada-lang.c15
-rw-r--r--gdb/ada-lang.h2
4 files changed, 21 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ad316c6..c6a6d8f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2012-02-29 Joel Brobecker <brobecker@adacore.com>
+ * ada-lang.h (ada_find_renaming_symbol): Replace parameter
+ "name" with "struct symbol *name_sym".
+ * ada-exp.y (write_var_or_type): Update call to
+ ada_find_renaming_symbol.
+ "name" with "struct symbol *name_sym". Adjust Implementation
+ accordingly. Adjust the function documentation.
+
+2012-02-29 Joel Brobecker <brobecker@adacore.com>
+
* ada-lang.h (ada_find_any_symbol, ada_find_any_type): Delete.
* ada-lang.c (ada_find_any_type): Add advance declaration.
Make static. Replace ada_find_any_symbol by
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index d1c7367..226cc1d 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -1288,8 +1288,7 @@ write_var_or_type (struct block *block, struct stoken name0)
if (nsyms == 1)
{
struct symbol *ren_sym =
- ada_find_renaming_symbol (SYMBOL_LINKAGE_NAME (syms[0].sym),
- syms[0].block);
+ ada_find_renaming_symbol (syms[0].sym, syms[0].block);
if (ren_sym != NULL)
syms[0].sym = ren_sym;
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index c5d5ff7..349ca17 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -7054,16 +7054,21 @@ ada_find_any_type (const char *name)
return NULL;
}
-/* Given NAME and an associated BLOCK, search all symbols for
- NAME suffixed with "___XR", which is the ``renaming'' symbol
- associated to NAME. Return this symbol if found, return
- NULL otherwise. */
+/* Given NAME_SYM and an associated BLOCK, find a "renaming" symbol
+ associated with NAME_SYM's name. NAME_SYM may itself be a renaming
+ symbol, in which case it is returned. Otherwise, this looks for
+ symbols whose name is that of NAME_SYM suffixed with "___XR".
+ Return symbol if found, and NULL otherwise. */
struct symbol *
-ada_find_renaming_symbol (const char *name, struct block *block)
+ada_find_renaming_symbol (struct symbol *name_sym, struct block *block)
{
+ const char *name = SYMBOL_LINKAGE_NAME (name_sym);
struct symbol *sym;
+ if (strstr (name, "___XR") != NULL)
+ return name_sym;
+
sym = find_old_style_renaming_symbol (name, block);
if (sym != NULL)
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index abf9c53..fd7b0df 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -333,7 +333,7 @@ extern struct type *ada_find_parallel_type (struct type *,
extern LONGEST get_int_var_value (char *, int *);
-extern struct symbol *ada_find_renaming_symbol (const char *name,
+extern struct symbol *ada_find_renaming_symbol (struct symbol *name_sym,
struct block *block);
extern int ada_prefer_type (struct type *, struct type *);