20f9f67
http://sourceware.org/ml/gdb-patches/2010-07/msg00184.html
20f9f67
Subject: Re: [0/4] RFC: add DWARF index support
20f9f67
44969d3
Jan Kratochvil: Fixed $d -> $dir.
44969d3
Jan Kratochvil: Remove /dev/null redirection.
44969d3
20f9f67
>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
20f9f67
20f9f67
Tom> This patch series adds support for a DWARF index to gdb.
20f9f67
20f9f67
Roland suggested we wrap up the index-creation code into a helper
20f9f67
script.
20f9f67
20f9f67
I'm not sure if this is something people would want in gdb proper, but I
20f9f67
figured I would send it here just in case.
20f9f67
20f9f67
Tom
20f9f67
20f9f67
2010-07-09  Tom Tromey  <tromey@redhat.com>
20f9f67
20f9f67
	* Makefile.in (install-only): Install gdb-add-index.
20f9f67
	* gdb-add-index: New file.
20f9f67
20f9f67
2010-07-09  Tom Tromey  <tromey@redhat.com>
20f9f67
20f9f67
	* gdb.texinfo (Index Files): Mention gdb-add-index.
20f9f67
20f9f67
>From 30714fe719e61baea03d0dc5793eb0d564faebb7 Mon Sep 17 00:00:00 2001
20f9f67
From: Tom Tromey <tromey@redhat.com>
20f9f67
Date: Fri, 9 Jul 2010 11:17:54 -0600
20f9f67
Subject: [PATCH 4/4] add gdb-add-index
20f9f67
Subject: [PATCH 4/4] add gdb-add-index
20f9f67
20f9f67
---
20f9f67
 gdb/ChangeLog       |    5 +++++
20f9f67
 gdb/Makefile.in     |   11 ++++++++++-
20f9f67
 gdb/doc/ChangeLog   |    4 ++++
20f9f67
 gdb/doc/gdb.texinfo |    8 ++++++++
20f9f67
 gdb/gdb-add-index   |   30 ++++++++++++++++++++++++++++++
20f9f67
 5 files changed, 57 insertions(+), 1 deletions(-)
20f9f67
 create mode 100755 gdb/gdb-add-index
20f9f67
2c55a54
Index: gdb-7.6.90.20140127/gdb/Makefile.in
e00e5ea
===================================================================
2c55a54
--- gdb-7.6.90.20140127.orig/gdb/Makefile.in	2014-02-06 17:37:54.555975958 +0100
2c55a54
+++ gdb-7.6.90.20140127/gdb/Makefile.in	2014-02-06 17:38:52.110038415 +0100
2c55a54
@@ -1093,6 +1093,15 @@ install-only: install-gstack $(CONFIG_IN
2c55a54
 		  $(INSTALL_SCRIPT) gcore \
cf0b61a
 			  $(DESTDIR)$(bindir)/$$transformed_name; \
cf0b61a
 	fi
20f9f67
+	transformed_name=`t='$(program_transform_name)'; \
20f9f67
+			  echo gdb-add-index | sed -e "$$t"` ; \
20f9f67
+		if test "x$$transformed_name" = x; then \
20f9f67
+		  transformed_name=gdb-add-index ; \
20f9f67
+		else \
20f9f67
+		  true ; \
20f9f67
+		fi ; \
2c55a54
+		$(INSTALL_PROGRAM) $(srcdir)/contrib/gdb-add-index.sh \
20f9f67
+			$(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT)
20f9f67
 	@$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
254f0e9
 
2c55a54
 install-strip:
2c55a54
Index: gdb-7.6.90.20140127/gdb/doc/gdb.texinfo
e00e5ea
===================================================================
2c55a54
--- gdb-7.6.90.20140127.orig/gdb/doc/gdb.texinfo	2014-02-06 17:37:50.822971940 +0100
2c55a54
+++ gdb-7.6.90.20140127/gdb/doc/gdb.texinfo	2014-02-06 17:37:54.565975968 +0100
2c55a54
@@ -17749,6 +17749,14 @@ There are currently some limitation on i
20f9f67
 for DWARF debugging information, not stabs.  And, they do not
20f9f67
 currently work for programs using Ada.
20f9f67
 
20f9f67
+@value{GDBN} comes with a program, @command{gdb-add-index}, which can
20f9f67
+be used to add the index to a symbol file.  It takes the symbol file
20f9f67
+as its only argument:
20f9f67
+
20f9f67
+@smallexample
20f9f67
+$ gdb-add-index symfile
20f9f67
+@end smallexample
20f9f67
+
20f9f67
 @node Symbol Errors
20f9f67
 @section Errors Reading Symbol Files
e00e5ea
 
2c55a54
@@ -43878,6 +43886,7 @@ switch (die->tag)
cf0b61a
 * gdbserver man::               Remote Server for the GNU Debugger man page
cf0b61a
 * gcore man::                   Generate a core file of a running program
cf0b61a
 * gdbinit man::                 gdbinit scripts
cf0b61a
+* gdb-add-index man::           Add index files to speed up GDB
cf0b61a
 @end menu
cf0b61a
 
cf0b61a
 @node gdb man
2c55a54
@@ -44530,6 +44539,54 @@ gdb(1), @code{info -f gdb -n Startup}
cf0b61a
 The full documentation for @value{GDBN} is maintained as a Texinfo manual.
cf0b61a
 If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo
cf0b61a
 documentation are properly installed at your site, the command
cf0b61a
+
cf0b61a
+@smallexample
cf0b61a
+info gdb
cf0b61a
+@end smallexample
cf0b61a
+
cf0b61a
+should give you access to the complete manual.
cf0b61a
+
cf0b61a
+@cite{Using GDB: A Guide to the GNU Source-Level Debugger},
cf0b61a
+Richard M. Stallman and Roland H. Pesch, July 1991.
cf0b61a
+@end ifset
cf0b61a
+@c man end
cf0b61a
+
cf0b61a
+@node gdb-add-index man
cf0b61a
+@heading gdb-add-index
cf0b61a
+
cf0b61a
+@c man title gdb-add-index Add index files to speed up GDB
cf0b61a
+
cf0b61a
+@c man begin SYNOPSIS gdb-add-index
cf0b61a
+gdb-add-index @var{filename}
cf0b61a
+@c man end
cf0b61a
+
cf0b61a
+@c man begin DESCRIPTION gdb-add-index
cf0b61a
+When GDB finds a symbol file, it scans the symbols in the file in order
cf0b61a
+to construct an internal symbol table.  This lets most GDB operations
cf0b61a
+work quickly--at the cost of a delay early on.  For large programs,
cf0b61a
+this delay can be quite lengthy, so GDB provides a way to build an
cf0b61a
+index, which speeds up startup.
cf0b61a
+
cf0b61a
+To determine whether a file contains such an index, use the command
cf0b61a
+@command{readelf -S filename}: the index is stored in a section named
cf0b61a
+@code{.gdb_index}.  Note that the index is never generated for files that do
cf0b61a
+not contain DWARF debug information (sections named @code{.debug_*}).
cf0b61a
+
cf0b61a
+See more in
cf0b61a
+@ifset man
cf0b61a
+the @value{GDBN} manual in node @code{Index Files}
cf0b61a
+-- shell command @code{info -f gdb -n 'Index Files'}.
cf0b61a
+@end ifset
cf0b61a
+@ifclear man
cf0b61a
+@ref{Index Files}.
cf0b61a
+@end ifclear
cf0b61a
+@c man end
cf0b61a
+
cf0b61a
+@c man begin SEEALSO gdb-add-index
cf0b61a
+@ifset man
cf0b61a
+The full documentation for @value{GDBN} is maintained as a Texinfo manual.
cf0b61a
+If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo
cf0b61a
+documentation are properly installed at your site, the command
cf0b61a
 
cf0b61a
 @smallexample
cf0b61a
 info gdb
2c55a54
Index: gdb-7.6.90.20140127/gdb/doc/Makefile.in
e00e5ea
===================================================================
2c55a54
--- gdb-7.6.90.20140127.orig/gdb/doc/Makefile.in	2014-02-06 17:37:50.824971942 +0100
2c55a54
+++ gdb-7.6.90.20140127/gdb/doc/Makefile.in	2014-02-06 17:37:54.565975968 +0100
2c55a54
@@ -165,7 +165,7 @@ POD2MAN5 = pod2man --center="GNU Develop
872aab0
 		   --release="gdb-`sed q version.subst`" --section=5
cf0b61a
 
cf0b61a
 # List of man pages generated from gdb.texi
cf0b61a
-MAN1S = gdb.1 gdbserver.1 gcore.1
cf0b61a
+MAN1S = gdb.1 gdbserver.1 gcore.1 gdb-add-index.1
cf0b61a
 MAN5S = gdbinit.5
cf0b61a
 MANS = $(MAN1S) $(MAN5S)
cf0b61a
 
2c55a54
@@ -590,6 +590,13 @@ gcore.1: $(GDB_DOC_FILES)
cf0b61a
 		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
cf0b61a
 	rm -f gcore.pod
cf0b61a
 
cf0b61a
+gdb-add-index.1: $(GDB_DOC_FILES)
cf0b61a
+	touch $@
cf0b61a
+	-$(TEXI2POD) $(MANCONF) -Dgdb-add-index < $(srcdir)/gdb.texinfo > gdb-add-index.pod
cf0b61a
+	-($(POD2MAN1) gdb-add-index.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
cf0b61a
+		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
cf0b61a
+	rm -f gdb-add-index.pod
cf0b61a
+
cf0b61a
 gdbinit.5: $(GDB_DOC_FILES)
cf0b61a
 	touch $@
cf0b61a
 	-$(TEXI2POD) $(MANCONF) -Dgdbinit < $(srcdir)/gdb.texinfo > gdbinit.pod