This is the mail archive of the gdb-patches@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]

RFC: extend symtabs_from_filename skipping for C++


I'd appreciate comments on this.  Barring comments I will check it in
after a couple days.

A while ago Doug committed a patch to change linespec to skip
symtabs_from_filename when possible.  This was an important performance
improvement.

We got a bug report in Red Hat bugzilla asking that this be extended to
C++ qualified names:

    https://bugzilla.redhat.com/show_bug.cgi?id=787487

This patch implements this idea.

Built and regtested on x86-64 Fedora 15.

Tom

2012-02-08  Tom Tromey  <tromey@redhat.com>

	* linespec.c (decode_line_internal): Skip symtabs_from_filename
	when we have a C++ qualified name.

diff --git a/gdb/linespec.c b/gdb/linespec.c
index da88d17..3f53b8e 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -912,9 +912,11 @@ decode_line_internal (struct linespec_state *self, char **argptr)
   /* First things first: if ARGPTR starts with a filename, get its
      symtab and strip the filename from ARGPTR.
      Avoid calling symtab_from_filename if we know can,
-     it can be expensive.  */
+     it can be expensive.  We know we can avoid the call if we see a
+     single word (e.g., "break NAME") or if we see a qualified C++
+     name ("break QUAL::NAME").  */
 
-  if (*p != '\0')
+  if (*p != '\0' && p[1] != ':')
     {
       TRY_CATCH (file_exception, RETURN_MASK_ERROR)
 	{


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