From: Tom Tromey Date: Mon, 14 Dec 2020 15:14:06 +0000 (-0700) Subject: Use exact match in get_var_value X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=25a1127be7d6923904b2346ff76e7e9658620bf5;p=binutils-gdb.git Use exact match in get_var_value get_var_value is only used when an exact match is needed. This changes this function to ensure this sort of matching is done. gdb/ChangeLog 2020-12-14 Tom Tromey * ada-lang.c (get_var_value): Only consider exact matches. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f87f6df6578..21a6b9730eb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2020-12-14 Tom Tromey + + * ada-lang.c (get_var_value): Only consider exact matches. + 2020-12-14 Tom Tromey * dwarf2/read.c (rewrite_array_type): New function. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index b41d2bfc614..ca66642dee0 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -11351,14 +11351,16 @@ scan_discrim_bound (const char *str, int k, struct value *dval, LONGEST * px, return 1; } -/* Value of variable named NAME in the current environment. If - no such variable found, then if ERR_MSG is null, returns 0, and +/* Value of variable named NAME. Only exact matches are considered. + If no such variable found, then if ERR_MSG is null, returns 0, and otherwise causes an error with message ERR_MSG. */ static struct value * get_var_value (const char *name, const char *err_msg) { - lookup_name_info lookup_name (name, symbol_name_match_type::FULL); + std::string quoted_name = add_angle_brackets (name); + + lookup_name_info lookup_name (quoted_name, symbol_name_match_type::FULL); std::vector syms; int nsyms = ada_lookup_symbol_list_worker (lookup_name,