This commit is contained in:
parent
76d11328b6
commit
1cc6257895
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 11 17:16:45 CEST 2007 - schwab@suse.de
|
||||
|
||||
- Handle non-threaded processes in gstack [#262694].
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Apr 1 21:32:33 CEST 2007 - schwab@suse.de
|
||||
|
||||
|
4
gdb.spec
4
gdb.spec
@ -21,7 +21,7 @@ Group: Development/Tools/Debuggers
|
||||
Autoreqprov: on
|
||||
PreReq: %{install_info_prereq}
|
||||
Version: 6.6
|
||||
Release: 26
|
||||
Release: 29
|
||||
Summary: The GNU Debugger
|
||||
Source: gdb-%{version}.tar.bz2
|
||||
Patch1: gdb-misc.patch
|
||||
@ -151,6 +151,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Apr 11 2007 - schwab@suse.de
|
||||
- Handle non-threaded processes in gstack [#262694].
|
||||
* Sun Apr 01 2007 - schwab@suse.de
|
||||
- Properly decode CR register number.
|
||||
* Thu Mar 29 2007 - schwab@suse.de
|
||||
|
107
gstack.patch
107
gstack.patch
@ -4,37 +4,6 @@
|
||||
to install and uninstall.
|
||||
* gstack.sh: New file.
|
||||
|
||||
--- gdb/gstack.sh 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ gdb/gstack.sh 2004-11-23 13:34:48.000000000 -0500
|
||||
@@ -0,0 +1,28 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+if test $# -ne 1; then
|
||||
+ echo "Usage: $0 <process-id>" 1>&2
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
+if test ! -r /proc/$1; then
|
||||
+ echo "Process $1 not found." 1>&2
|
||||
+ exit 1
|
||||
+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 |
|
||||
+thread apply all bt
|
||||
+EOF
|
||||
+sed -n \
|
||||
+ -e 's/^(gdb) //' \
|
||||
+ -e '/^#/p' \
|
||||
+ -e '/^Thread/p'
|
||||
--- 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 @@
|
||||
@ -55,14 +24,14 @@
|
||||
+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) ; \
|
||||
+ 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) ; \
|
||||
|
||||
|
||||
-uninstall: force $(CONFIG_UNINSTALL)
|
||||
@ -78,12 +47,60 @@
|
||||
+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)
|
||||
+ if test "x$$transformed_name" = x; then \
|
||||
+ transformed_name=$(GSTACK) ; \
|
||||
+ else \
|
||||
+ true ; \
|
||||
+ fi ; \
|
||||
+ rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT)
|
||||
|
||||
# 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'
|
||||
|
Loading…
x
Reference in New Issue
Block a user