Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Hannes Domani via gdb" <gdb@sourceware.org>
To: GDB Development <gdb@sourceware.org>
Subject: Fw: question about expand_symtabs_matching()
Date: Sat, 09 Mar 2019 00:18:00 -0000	[thread overview]
Message-ID: <598470969.3054035.1552090704729@mail.yahoo.com> (raw)
In-Reply-To: <605876742.3053854.1552089304851@mail.yahoo.com>

[-- Attachment #1: Type: text/plain, Size: 1140 bytes --]

Am Freitag, 8. März 2019, 22:13:52 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:

> >>>>> "Hannes" == Hannes Domani via gdb <gdb@sourceware.org> writes:
> 
> Hannes> For the case of 'b some_function', with the application I'm testing:
> Hannes> - startup time with the call of cp_canonicalize_string_no_typedefs(): 1m 25s
> Hannes> - startup time without this call: 27s
> 
> Wow.
> 
> Hannes> In my personal build I've changed this:
> Hannes> - only call cp_canonicalize_string_no_typedefs() if it's not a simple function
> Hannes>   name (like 'function_name' or 'Class::member_function')
> Hannes> - only call expand_symtabs_matching() if the lookup_name doesn't contain a '.'
>
 > Hannes> I admit that I don't fully understand what could break with these changes,
> Hannes> but the speedup makes it worth for me right now.
> 
> Could you send the diff?

Both are attached.

As said before, the first improves the startup time (with 1 pending function breakpoint) from 1m 25s to 27s.

And the second improves it (with 1 pending source:line breakpoint) from 27s to 13s.


Regards
Hannes Domani

[-- Attachment #2: 0001-Don-t-expand-typedefs-for-functions-without-argument.patch --]
[-- Type: application/octet-stream, Size: 1530 bytes --]

From 2902f8e28b5d8e3c2bf4010c8bf495ae4bc98ff3 Mon Sep 17 00:00:00 2001
From: Hannes Domani <ssbssa@yahoo.de>
Date: Fri, 1 Mar 2019 14:05:17 +0100
Subject: [PATCH 1/2] Don't expand typedefs for functions without arguments.

---
 gdb/linespec.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/gdb/linespec.c b/gdb/linespec.c
index 0f2fcfdff0..b01afadd91 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -3899,6 +3899,23 @@ find_function_symbols (struct linespec_state *state,
 				  &info, state->search_pspace);
 }
 
+static bool
+is_simple_name (const char *name)
+{
+  do
+    {
+      if (name[0] == ':' && name[1] == ':')
+	name += 2;
+      if (*name == ':')
+	break;
+      while ((*name >= 'A' && *name <= 'Z') || (*name >= 'a' && *name <= 'z')
+	     || (*name >= '0' && *name <= '9') || *name == '_')
+	name++;
+    }
+  while (name[0] == ':' && name[1] == ':');
+  return *name == '\0';
+}
+
 /* Find all symbols named NAME in FILE_SYMTABS, returning debug symbols
    in SYMBOLS and minimal symbols in MINSYMS.  */
 
@@ -3910,7 +3927,9 @@ find_linespec_symbols (struct linespec_state *state,
 		       std::vector <block_symbol> *symbols,
 		       std::vector<bound_minimal_symbol> *minsyms)
 {
-  std::string canon = cp_canonicalize_string_no_typedefs (lookup_name);
+  std::string canon;
+  if (!is_simple_name (lookup_name))
+    canon = cp_canonicalize_string_no_typedefs (lookup_name);
   if (!canon.empty ())
     lookup_name = canon.c_str ();
 
-- 
2.15.1.windows.2


[-- Attachment #3: 0002-Don-t-expand-symtabs-when-looking-for-a-filename.patch --]
[-- Type: application/octet-stream, Size: 767 bytes --]

From 9f1e4c10b9e3a691f674b2d2a5c9d4af305f0b26 Mon Sep 17 00:00:00 2001
From: Hannes Domani <ssbssa@yahoo.de>
Date: Fri, 1 Mar 2019 14:07:47 +0100
Subject: [PATCH 2/2] Don't expand symtabs when looking for a filename.

---
 gdb/linespec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/linespec.c b/gdb/linespec.c
index e902b11c8e..0f2fcfdff0 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1143,7 +1143,8 @@ iterate_over_all_matching_symtabs
 
     for (objfile *objfile : current_program_space->objfiles ())
       {
-	if (objfile->sf)
+	if (objfile->sf
+	    && lookup_name.name ().find ('.') == std::string::npos)
 	  objfile->sf->qf->expand_symtabs_matching (objfile,
 						    NULL,
 						    lookup_name,
-- 
2.15.1.windows.2


      parent reply	other threads:[~2019-03-09  0:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <183519794.10360727.1551304006549.ref@mail.yahoo.com>
     [not found] ` <183519794.10360727.1551304006549@mail.yahoo.com>
2019-02-27 23:55   ` Tom Tromey
2019-02-28 11:32     ` Hannes Domani via gdb
2019-03-01 18:30       ` Tom Tromey
2019-03-01 18:51         ` Hannes Domani via gdb
2019-03-08 21:13           ` Tom Tromey
     [not found]             ` <605876742.3053854.1552089304851@mail.yahoo.com>
2019-03-09  0:18               ` Hannes Domani via gdb [this message]

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=598470969.3054035.1552090704729@mail.yahoo.com \
    --to=gdb@sourceware.org \
    --cc=ssbssa@yahoo.de \
    /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