+2018-01-05 Pedro Alves <palves@redhat.com>
+
+ PR gdb/22670
+ * ada-lang.c (ada_lookup_encoded_symbol): Reimplement in terms of
+ ada_lookup_symbol.
+ (ada_lookup_symbol): Reimplement in terms of
+ ada_lookup_symbol_list, bits factored out from
+ ada_lookup_encoded_symbol.
+
2018-01-05 Joel Brobecker <brobecker@adacore.com>
* ada-exp.y (write_object_renaming): When subscripting an array
domain_enum domain,
struct block_symbol *info)
{
- struct block_symbol *candidates;
- int n_candidates;
- struct cleanup *old_chain;
-
/* Since we already have an encoded name, wrap it in '<>' to force a
verbatim match. Otherwise, if the name happens to not look like
an encoded name (because it doesn't include a "__"),
std::string verbatim = std::string ("<") + name + '>';
gdb_assert (info != NULL);
- memset (info, 0, sizeof (struct block_symbol));
-
- n_candidates = ada_lookup_symbol_list (verbatim.c_str (), block,
- domain, &candidates);
- old_chain = make_cleanup (xfree, candidates);
-
- if (n_candidates == 0)
- {
- do_cleanups (old_chain);
- return;
- }
-
- *info = candidates[0];
- info->symbol = fixup_symbol_section (info->symbol, NULL);
-
- do_cleanups (old_chain);
+ *info = ada_lookup_symbol (verbatim.c_str (), block, domain, NULL);
}
/* Return a symbol in DOMAIN matching NAME, in BLOCK0 and enclosing
ada_lookup_symbol (const char *name, const struct block *block0,
domain_enum domain, int *is_a_field_of_this)
{
- struct block_symbol info;
-
if (is_a_field_of_this != NULL)
*is_a_field_of_this = 0;
- ada_lookup_encoded_symbol (ada_encode (ada_fold_name (name)),
- block0, domain, &info);
+ struct block_symbol *candidates;
+ int n_candidates;
+ struct cleanup *old_chain;
+
+ n_candidates = ada_lookup_symbol_list (name, block0, domain, &candidates);
+ old_chain = make_cleanup (xfree, candidates);
+
+ if (n_candidates == 0)
+ {
+ do_cleanups (old_chain);
+ return {};
+ }
+
+ block_symbol info = candidates[0];
+ info.symbol = fixup_symbol_section (info.symbol, NULL);
+
+ do_cleanups (old_chain);
+
return info;
}
# The following test exercises the situation when uppercase letters
# are used in the name of the symbol passed to the "info address"
-# command. This should not make a difference, as the language is
-# Ada, and Ada is case-insensitive.
+# command. This should not make a difference, as the language is Ada,
+# and Ada is case-insensitive. Also, exercise both fully-qualified
+# name matching and wild matching.
-# commit b5ec771e60c1a0863e51eb491c85c674097e9e13 (Introduce
-# lookup_name_info and generalize Ada's FULL/WILD name matching)
-# caused the following test to fail. KFAIL it while investigating...
-setup_kfail gdb/22670 "*-*-*"
-gdb_test "info address My_Table" \
- "Symbol \"pck\\.my_table\" is static storage at address $hex\\."
+foreach sym {"my_table" "My_Table" "pck.my_table" "Pck.My_Table"} {
+ gdb_test "info address $sym" \
+ "Symbol \"pck\\.my_table\" is static storage at address $hex\\."
+}