Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] regresssion(internal-error) printing subprogram argument
Date: Fri, 15 Dec 2017 18:57:00 -0000	[thread overview]
Message-ID: <07a154ef-b6f5-ad86-1410-a73620de4b5b@redhat.com> (raw)
In-Reply-To: <00320239-44c8-b9c3-013b-b27c771e3401@redhat.com>

On 12/15/2017 11:02 AM, Pedro Alves wrote:
> Hi Joel,
> 
> I woke up realizing that I completely forgot that psymbols have no
> overload/function parameter info in C++, so a straight strcmp probably
> doesn't work properly for C++.  Indeed, I remembered now to do
> "maint check-psymtabs" when debugging gdb, and I get back a few
> problems:
> 
> (top-gdb) maint check-psymtabs 
> Global symbol `__gnu_cxx::operator!=<symtab_and_line*, std::vector<symtab_and_line> >' only found in src/gdb/cli/cli-cmds.c psymtab
> Global symbol `__gnu_cxx::operator-<const symtab_and_line*, std::vector<symtab_and_line> >' only found in src/gdb/cli/cli-cmds.c psymtab
> [...]
> 
> Maybe what we need is to be a little less aggressive then and
> add a new symbol_name_match_type::SEARCH_SYMBOL instead that takes as
> input a non-user-input search symbol like symbol_name_match_type::LITERAL
> was, and then we skip any decoding/demangling steps (like LITERAL) and make:
>   - Ada treat that as a verbatim match,
>   - other languages treat it as symbol_name_match_type::FULL.
> 
> I can't look at this right now, though I'll try to play with it a bit
> more later today.  I'm a bit worried on timing since I'm going to be
> away next week (today's my last official day before xmas holiday).  :-/
> 

Errr, it turns out that I had done the above on the wrong branch...
I get the above output even if I use the system gdb (7.10) to debug
the new gdb, and then do "maint check-psymtabs".  So those are not
a regression.

However, (as suspected) with the LITERAL patch things indeed got
worse for C++:

Global symbol `error' only found in src/gdb/common/errors.c psymtab
Global symbol `internal_error' only found in src/gdb/common/errors.c psymtab
Global symbol `internal_warning' only found in src/gdb/common/errors.c psymtab
Global symbol `warning' only found in src/gdb/common/errors.c psymtab
Static symbol `info_command' only found in src/gdb/cli/cli-cmds.c psymtab
Static symbol `show_command' only found in src/gdb/cli/cli-cmds.c psymtab
Static symbol `help_command' only found in src/gdb/cli/cli-cmds.c psymtab
Static symbol `complete_command' only found in src/gdb/cli/cli-cmds.c psymtab
Static symbol `show_version' only found in src/gdb/cli/cli-cmds.c psymtab
Static symbol `show_configuration' only found in src/gdb/cli/cli-cmds.c psymtab
Static symbol `pwd_command' only found in src/gdb/cli/cli-cmds.c psymtab
Static symbol `show_script_ext_mode' only found in src/gdb/cli/cli-cmds.c psymtab
Static symbol `source_script_from_stream' only found in src/gdb/cli/cli-cmds.c psymtab
[...many more...]

With the patch below applied on top, which is a minimal version of
the design change I suggested (LITERAL -> SEARCH_SYMBOL), I now get
again the same "maint check-psymtabs" output that I get with system gdb.
So seems like this is on the good track.

Your internal-error test still passes as well as the new
"maint check-psymtabs" for gdb.ada/ testcase.

I've pushed the current state to users/palves/literal-matching.

I probably won't be able to look at this more today.

From 6b4025034b0b0e8b2511e4c355365c9ff69be822 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Fri, 15 Dec 2017 17:46:56 +0000
Subject: [PATCH] Move literal matching to Ada

---
 gdb/ada-lang.c   |  8 ++++++++
 gdb/cp-support.c |  1 +
 gdb/language.c   |  9 +++------
 gdb/symtab.c     | 12 ++++++++----
 4 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 9e637eb..5f4e255 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -14065,12 +14065,20 @@ ada_symbol_name_matches (const char *symbol_search_name,
 				     comp_match_res);
 }
 
+bool
+literal_symbol_name_matcher (const char *symbol_search_name,
+			     const lookup_name_info &lookup_name,
+			     completion_match_result *comp_match_res);
+
 /* Implement the "la_get_symbol_name_matcher" language_defn method for
    Ada.  */
 
 static symbol_name_matcher_ftype *
 ada_get_symbol_name_matcher (const lookup_name_info &lookup_name)
 {
+  if (lookup_name.match_type () == symbol_name_match_type::LITERAL)
+    return literal_symbol_name_matcher;
+
   if (lookup_name.completion_mode ())
     return ada_symbol_name_matches;
   else
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 34a8439..7c14423 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -1793,6 +1793,7 @@ cp_get_symbol_name_matcher (const lookup_name_info &lookup_name)
     {
     case symbol_name_match_type::FULL:
     case symbol_name_match_type::EXPRESSION:
+    case symbol_name_match_type::LITERAL:
       return cp_fq_symbol_name_matches;
     case symbol_name_match_type::WILD:
       return cp_symbol_name_matches;
diff --git a/gdb/language.c b/gdb/language.c
index 5bcdfb9..44afdef 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -727,7 +727,7 @@ default_symbol_name_matcher (const char *symbol_search_name,
 /* A name matcher that matches the symbol name exactly, with
    strcmp.  */
 
-static bool
+bool
 literal_symbol_name_matcher (const char *symbol_search_name,
 			     const lookup_name_info &lookup_name,
 			     completion_match_result *comp_match_res)
@@ -753,13 +753,10 @@ symbol_name_matcher_ftype *
 language_get_symbol_name_matcher (const language_defn *lang,
 				  const lookup_name_info &lookup_name)
 {
-  if (lookup_name.match_type () == symbol_name_match_type::LITERAL)
-    return literal_symbol_name_matcher;
-
   if (lang->la_get_symbol_name_matcher != nullptr)
     return lang->la_get_symbol_name_matcher (lookup_name);
-
-  return default_symbol_name_matcher;
+  else
+    return default_symbol_name_matcher;
 }
 
 /* Define the language that is no language.  */
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 78018a1..6957757 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1775,14 +1775,18 @@ demangle_for_lookup_info::demangle_for_lookup_info
 
       if (without_params != NULL)
 	{
-	  m_demangled_name = demangle_for_lookup (without_params.get (),
-						  lang, storage);
+	  if (lookup_name.match_type () != symbol_name_match_type::LITERAL)
+	    m_demangled_name = demangle_for_lookup (without_params.get (),
+						    lang, storage);
 	  return;
 	}
     }
 
-  m_demangled_name = demangle_for_lookup (lookup_name.name ().c_str (),
-					  lang, storage);
+  if (lookup_name.match_type () == symbol_name_match_type::LITERAL)
+    m_demangled_name = lookup_name.name ();
+  else
+    m_demangled_name = demangle_for_lookup (lookup_name.name ().c_str (),
+					    lang, storage);
 }
 
 /* See symtab.h.  */
-- 
2.5.5



  reply	other threads:[~2017-12-15 18:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-13 10:37 Joel Brobecker
2017-12-14 19:02 ` Pedro Alves
2017-12-14 19:41   ` Pedro Alves
2017-12-15  9:48     ` Joel Brobecker
2017-12-15 11:02       ` Pedro Alves
2017-12-15 18:57         ` Pedro Alves [this message]
2018-01-03  4:33           ` Joel Brobecker
2018-01-04  9:48             ` Joel Brobecker
2018-01-04 12:39               ` Pedro Alves
2018-01-05 16:28             ` Pedro Alves
2018-01-16 11:54               ` Pedro Alves
2018-01-17  9:13                 ` Joel Brobecker
2018-01-26  3:51                   ` Joel Brobecker
2018-01-26 11:28                     ` Pedro Alves
2018-01-29 10:38                       ` Joel Brobecker
     [not found]                         ` <250976c6-6e7a-6a8e-b9f2-a57f5b92b965@redhat.com>
2018-01-30  3:56                           ` Joel Brobecker
2018-02-05  9:57                             ` Joel Brobecker
2018-02-09  9:09                               ` [RFA/RFC] fix PR gdb/22670 (pb looking up some symbols when they have a linkage name) (was: "Re: [RFC] regresssion(internal-error) printing subprogram argument") Joel Brobecker
2018-02-21  3:02                                 ` PING: " Joel Brobecker
2018-03-19 21:22                                   ` PING^2: " Joel Brobecker
2018-03-26 14:26                                     ` PING^2: [RFA/RFC] fix PR gdb/22670 (pb looking up some symbols when they have a linkage name) Pedro Alves
2018-03-27 14:02                                       ` Joel Brobecker
2018-01-26  4:50                   ` [RFC] regresssion(internal-error) printing subprogram argument Joel Brobecker
2017-12-15 18:31       ` Pedro Alves
2017-12-15  7:54   ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=07a154ef-b6f5-ad86-1410-a73620de4b5b@redhat.com \
    --to=palves@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox