2005-04-11 20:52:56 +00:00
|
|
|
2004-11-23 Andrew Cagney <cagney@redhat.com>
|
|
|
|
|
|
|
|
* Makefile.in (uninstall-gstack, install-gstack): New rules, add
|
|
|
|
to install and uninstall.
|
|
|
|
* gstack.sh, gstack.1: New files.
|
|
|
|
|
2009-08-04 05:37:29 +00:00
|
|
|
Index: gdb-6.8.50.20090802/gdb/Makefile.in
|
2008-07-14 09:09:04 +00:00
|
|
|
===================================================================
|
2009-08-04 05:37:29 +00:00
|
|
|
--- gdb-6.8.50.20090802.orig/gdb/Makefile.in 2009-08-03 09:50:57.000000000 +0200
|
|
|
|
+++ gdb-6.8.50.20090802/gdb/Makefile.in 2009-08-03 11:09:49.000000000 +0200
|
|
|
|
@@ -947,7 +947,7 @@ gdb.z:gdb.1
|
|
|
|
# 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)
|
2005-04-11 20:52:56 +00:00
|
|
|
transformed_name=`t='$(program_transform_name)'; \
|
|
|
|
echo gdb | sed -e "$$t"` ; \
|
|
|
|
if test "x$$transformed_name" = x; then \
|
2009-08-04 05:37:29 +00:00
|
|
|
@@ -979,9 +979,26 @@ install-tui:
|
2005-04-11 20:52:56 +00:00
|
|
|
$(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 \
|
2009-08-04 05:37:29 +00:00
|
|
|
@@ -1003,6 +1020,17 @@ uninstall-tui:
|
2005-04-11 20:52:56 +00:00
|
|
|
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
|
|
|
|
|
2008-07-14 09:09:04 +00:00
|
|
|
# The C++ name parser can be built standalone for testing.
|
2008-12-14 14:05:20 +00:00
|
|
|
test-cp-name-parser.o: cp-name-parser.c
|
2009-08-04 05:37:29 +00:00
|
|
|
Index: gdb-6.8.50.20090802/gdb/gstack.sh
|
2008-07-14 09:09:04 +00:00
|
|
|
===================================================================
|
|
|
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
2009-08-04 05:37:29 +00:00
|
|
|
+++ gdb-6.8.50.20090802/gdb/gstack.sh 2009-08-03 11:08:52.000000000 +0200
|
2009-04-27 15:22:01 +00:00
|
|
|
@@ -0,0 +1,48 @@
|
2005-04-11 20:52:56 +00:00
|
|
|
+#!/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 |
|
2009-04-27 15:22:01 +00:00
|
|
|
+set width 0
|
|
|
|
+set height 0
|
|
|
|
+set pagination no
|
2005-04-11 20:52:56 +00:00
|
|
|
+$backtrace
|
|
|
|
+EOF
|
|
|
|
+sed -n \
|
|
|
|
+ -e 's/^(gdb) //' \
|
|
|
|
+ -e '/^#/p' \
|
|
|
|
+ -e '/^Thread/p'
|