[gdb/f17] Improve performance for C++ symbols expansion (Tom Tromey, BZ 787487).

Jan Kratochvil jankratochvil at fedoraproject.org
Thu Feb 9 21:26:04 UTC 2012


commit 3000de323b1634ca0b44ac38a3894fd2b09773af
Author: Jan Kratochvil <jan.kratochvil at redhat.com>
Date:   Thu Feb 9 22:25:44 2012 +0100

    Improve performance for C++ symbols expansion (Tom Tromey, BZ 787487).
    
    - Install also gdb-gdb.py pretty printers.

 gdb-expand-cxx-accel.patch |   46 ++++++++++++++++++++++++++++++++++++++++++++
 gdb.spec                   |   16 +++++++++++++-
 2 files changed, 60 insertions(+), 2 deletions(-)
---
diff --git a/gdb-expand-cxx-accel.patch b/gdb-expand-cxx-accel.patch
new file mode 100644
index 0000000..2737bfd
--- /dev/null
+++ b/gdb-expand-cxx-accel.patch
@@ -0,0 +1,46 @@
+https://bugzilla.redhat.com/show_bug.cgi?id=787487
+http://sourceware.org/ml/gdb-patches/2012-02/msg00112.html
+Subject: 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 at 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)
+ 	{
+
diff --git a/gdb.spec b/gdb.spec
index 9683f85..12813dd 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -28,7 +28,7 @@ Version: 7.4.50.%{snap}
 
 # The release always contains a leading reserved number, start it at 1.
 # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
-Release: 11%{?_with_upstream:.upstream}%{?dist}
+Release: 12%{?_with_upstream:.upstream}%{?dist}
 
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain
 Group: Development/Debuggers
@@ -532,6 +532,10 @@ Patch642: gdb-readline62-ask-more-rh.patch
 #=push
 Patch643: gdb-python-rdynamic.patch
 
+# Improve performance for C++ symbols expansion (Tom Tromey, BZ 787487).
+#=push
+Patch644: gdb-expand-cxx-accel.patch
+
 %if 0%{!?rhel:1} || 0%{?rhel} > 6
 # RL_STATE_FEDORA_GDB would not be found for:
 # Patch642: gdb-readline62-ask-more-rh.patch
@@ -797,6 +801,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 %patch627 -p1
 %patch634 -p1
 %patch643 -p1
+%patch644 -p1
 
 %patch393 -p1
 %patch335 -p1
@@ -1103,6 +1108,9 @@ do
   touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/ChangeLog $i
 done
 
+mkdir -p $RPM_BUILD_ROOT/usr/lib/debug%{_bindir}
+cp -p $RPM_BUILD_DIR/%{gdb_src}/gdb/gdb-gdb.py $RPM_BUILD_ROOT/usr/lib/debug%{_bindir}/
+
 %if 0%{?rhel:1} && 0%{?rhel} <= 6
 %if 0%{!?_without_python:1}
 # Temporarily now:
@@ -1232,8 +1240,12 @@ fi
 %{_infodir}/gdb.info*
 
 %changelog
+* Thu Feb  9 2012 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.4.50.20120120-12.fc17
+- Improve performance for C++ symbols expansion (Tom Tromey, BZ 787487).
+- Install also gdb-gdb.py pretty printers.
+
 * Thu Feb  9 2012 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.4.50.20120120-11.fc17
-- Fix possible NULL crash in find_charset_names (Trom Tromey, BZ 786091).
+- Fix possible NULL crash in find_charset_names (Tom Tromey, BZ 786091).
 - [ppc*] Fix build failure due to GCC aliasing warning (BZ 786504).
 
 * Sat Jan 21 2012 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.4.50.20120120-10.fc17


More information about the scm-commits mailing list