Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:AndreasSchwab
gdb
gstack.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gstack.patch of Package gdb
2004-11-23 Andrew Cagney <cagney@redhat.com> * Makefile.in (uninstall-gstack, install-gstack): New rules, add to install and uninstall. * gstack.sh: New file. Index: gdb/Makefile.in =================================================================== --- gdb/Makefile.in.orig +++ gdb/Makefile.in @@ -1767,7 +1767,7 @@ info install-info clean-info dvi pdf ins install: all @$(MAKE) $(FLAGS_TO_PASS) 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 \ @@ -1804,6 +1804,20 @@ install-only: $(CONFIG_INSTALL) $(DESTDIR)$(bindir)/$$transformed_name @$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do +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_SCRIPT) $(srcdir)/$(GSTACK).sh \ + $(DESTDIR)$(bindir)/$$transformed_name + install-strip: $(MAKE) $(FLAGS_TO_PASS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ @@ -1816,7 +1830,7 @@ install-guile: install-python: $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb -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 \ @@ -1847,6 +1861,17 @@ uninstall: force $(CONFIG_UNINSTALL) rm -f $(DESTDIR)$(bindir)/$$transformed_name @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do +.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) + # The C++ name parser can be built standalone for testing. test-cp-name-parser.o: cp-name-parser.c $(COMPILE) -DTEST_CPNAMES cp-name-parser.c Index: gdb/gstack.sh =================================================================== --- /dev/null +++ gdb/gstack.sh @@ -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'
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor