rpms/gdb/devel gdb-6.3-gstack-20050411.patch, NONE, 1.1 gdb.spec, 1.142, 1.143 gdb-6.3-gstack-20041123.patch, 1.1, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Apr 11 20:52:58 UTC 2005


Update of /cvs/dist/rpms/gdb/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv18147

Modified Files:
	gdb.spec 
Added Files:
	gdb-6.3-gstack-20050411.patch 
Removed Files:
	gdb-6.3-gstack-20041123.patch 
Log Message:
* Mon Apr 11 2005 Andrew Cagney <cagney at redhat.com>   	6.3.0.0-1.12
- Update gstack patch, handle systems that lack /proc/<pid>/tasks.


gdb-6.3-gstack-20050411.patch:
 Makefile.in |   32 ++++++++++++++++++++++++++++++--
 gstack.sh   |   45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 2 deletions(-)

--- NEW FILE gdb-6.3-gstack-20050411.patch ---
2004-11-23  Andrew Cagney  <cagney at redhat.com>

	* Makefile.in (uninstall-gstack, install-gstack): New rules, add
	to install and uninstall.
	* gstack.sh, gstack.1: New files.

diff -uN -r ../orig/gdb/Makefile.in ./gdb/Makefile.in
--- ../orig/gdb/Makefile.in	2004-11-23 13:31:03.000000000 -0500
+++ ./gdb/Makefile.in	2004-11-23 15:06:34.623389592 -0500
@@ -970,7 +970,7 @@
 # time it takes for make to check that all is up to date.
 # install-only is intended to address that need.
 install: all install-only
-install-only: $(CONFIG_INSTALL)
+install-only: install-gstack $(CONFIG_INSTALL)
 	transformed_name=`t='$(program_transform_name)'; \
 			  echo gdb | sed -e "$$t"` ; \
 		if test "x$$transformed_name" = x; then \
@@ -1002,9 +1002,26 @@
 			$(DESTDIR)$(man1dir) ; \
 		$(INSTALL_DATA) $(srcdir)/gdb.1 \
 			$(DESTDIR)$(man1dir)/$$transformed_name.1
+GSTACK=gstack
+.PHONY: install-gstack
+install-gstack:
+	transformed_name=`t='$(program_transform_name)'; \
+			  echo $(GSTACK) | sed -e "$$t"` ; \
+		if test "x$$transformed_name" = x; then \
+		  transformed_name=$(GSTACK) ; \
+		else \
+		  true ; \
+		fi ; \
+		$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \
+		$(INSTALL_PROGRAM) $(srcdir)/$(GSTACK).sh \
+			$(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \
+		: $(SHELL) $(srcdir)/../mkinstalldirs \
+			$(DESTDIR)$(man1dir) ; \
+		: $(INSTALL_DATA) $(srcdir)/gstack.1 \
+			$(DESTDIR)$(man1dir)/$$transformed_name.1
 
 
-uninstall: force $(CONFIG_UNINSTALL)
+uninstall: force uninstall-gstack $(CONFIG_UNINSTALL)
 	transformed_name=`t='$(program_transform_name)'; \
 			  echo gdb | sed -e $$t` ; \
 		if test "x$$transformed_name" = x; then \
@@ -1026,6 +1043,17 @@
 		fi ; \
 		rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
 		      $(DESTDIR)$(man1dir)/$$transformed_name.1
+.PHONY: uninstall-gstack
+uninstall-gstack:
+	transformed_name=`t='$(program_transform_name)'; \
+			  echo $(GSTACK) | sed -e $$t` ; \
+		if test "x$$transformed_name" = x; then \
+		  transformed_name=$(GSTACK) ; \
+		else \
+		  true ; \
+		fi ; \
+		rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
+		      $(DESTDIR)$(man1dir)/$$transformed_name.1
 
 # We do this by grepping through sources.  If that turns out to be too slow,
 # maybe we could just require every .o file to have an initialization routine
--- /dev/null	2005-04-09 23:51:05.027867440 -0400
+++ ./gdb/gstack.sh	2005-04-08 18:00:49.000000000 -0400
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+if test $# -ne 1; then
+    echo "Usage: `basename $0 .sh` <process-id>" 1>&2
+    exit 1
+fi
+
+if test ! -r /proc/$1; then
+    echo "Process $1 not found." 1>&2
+    exit 1
+fi
+
+# GDB doesn't allow "thread apply all bt" when the process isn't
+# threaded; need to peek at the process to determine if that or the
+# simpler "bt" should be used.
+
+backtrace="bt"
+if test -d /proc/$1/task ; then
+    # Newer kernel; has a task/ directory.
+    if test `ls /proc/$1/task | wc -l` -gt 1 2>/dev/null ; then
+	backtrace="thread apply all bt"
+    fi
+elif test -f /proc/$1/maps ; then
+    # Older kernel; go by it loading libpthread.
+    if grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
+	backtrace="thread apply all bt"
+    fi
+fi
+
+GDB=${GDB:-gdb}
+
+if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
+    readnever=--readnever
+else
+    readnever=
+fi
+
+# Run GDB, strip out unwanted noise.
+$GDB --quiet $readnever -nx /proc/$1/exe $1 <<EOF 2>&1 | 
+$backtrace
+EOF
+sed -n \
+    -e 's/^(gdb) //' \
+    -e '/^#/p' \
+    -e '/^Thread/p'


Index: gdb.spec
===================================================================
RCS file: /cvs/dist/rpms/gdb/devel/gdb.spec,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -r1.142 -r1.143
--- gdb.spec	8 Apr 2005 19:18:04 -0000	1.142
+++ gdb.spec	11 Apr 2005 20:52:56 -0000	1.143
@@ -11,7 +11,7 @@
 Version: 6.3.0.0
 
 # The release always contains a leading reserved number, start it at 0.
-Release: 1.11
+Release: 1.12
 
 License: GPL
 Group: Development/Debuggers
@@ -115,7 +115,7 @@
 
 # Add a wrapper script to GDB that implements pstack using the
 # --readnever option.
-Patch118: gdb-6.3-gstack-20041123.patch
+Patch118: gdb-6.3-gstack-20050411.patch
 
 # Fix for caching thread lwps for linux
 Patch119: gdb-6.3-lwp-cache-20041216.patch
@@ -459,6 +459,9 @@
 # don't include the files in include, they are part of binutils
 
 %changelog
+* Mon Apr 11 2005 Andrew Cagney <cagney at redhat.com>   	6.3.0.0-1.12
+- Update gstack patch, handle systems that lack /proc/<pid>/tasks.
+
 * Fri Apr 8 2005 Andrew Cagney <cagney at redhat.com>   	6.3.0.0-1.11
 - Replace patch warning about DW_OP_piece with a patch that implements
   the DW_OP_piece read path.


--- gdb-6.3-gstack-20041123.patch DELETED ---




More information about the fedora-cvs-commits mailing list