]>
Commit | Line | Data |
---|---|---|
3a58abaf AM |
1 | 2004-11-23 Andrew Cagney <cagney@redhat.com> |
2 | ||
3 | * Makefile.in (uninstall-gstack, install-gstack): New rules, add | |
4 | to install and uninstall. | |
5 | * gstack.sh, gstack.1: New files. | |
6 | ||
7566401a | 7 | Index: gdb-6.8.91.20090917/gdb/Makefile.in |
3a58abaf | 8 | =================================================================== |
7566401a ER |
9 | --- gdb-6.8.91.20090917.orig/gdb/Makefile.in 2009-09-17 12:47:07.000000000 +0200 |
10 | +++ gdb-6.8.91.20090917/gdb/Makefile.in 2009-09-17 12:47:38.000000000 +0200 | |
11 | @@ -989,7 +989,7 @@ install: all install-only | |
3a58abaf AM |
12 | |
13 | # The "install-only" target also installs the syscalls' XML files in | |
14 | # the system. | |
15 | -install-only: $(CONFIG_INSTALL) xml-syscall-install | |
16 | +install-only: install-gstack $(CONFIG_INSTALL) xml-syscall-install | |
17 | transformed_name=`t='$(program_transform_name)'; \ | |
18 | echo gdb | sed -e "$$t"` ; \ | |
19 | if test "x$$transformed_name" = x; then \ | |
7566401a | 20 | @@ -1021,9 +1021,26 @@ install-tui: |
3a58abaf AM |
21 | $(DESTDIR)$(man1dir) ; \ |
22 | $(INSTALL_DATA) $(srcdir)/gdb.1 \ | |
23 | $(DESTDIR)$(man1dir)/$$transformed_name.1 | |
24 | +GSTACK=gstack | |
25 | +.PHONY: install-gstack | |
26 | +install-gstack: | |
27 | + transformed_name=`t='$(program_transform_name)'; \ | |
28 | + echo $(GSTACK) | sed -e "$$t"` ; \ | |
29 | + if test "x$$transformed_name" = x; then \ | |
30 | + transformed_name=$(GSTACK) ; \ | |
31 | + else \ | |
32 | + true ; \ | |
33 | + fi ; \ | |
34 | + $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \ | |
35 | + $(INSTALL_PROGRAM) $(srcdir)/$(GSTACK).sh \ | |
36 | + $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \ | |
37 | + : $(SHELL) $(srcdir)/../mkinstalldirs \ | |
38 | + $(DESTDIR)$(man1dir) ; \ | |
39 | + : $(INSTALL_DATA) $(srcdir)/gstack.1 \ | |
40 | + $(DESTDIR)$(man1dir)/$$transformed_name.1 | |
41 | ||
42 | ||
43 | -uninstall: force $(CONFIG_UNINSTALL) | |
44 | +uninstall: force uninstall-gstack $(CONFIG_UNINSTALL) | |
45 | transformed_name=`t='$(program_transform_name)'; \ | |
46 | echo gdb | sed -e $$t` ; \ | |
47 | if test "x$$transformed_name" = x; then \ | |
7566401a | 48 | @@ -1045,6 +1062,17 @@ uninstall-tui: |
3a58abaf AM |
49 | fi ; \ |
50 | rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \ | |
51 | $(DESTDIR)$(man1dir)/$$transformed_name.1 | |
52 | +.PHONY: uninstall-gstack | |
53 | +uninstall-gstack: | |
54 | + transformed_name=`t='$(program_transform_name)'; \ | |
55 | + echo $(GSTACK) | sed -e $$t` ; \ | |
56 | + if test "x$$transformed_name" = x; then \ | |
57 | + transformed_name=$(GSTACK) ; \ | |
58 | + else \ | |
59 | + true ; \ | |
60 | + fi ; \ | |
61 | + rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \ | |
62 | + $(DESTDIR)$(man1dir)/$$transformed_name.1 | |
63 | ||
64 | # The C++ name parser can be built standalone for testing. | |
65 | test-cp-name-parser.o: cp-name-parser.c | |
7566401a | 66 | Index: gdb-6.8.91.20090917/gdb/gstack.sh |
3a58abaf AM |
67 | =================================================================== |
68 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
7566401a ER |
69 | +++ gdb-6.8.91.20090917/gdb/gstack.sh 2009-09-17 12:47:14.000000000 +0200 |
70 | @@ -0,0 +1,48 @@ | |
3a58abaf AM |
71 | +#!/bin/sh |
72 | + | |
73 | +if test $# -ne 1; then | |
74 | + echo "Usage: `basename $0 .sh` <process-id>" 1>&2 | |
75 | + exit 1 | |
76 | +fi | |
77 | + | |
78 | +if test ! -r /proc/$1; then | |
79 | + echo "Process $1 not found." 1>&2 | |
80 | + exit 1 | |
81 | +fi | |
82 | + | |
83 | +# GDB doesn't allow "thread apply all bt" when the process isn't | |
84 | +# threaded; need to peek at the process to determine if that or the | |
85 | +# simpler "bt" should be used. | |
86 | + | |
87 | +backtrace="bt" | |
88 | +if test -d /proc/$1/task ; then | |
89 | + # Newer kernel; has a task/ directory. | |
90 | + if test `ls /proc/$1/task | wc -l` -gt 1 2>/dev/null ; then | |
91 | + backtrace="thread apply all bt" | |
92 | + fi | |
93 | +elif test -f /proc/$1/maps ; then | |
94 | + # Older kernel; go by it loading libpthread. | |
95 | + if grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then | |
96 | + backtrace="thread apply all bt" | |
97 | + fi | |
98 | +fi | |
99 | + | |
100 | +GDB=${GDB:-gdb} | |
101 | + | |
102 | +if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then | |
103 | + readnever=--readnever | |
104 | +else | |
105 | + readnever= | |
106 | +fi | |
107 | + | |
108 | +# Run GDB, strip out unwanted noise. | |
109 | +$GDB --quiet $readnever -nx /proc/$1/exe $1 <<EOF 2>&1 | | |
7566401a ER |
110 | +set width 0 |
111 | +set height 0 | |
112 | +set pagination no | |
3a58abaf AM |
113 | +$backtrace |
114 | +EOF | |
115 | +sed -n \ | |
116 | + -e 's/^(gdb) //' \ | |
117 | + -e '/^#/p' \ | |
118 | + -e '/^Thread/p' |