This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/gdb-8.1-branch] Fix gdb.ada/info_addr_mixed_case.exp (PR gdb/22670)


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

commit 7a19098f86ba3a4abfeb4dff33e2a1929f6fbaa8
Author: Pedro Alves <palves@redhat.com>
Date:   Fri Jan 5 16:05:34 2018 +0000

    Fix gdb.ada/info_addr_mixed_case.exp (PR gdb/22670)
    
    The comments about mixed case in the testcase are actually a red
    herring.  The problem here is that we'd get to
    ada_lookup_encoded_symbol with "my_table", which wraps the looked up
    name in "<>"s to force a verbatim match, and that in turn disables
    wild matching.
    
    Fix this by swapping around the internals of ada_lookup_encoded_symbol
    and ada_lookup_symbol, thus avoiding the encoding and
    verbatim-wrapping in the ada_lookup_symbol case, the case that starts
    with a user-provided lookup name.
    
    Ada encoding is still done of course, in the ada_lookup_name_info
    ctor.  This could be also seen as avoiding the double-encoding problem
    in a different way.
    
    gdb/ChangeLog:
    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.
    
    gdb/testsuite/ChangeLog:
    2018-01-05  Pedro Alves  <palves@redhat.com>
    
    	PR gdb/22670
    	* gdb.ada/info_addr_mixed_case.exp: Remove kfail.  Extend test to
    	exercise lower case too, and to exercise both full matching and
    	wild matching.

Diff:
---
 gdb/ChangeLog                                  |  9 ++++++
 gdb/ada-lang.c                                 | 43 ++++++++++++--------------
 gdb/testsuite/ChangeLog                        |  7 +++++
 gdb/testsuite/gdb.ada/info_addr_mixed_case.exp | 15 +++++----
 4 files changed, 42 insertions(+), 32 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ab7ce4e..1c7c08a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+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>
 
 	GDB 8.1 branch created (5219ac6237c272b938c28517bf371429260c71e7):
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 4ecf7b0..5f03014 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -5911,10 +5911,6 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
 			   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 "__"),
@@ -5924,22 +5920,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
   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
@@ -5952,13 +5933,27 @@ struct block_symbol
 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;
 }
 
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index ea9d65c..35bf048 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2018-01-05  Pedro Alves  <palves@redhat.com>
+
+	PR gdb/22670
+	* gdb.ada/info_addr_mixed_case.exp: Remove kfail.  Extend test to
+	exercise lower case too, and to exercise both full matching and
+	wild matching.
+
 2018-01-04  Joel Brobecker  <brobecker@adacore.com>
 
 	PR gdb/22670
diff --git a/gdb/testsuite/gdb.ada/info_addr_mixed_case.exp b/gdb/testsuite/gdb.ada/info_addr_mixed_case.exp
index e9fce0d..7840a43 100644
--- a/gdb/testsuite/gdb.ada/info_addr_mixed_case.exp
+++ b/gdb/testsuite/gdb.ada/info_addr_mixed_case.exp
@@ -31,12 +31,11 @@ if ![runto "foo.adb:$bp_location" ] then {
 
 # 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\\."
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]