From 7fe437e69acdfa85e8b2a5f65ec327a0731e7968 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 7 Jul 2008 11:15:50 +0200 Subject: Install tutorial and langref manuals. --- ChangeLog | 5 +++++ doc/ChangeLog | 6 ++++++ doc/Makefile.am | 15 ++++++++++++++- doc/Makefile.in | 38 +++++++++++++++++++++++++++----------- systemtap.spec.in | 9 +++++++-- 5 files changed, 59 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f90771b..4e399ab4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-07-07 Mark Wielaard + + * systemtap.spec.in (%install): Move installed pdf files. + (%files): Mark moved installed pdf as %doc files. + 2008-07-03 Frank Ch. Eigler * translate.cxx (translate_pass): Don't #include . diff --git a/doc/ChangeLog b/doc/ChangeLog index 16a3c111..600edb6d 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2008-07-07 Mark Wielaard + + * Makefile.am (install-data-hook): New, install pdf files. + (uninstall-local): New, uninstall them again. + * Makefile.in: Regenerated. + 2008-04-24 Will Cohen * Makefile.in: Regenerated. diff --git a/doc/Makefile.am b/doc/Makefile.am index 25eb61d7..e4bc3800 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,11 +1,24 @@ # Makefile.am --- automake input file for systemtap docs ## process this file with automake to produce Makefile.in +PDF_FILES = tutorial.pdf langref.pdf +DOC_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap + if BUILD_DOCS -all-local: tutorial.pdf langref.pdf +all-local: $(PDF_FILES) clean-local: rm -f *.pdf *.out *.log *.aux *.toc *.lot *.idx *.glo + +install-data-hook: + $(MKDIR_P) $(DOC_INSTALL_DIR) + $(INSTALL_DATA) $(PDF_FILES) $(DOC_INSTALL_DIR) + +uninstall-local: + @list='$(PDF_FILES)'; for p in $$list; do \ + echo " rm -f '$(DOC_INSTALL_DIR)/$$p'"; \ + rm -f "$(DOC_INSTALL_DIR)/$$p"; \ + done endif SUFFIXES = ps pdf dvi ps tex diff --git a/doc/Makefile.in b/doc/Makefile.in index a31d76f0..e01c5ebf 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -149,6 +149,8 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +PDF_FILES = tutorial.pdf langref.pdf +DOC_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap SUFFIXES = ps pdf dvi ps tex EXTRA_DIST = tutorial.tex langref.tex tutorial nomencl.sty all: all-am @@ -246,7 +248,9 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." +@BUILD_DOCS_FALSE@uninstall-local: @BUILD_DOCS_FALSE@clean-local: +@BUILD_DOCS_FALSE@install-data-hook: clean: clean-am clean-am: clean-generic clean-local mostlyclean-am @@ -266,6 +270,8 @@ info: info-am info-am: install-data-am: + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-am @@ -299,27 +305,37 @@ ps: ps-am ps-am: -uninstall-am: +uninstall-am: uninstall-local -.MAKE: install-am install-strip +.MAKE: install-am install-data-am install-strip .PHONY: all all-am all-local check check-am clean clean-generic \ clean-local distclean distclean-generic distdir dvi dvi-am \ html html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ + install-data-am install-data-hook install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am uninstall uninstall-am + pdf-am ps ps-am uninstall uninstall-am uninstall-local -@BUILD_DOCS_TRUE@all-local: tutorial.pdf langref.pdf +@BUILD_DOCS_TRUE@all-local: $(PDF_FILES) @BUILD_DOCS_TRUE@clean-local: @BUILD_DOCS_TRUE@ rm -f *.pdf *.out *.log *.aux *.toc *.lot *.idx *.glo +@BUILD_DOCS_TRUE@install-data-hook: +@BUILD_DOCS_TRUE@ $(MKDIR_P) $(DOC_INSTALL_DIR) +@BUILD_DOCS_TRUE@ $(INSTALL_DATA) $(PDF_FILES) $(DOC_INSTALL_DIR) + +@BUILD_DOCS_TRUE@uninstall-local: +@BUILD_DOCS_TRUE@ @list='$(PDF_FILES)'; for p in $$list; do \ +@BUILD_DOCS_TRUE@ echo " rm -f '$(DOC_INSTALL_DIR)/$$p'"; \ +@BUILD_DOCS_TRUE@ rm -f "$(DOC_INSTALL_DIR)/$$p"; \ +@BUILD_DOCS_TRUE@ done + .ps.pdf: ps2pdf -r600 $< diff --git a/systemtap.spec.in b/systemtap.spec.in index e663b15a..b44d23cb 100644 --- a/systemtap.spec.in +++ b/systemtap.spec.in @@ -151,6 +151,12 @@ cp -rp testsuite $RPM_BUILD_ROOT%{_datadir}/systemtap mkdir $RPM_BUILD_ROOT%{_datadir}/%{name}/src cp -rp examples $RPM_BUILD_ROOT%{_datadir}/%{name}/src +#%if %{with_docs} +# We want the manuals in the special doc dir, not the generic doc install dir. +mkdir docs.installed +mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/*.pdf docs.installed/ +#%endif + %clean rm -rf ${RPM_BUILD_ROOT} @@ -164,8 +170,7 @@ exit 0 %doc README AUTHORS NEWS COPYING examples %if %{with_docs} -%doc doc/tutorial.pdf -%doc doc/langref.pdf +%doc docs.installed/*.pdf %endif %{_bindir}/stap -- cgit From ec4d1558731efe3fb9b423c325c012798eab59fb Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 7 Jul 2008 12:52:16 +0200 Subject: Install examples, demos and samples. --- ChangeLog | 11 +++++++ Makefile.am | 71 +++++++++++++++++++++++++++---------------- Makefile.in | 91 +++++++++++++++++++++++++++++++++++-------------------- aclocal.m4 | 38 +++++++++++++---------- systemtap.spec.in | 14 ++++----- 5 files changed, 143 insertions(+), 82 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e399ab4..ac96ddc0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-07-07 Mark Wielaard + + * Makefile.am (install-data-hook): Install examples, demos and + samples. + (uninstall-local): Remove examples, demos and samples. + * Makefile.in: Regenerated. + * aclocal.m4: Likewise. + * systemtap.spec.in (%install): Move examples. + Don't copy over examples to src. + (testsuite): Don't include src/examples. + 2008-07-07 Mark Wielaard * systemtap.spec.in (%install): Move installed pdf files. diff --git a/Makefile.am b/Makefile.am index 8333281e..b603c640 100644 --- a/Makefile.am +++ b/Makefile.am @@ -155,32 +155,33 @@ EXTRA_DIST = auto_free.h buildrun.h elaborate.h loc2c.h session.h \ dwarf_wrappers.h \ git_version.h git_version.sh -EXAMPLE_DEST_DIR = $(distdir)/examples -SAMPLE_DEST_DIR = $(EXAMPLE_DEST_DIR)/samples - -EXAMPLE_SRC = $(srcdir)/testsuite/systemtap.examples - -SAMPLE_SRC = $(srcdir)/testsuite/systemtap.samples/iotask.stp \ - $(srcdir)/testsuite/systemtap.samples/kmalloc-stacks.stp \ - $(srcdir)/testsuite/systemtap.samples/kmalloc-top \ - $(srcdir)/testsuite/systemtap.samples/pfaults.stp \ - $(srcdir)/testsuite/systemtap.samples/profile.stp \ - $(srcdir)/testsuite/systemtap.samples/tcp_connections.stp \ - $(srcdir)/testsuite/systemtap.samples/topsys.stp - -dist-add-examples: $(EXAMPLE_SRC) - rm -rf $(EXAMPLE_DEST_DIR) - mkdir -p $(EXAMPLE_DEST_DIR) - cp -a $(EXAMPLE_SRC)/* $(EXAMPLE_DEST_DIR)/. - -# Copy some of the testsuite sample scripts to the distdir -# 'examples/samples' directory. -dist-add-samples: $(SAMPLE_SRC) dist-add-examples - rm -rf $(SAMPLE_DEST_DIR) - mkdir -p $(SAMPLE_DEST_DIR) - cp $(SAMPLE_SRC) $(SAMPLE_DEST_DIR) - -dist-hook: dist-add-samples dist-gitversion +EXAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples +EXAMPLE_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap/examples +DEMO_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples/small_demos +DEMO_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap/examples/small_demos +SAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.samples +SAMPLE_INSTALL_DIR = $(EXAMPLE_INSTALL_DIR)/samples + +EXAMPLE_SRC = $(EXAMPLE_SOURCE_DIR)/ChangeLog \ + $(EXAMPLE_SOURCE_DIR)/README \ + $(EXAMPLE_SOURCE_DIR)/*.stp \ + $(EXAMPLE_SOURCE_DIR)/*.txt \ + $(EXAMPLE_SOURCE_DIR)/*.meta + +DEMO_SRC = \ + $(EXAMPLE_SOURCE_DIR)/small_demos/*.stp \ + $(EXAMPLE_SOURCE_DIR)/small_demos/*.txt \ + $(EXAMPLE_SOURCE_DIR)/small_demos/*.wav + +SAMPLE_SRC = $(SAMPLE_SOURCE_DIR)/iotask.stp \ + $(SAMPLE_SOURCE_DIR)/kmalloc-stacks.stp \ + $(SAMPLE_SOURCE_DIR)/kmalloc-top \ + $(SAMPLE_SOURCE_DIR)/pfaults.stp \ + $(SAMPLE_SOURCE_DIR)/profile.stp \ + $(SAMPLE_SOURCE_DIR)/tcp_connections.stp \ + $(SAMPLE_SOURCE_DIR)/topsys.stp + +dist-hook: dist-gitversion find $(distdir) -name CVS -o -name '*~' -o -name '.#*' | xargs rm -rf find $(distdir) -name '*.o' -o -name '*.ko' -o -name '*.cmd' -o -name '*.mod.c' -o -name '.??*' | xargs rm -rf find $(distdir) -name 'stap' -o -name '*.log' -o -name '*.sum' -o -name 'site.exp' | xargs rm -rf @@ -195,6 +196,12 @@ install-data-local: do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/uprobes/$$f; done) (cd $(srcdir)/tapset; find . \( -name '*.stp' -o -name README \) -print \ | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/tapset/$$f; done) + $(MKDIR_P) $(EXAMPLE_INSTALL_DIR) + $(INSTALL_DATA) $(EXAMPLE_SRC) $(EXAMPLE_INSTALL_DIR) + $(MKDIR_P) $(DEMO_INSTALL_DIR) + $(INSTALL_DATA) $(DEMO_SRC) $(DEMO_INSTALL_DIR) + $(MKDIR_P) $(SAMPLE_INSTALL_DIR) + $(INSTALL_DATA) $(SAMPLE_SRC) $(SAMPLE_INSTALL_DIR) TEST_COV_DIR = coverage @@ -222,6 +229,18 @@ uninstall-local: rm -rf $(DESTDIR)$(libexecdir)/$(PACKAGE) rm -rf $(DESTDIR)$(libdir)/$(PACKAGE) -rm -rf $(DESTDIR)$(localstatedir)/cache/$(PACKAGE) + @list='$(EXAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \ + echo " rm -f '$(EXAMPLE_INSTALL_DIR)/$$p'"; \ + rm -f "$(EXAMPLE_INSTALL_DIR)/$$p"; \ + done + @list='$(DEMO_SRC)'; for f in $$list; do p=`basename $$f`; \ + echo " rm -f '$(DEMO_INSTALL_DIR)/$$p'"; \ + rm -f "$(DEMO_INSTALL_DIR)/$$p"; \ + done + @list='$(SAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \ + echo " rm -f '$(SAMPLE_INSTALL_DIR)/$$p'"; \ + rm -f "$(SAMPLE_INSTALL_DIR)/$$p"; \ + done # XXX: leaves behind man pages SUBDIRS = testsuite doc diff --git a/Makefile.in b/Makefile.in index dc039c3f..0e2cc2fa 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -331,16 +331,30 @@ EXTRA_DIST = auto_free.h buildrun.h elaborate.h loc2c.h session.h \ dwarf_wrappers.h \ git_version.h git_version.sh -EXAMPLE_DEST_DIR = $(distdir)/examples -SAMPLE_DEST_DIR = $(EXAMPLE_DEST_DIR)/samples -EXAMPLE_SRC = $(srcdir)/testsuite/systemtap.examples -SAMPLE_SRC = $(srcdir)/testsuite/systemtap.samples/iotask.stp \ - $(srcdir)/testsuite/systemtap.samples/kmalloc-stacks.stp \ - $(srcdir)/testsuite/systemtap.samples/kmalloc-top \ - $(srcdir)/testsuite/systemtap.samples/pfaults.stp \ - $(srcdir)/testsuite/systemtap.samples/profile.stp \ - $(srcdir)/testsuite/systemtap.samples/tcp_connections.stp \ - $(srcdir)/testsuite/systemtap.samples/topsys.stp +EXAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples +EXAMPLE_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap/examples +DEMO_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples/small_demos +DEMO_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap/examples/small_demos +SAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.samples +SAMPLE_INSTALL_DIR = $(EXAMPLE_INSTALL_DIR)/samples +EXAMPLE_SRC = $(EXAMPLE_SOURCE_DIR)/ChangeLog \ + $(EXAMPLE_SOURCE_DIR)/README \ + $(EXAMPLE_SOURCE_DIR)/*.stp \ + $(EXAMPLE_SOURCE_DIR)/*.txt \ + $(EXAMPLE_SOURCE_DIR)/*.meta + +DEMO_SRC = \ + $(EXAMPLE_SOURCE_DIR)/small_demos/*.stp \ + $(EXAMPLE_SOURCE_DIR)/small_demos/*.txt \ + $(EXAMPLE_SOURCE_DIR)/small_demos/*.wav + +SAMPLE_SRC = $(SAMPLE_SOURCE_DIR)/iotask.stp \ + $(SAMPLE_SOURCE_DIR)/kmalloc-stacks.stp \ + $(SAMPLE_SOURCE_DIR)/kmalloc-top \ + $(SAMPLE_SOURCE_DIR)/pfaults.stp \ + $(SAMPLE_SOURCE_DIR)/profile.stp \ + $(SAMPLE_SOURCE_DIR)/tcp_connections.stp \ + $(SAMPLE_SOURCE_DIR)/topsys.stp TEST_COV_DIR = coverage # XXX: leaves behind man pages @@ -1150,8 +1164,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -1176,8 +1190,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -1187,13 +1201,12 @@ ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -1266,6 +1279,10 @@ dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) @@ -1293,6 +1310,8 @@ distcheck: dist GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ @@ -1462,7 +1481,7 @@ uninstall-man: uninstall-man1 uninstall-man5 uninstall-man8 clean-binPROGRAMS clean-generic clean-local \ clean-noinstPROGRAMS clean-pkglibexecPROGRAMS ctags \ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \ - dist-shar dist-tarZ dist-zip distcheck distclean \ + dist-lzma dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ @@ -1537,19 +1556,7 @@ install-exec-hook: @BUILD_CRASHMOD_TRUE@ $(MKDIR_P) $(DESTDIR)$(pkglibdir) @BUILD_CRASHMOD_TRUE@ $(INSTALL) $(STAPLOG) $(DESTDIR)$(pkglibdir) -dist-add-examples: $(EXAMPLE_SRC) - rm -rf $(EXAMPLE_DEST_DIR) - mkdir -p $(EXAMPLE_DEST_DIR) - cp -a $(EXAMPLE_SRC)/* $(EXAMPLE_DEST_DIR)/. - -# Copy some of the testsuite sample scripts to the distdir -# 'examples/samples' directory. -dist-add-samples: $(SAMPLE_SRC) dist-add-examples - rm -rf $(SAMPLE_DEST_DIR) - mkdir -p $(SAMPLE_DEST_DIR) - cp $(SAMPLE_SRC) $(SAMPLE_DEST_DIR) - -dist-hook: dist-add-samples dist-gitversion +dist-hook: dist-gitversion find $(distdir) -name CVS -o -name '*~' -o -name '.#*' | xargs rm -rf find $(distdir) -name '*.o' -o -name '*.ko' -o -name '*.cmd' -o -name '*.mod.c' -o -name '.??*' | xargs rm -rf find $(distdir) -name 'stap' -o -name '*.log' -o -name '*.sum' -o -name 'site.exp' | xargs rm -rf @@ -1564,6 +1571,12 @@ install-data-local: do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/uprobes/$$f; done) (cd $(srcdir)/tapset; find . \( -name '*.stp' -o -name README \) -print \ | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/tapset/$$f; done) + $(MKDIR_P) $(EXAMPLE_INSTALL_DIR) + $(INSTALL_DATA) $(EXAMPLE_SRC) $(EXAMPLE_INSTALL_DIR) + $(MKDIR_P) $(DEMO_INSTALL_DIR) + $(INSTALL_DATA) $(DEMO_SRC) $(DEMO_INSTALL_DIR) + $(MKDIR_P) $(SAMPLE_INSTALL_DIR) + $(INSTALL_DATA) $(SAMPLE_SRC) $(SAMPLE_INSTALL_DIR) gcov: @-$(MAKE) clean CXXFLAGS="-g -fprofile-arcs -ftest-coverage" all check @@ -1589,6 +1602,18 @@ uninstall-local: rm -rf $(DESTDIR)$(libexecdir)/$(PACKAGE) rm -rf $(DESTDIR)$(libdir)/$(PACKAGE) -rm -rf $(DESTDIR)$(localstatedir)/cache/$(PACKAGE) + @list='$(EXAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \ + echo " rm -f '$(EXAMPLE_INSTALL_DIR)/$$p'"; \ + rm -f "$(EXAMPLE_INSTALL_DIR)/$$p"; \ + done + @list='$(DEMO_SRC)'; for f in $$list; do p=`basename $$f`; \ + echo " rm -f '$(DEMO_INSTALL_DIR)/$$p'"; \ + rm -f "$(DEMO_INSTALL_DIR)/$$p"; \ + done + @list='$(SAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \ + echo " rm -f '$(SAMPLE_INSTALL_DIR)/$$p'"; \ + rm -f "$(SAMPLE_INSTALL_DIR)/$$p"; \ + done check: SRCDIR=`cd $(srcdir); pwd`; \ diff --git a/aclocal.m4 b/aclocal.m4 index 9d70920d..0e2027cd 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.10 -*- Autoconf -*- +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,12 +11,15 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -m4_if(m4_PACKAGE_VERSION, [2.61],, -[m4_fatal([this file was generated for autoconf 2.61. -You have another version of autoconf. If you want to use that, -you should regenerate the build system entirely.], [63])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.61],, +[m4_warning([this file was generated for autoconf 2.61. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) -# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -31,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.10], [], +m4_if([$1], [1.10.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -47,8 +50,10 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.10])dnl -_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- @@ -343,7 +348,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue @@ -391,13 +396,13 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 12 +# serial 13 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -502,16 +507,17 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC], # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. +_am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in - $1 | $1:* ) + $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # @@ -872,7 +878,7 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])]) # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- -# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) diff --git a/systemtap.spec.in b/systemtap.spec.in index b44d23cb..1fdd65a4 100644 --- a/systemtap.spec.in +++ b/systemtap.spec.in @@ -130,16 +130,19 @@ cd .. %configure %{?elfutils_config} %{sqlite_config} %{crash_config} %{docs_config} make %{?_smp_mflags} +%install +rm -rf ${RPM_BUILD_ROOT} +make DESTDIR=$RPM_BUILD_ROOT install + +# We want the examples in the special doc dir, not the generoc doc install dir. +mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/examples examples + # Fix paths in the example & testsuite scripts find examples testsuite -type f -name '*.stp' -print0 | xargs -0 sed -i -r -e '1s@^#!.+stap@#!%{_bindir}/stap@' # To avoid perl dependency, make perl sample script non-executable chmod -x examples/samples/kmalloc-top -%install -rm -rf ${RPM_BUILD_ROOT} -make DESTDIR=$RPM_BUILD_ROOT install - # Because "make install" may install staprun with mode 04111, the # post-processing programs rpmbuild runs won't be able to read it. # So, we change permissions so that they can read it. We'll set the @@ -148,8 +151,6 @@ chmod 755 $RPM_BUILD_ROOT%{_bindir}/staprun # Copy over the testsuite cp -rp testsuite $RPM_BUILD_ROOT%{_datadir}/systemtap -mkdir $RPM_BUILD_ROOT%{_datadir}/%{name}/src -cp -rp examples $RPM_BUILD_ROOT%{_datadir}/%{name}/src #%if %{with_docs} # We want the manuals in the special doc dir, not the generic doc install dir. @@ -201,7 +202,6 @@ exit 0 %files testsuite %defattr(-,root,root) -%{_datadir}/%{name}/src %{_datadir}/%{name}/testsuite -- cgit From ff7b8b4a8fbcba5e78e72617753fd33f6f3ebc07 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 7 Jul 2008 13:04:01 +0200 Subject: Add section to stapex manual page on how installed examples are documented. --- ChangeLog | 5 +++++ stapex.5.in | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index ac96ddc0..871b5096 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-07-07 Mark Wielaard + + * stapex.5.in: Add section on installed examples, samples and demos + and how they are documented. + 2008-07-07 Mark Wielaard * Makefile.am (install-data-hook): Install examples, demos and diff --git a/stapex.5.in b/stapex.5.in index 2c9ecb60..e6763267 100644 --- a/stapex.5.in +++ b/stapex.5.in @@ -106,6 +106,13 @@ To list the probeable functions in the kernel, use the listings mode. % stap \-l \[aq]kernel.function("*")\[aq] .ESAMPLE +.SH MORE EXAMPLES + +Larger examples, demos and samples can be found in +@prefix@/doc/systemtap*/examples, each example comes with either a .txt +or .meta file explaining what the example, sample or demo does and how +it is ordinarily run. + .SH SEE ALSO .BR @prefix@/doc/systemtap*/examples .IR stap (1) -- cgit From b7278cda1ffbe3f1e711adb40577ad12f3527260 Mon Sep 17 00:00:00 2001 From: Dave Brolley Date: Tue, 8 Jul 2008 14:22:11 -0400 Subject: Use `uname -rvm` for checking system compatibility. Generate a finale response from the server to allow for error checking. --- ChangeLog | 10 ++++++++++ stap-client | 16 ++++++++++++++-- stap-server | 7 ++++--- stap-serverd | 5 ++--- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 871b5096..99fbfc51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-07-08 + + * stap-client (client_sysinfo): Use `uname -rvm`. + (receive_response): Wait for "done:" from the server. Clear server_ip + when the server is incompatible. + * stap-server (check_request): Quote "`server_sysinfo`". + (server_sysinfo): Use `uname -rvm`. + (send_response): Send "done:". + * stap-serverd (advertise_presence): Use `uname -rvm`. Quote "$txt". + 2008-07-07 Mark Wielaard * stapex.5.in: Add section on installed examples, samples and demos diff --git a/stap-client b/stap-client index 515cab92..8c3607ae 100755 --- a/stap-client +++ b/stap-client @@ -315,7 +315,7 @@ function create_request { function client_sysinfo { if test "X$sysinfo_client" = "X"; then # Add some info from uname - sysinfo_client="`uname -r`" + sysinfo_client="`uname -rvm`" fi echo $sysinfo_client } @@ -348,7 +348,6 @@ function package_request { # the tar file will expand to. function send_request { echo "request:" >&3 - # Get the server's response. read <&3 local line=$REPLY @@ -368,7 +367,19 @@ function send_request { # function: receive_response # # Wait for a response from the server indicating the results of our request. +# protocol is: +# server -> "done:" +# server -> $tar_server function receive_response { + # Get the server's response. + read <&3 + local line=$REPLY + check_server_error $line + + # Check for the proper response. + test "$line" = "done:" || \ + fatal "ERROR: server response, '$line', is incorrect" + # Make a place to receive the response file. tar_server=`mktemp -t $tmpdir_prefix_client.server.tgz.XXXXXX` || \ fatal "ERROR: cannot create temporary file " $tar_server @@ -522,6 +533,7 @@ function match_server { # It is a stap server, but is it compatible? if test "$sysinfo_server" != "`client_sysinfo`"; then + server_ip= continue fi diff --git a/stap-server b/stap-server index 11d6d81d..16ffe8ee 100755 --- a/stap-server +++ b/stap-server @@ -111,7 +111,7 @@ function check_request { client_sysinfo=`read_data_file sysinfo` test "X$client_sysinfo" != "X" || exit 1 - check_compatibility "$client_sysinfo" `server_sysinfo` + check_compatibility "$client_sysinfo" "`server_sysinfo`" } # function server_sysinfo @@ -120,7 +120,7 @@ function check_request { function server_sysinfo { if test "X$sysinfo_server" = "X"; then # Add some info from uname - sysinfo_server="`uname -r`" + sysinfo_server="`uname -rvm`" fi echo $sysinfo_server } @@ -365,9 +365,10 @@ function package_response { # Notify the client that $tar_server is ready and wait for the client to take # it. # The protocol is: -# server -> "sending: $tmpdir_server $tmpdir_stap" +# server -> "done:" # server -> $tar_server function send_response { + echo "done:" # Now send it nc -l $port < $tar_server > /dev/null } diff --git a/stap-serverd b/stap-serverd index 2c0743c0..eaaeda00 100755 --- a/stap-serverd +++ b/stap-serverd @@ -34,13 +34,12 @@ function initialization { function advertise_presence { # Build up a string representing our server's properties. # TODO: this needs fleshing out. - - local sysinfo=`uname -r` + local sysinfo=`uname -rvm` local txt="$sysinfo" # Call avahi-publish-service to advertise our presence. avahi-publish-service "Systemtap Compile Server on `uname -n`" \ - $avahi_type $port $txt > /dev/null 2>&1 & + $avahi_type $port "$txt" > /dev/null 2>&1 & echo "Systemtap Compile Server on `uname -n` listening on port $port" } -- cgit From 1027502bf8cae522bac37847931a05feceae96d1 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 8 Jul 2008 18:37:09 -0400 Subject: PR2111: add general blurbage to stapprobes.5 on syscalls tapset --- stapprobes.5.in | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/stapprobes.5.in b/stapprobes.5.in index 5d400cb6..700452a7 100644 --- a/stapprobes.5.in +++ b/stapprobes.5.in @@ -121,6 +121,47 @@ handler is never run, though its statements are analyzed for symbol / type correctness as usual. This probe point may be useful in conjunction with optional probes. +.SS SYSCALL + +The +.IR syscall.* +aliases define several hundred probes, too many to +summarize here. They are: + +.SAMPLE +syscall.NAME +.br +syscall.NAME.return +.ESAMPLE + +Generally, two probes are defined for each normal system call as listed in the +.IR syscalls(2) +manual page, one for entry and one for return. Those system calls that never +return do not have a corresponding +.IR .return +probe. +.PP +Each probe alias defines a variety of variables. Looking at the tapset source +code is the most reliable way. Generally, each variable listed in the standard +manual page is made available as a script-level variable, so +.IR syscall.open +exposes +.IR filename ", " flags ", and " mode . +In addition, a standard suite of variables is available at most aliases: +.TP +.IR argstr +A pretty-printed form of the entire argument list, without parentheses. +.TP +.IR name +The name of the system call. +.TP +.IR retstr +For return probes, a pretty-printed form of the system-call result. +.PP +Not all probe aliases obey all of these general guidelines. Please report +any bothersome ones you encounter as a bug. + + .SS TIMERS Intervals defined by the standard kernel "jiffies" timer may be used -- cgit From 26de79f7a2b4db7c123f43cca0d01f5a505103d5 Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Wed, 9 Jul 2008 18:06:39 -0400 Subject: Slightly cleanup code of translate.cxx --- ChangeLog | 6 ++++++ translate.cxx | 8 +++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 99fbfc51..8ad842ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ + +2008-07-09 + + * translate.cxx (visit_comparison): Remove unnecessary comparison. + * translate.cxx (emit_symbol_data): Remove unused local variable. + 2008-07-08 * stap-client (client_sysinfo): Use `uname -rvm`. diff --git a/translate.cxx b/translate.cxx index e9dff3c7..557c2f12 100644 --- a/translate.cxx +++ b/translate.cxx @@ -3134,8 +3134,7 @@ c_unparser::visit_comparison (comparison* e) if (e->left->type == pe_string) { - if (e->left->type != pe_string || - e->right->type != pe_string) + if (e->right->type != pe_string) throw semantic_error ("expected string types", e->tok); o->line() << "strncmp ("; @@ -3147,8 +3146,7 @@ c_unparser::visit_comparison (comparison* e) } else if (e->left->type == pe_long) { - if (e->left->type != pe_long || - e->right->type != pe_long) + if (e->right->type != pe_long) throw semantic_error ("expected numeric types", e->tok); o->line() << "(("; @@ -4424,7 +4422,7 @@ emit_symbol_data (systemtap_session& s) // so parse /proc/kallsyms. ifstream kallsyms("/proc/kallsyms"); - string lastaddr, modules_op_addr; + string lastaddr; kallsyms_out << "struct _stp_symbol _stp_kernel_symbols [] = {"; while (! kallsyms.eof()) -- cgit From 23957b6c147b63db1c071a4c2daaf23b4185dadb Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 8 Jul 2008 20:51:44 -0400 Subject: Sync latest fix for git_version.sh from RadeonHD's tree This incorporates commit de4fbeeb: "Fix check for wrong macro in in git-version.sh", from the xf86-video-radeonhd tree. Signed-off-by: "Theodore Ts'o" --- git_version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git_version.sh b/git_version.sh index 69eb0f24..5cf29437 100755 --- a/git_version.sh +++ b/git_version.sh @@ -314,7 +314,7 @@ int main(int argc, char *argv[]) const char *const prog = (idx)?(idx+1):(argv[0]); #ifdef PACKAGE_VERSION printf("%s: version %s, built from %s\n", prog, PACKAGE_VERSION, GIT_MESSAGE); -#elif defined(GIT_USED) +#elif defined(GIT_MESSAGE) printf("%s: built from %s\n", prog, GIT_MESSAGE); #endif return 0; -- cgit From d99a656a615dd78773316b7ac3972f3f1bcd5fca Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 8 Jul 2008 20:51:45 -0400 Subject: Add hack to support git 1.6 in git_version.sh This is needed now for people who are running the "master" branch of git, which is currently in development for git version 1.6.0. This is a kludge to support hyphenated git commands (i.e., git-diff-files), but this form is explicitly deprecated, and doesn't work in git 1.6 unless you put git's execdir (obtained via git --exec-path) in your PATH environment variable. Even then, these programs may no longer exist future versions of git. It would be better to change the script to use "git diff-files", et. al., but I assume upstream had some vaguely justifiable reason for not writing the script that way. I'll let them decide when they are willing to fix the script the right way, even if it means breaking compatibility for some ancient version of git. n.b., git 1.5.0 was released February 2007, and git 1.4.0 was released June, 2006. Signed-off-by: "Theodore Ts'o" --- git_version.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/git_version.sh b/git_version.sh index 5cf29437..50658970 100755 --- a/git_version.sh +++ b/git_version.sh @@ -155,6 +155,29 @@ cat< /dev/null) +if test -n "$execdir"; then + PATH=$PATH:$execdir +fi + # Detect git tools (should work with old and new git versions) git_found=yes for git_tool in git-symbolic-ref git-rev-parse git-diff-files git-diff-index git -- cgit From 0b8f65798e0b454ccaab1d93925c3e034d4f5624 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Tue, 8 Jul 2008 16:45:16 -0500 Subject: Fix semantic error: empty struct On Tue, 2008-07-08 at 14:57 -0400, Frank Ch. Eigler wrote: > Hi - > > > you need a global cache for resolution ... it's not tied to any local > > class instance. For class dwflpp it probably doesn't matter, since that > > class is effectively static (by its survival for a session) but > > logically because the DW_AT_declaration resolution is global, so should > > the cache that does it. > > .. except it's not actually global, in that the kernel is not the only > code that will go through the dwarf family of probe processors - > user-space dwarf files are coming its way soon. Plus, if in the > future the systemtap frontend attempts distributed probing of multiple > target systems concurrently, "global" will be even more local. In that context its as global as a lot of the other static data in that structure (like this_session) which would also have to be fixed to do a multiple target system. Regardless, it can become per instance: it will only screw up if dwflpp moves to being short lived. James --- tapsets.cxx | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/tapsets.cxx b/tapsets.cxx index c054d24c..cdc14d61 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -1,6 +1,7 @@ // tapset resolution // Copyright (C) 2005-2008 Red Hat Inc. // Copyright (C) 2005-2007 Intel Corporation. +// Copyright (C) 2008 James.Bottomley@HansenPartnership.com // // This file is part of systemtap, and is free software. You can // redistribute it and/or modify it under the terms of the GNU General @@ -1157,6 +1158,47 @@ struct dwflpp // ----------------------------------------------------------------- + /* The global alias cache is used to resolve any DIE found in a + * module that is stubbed out with DW_AT_declaration with a defining + * DIE found in a different module. The current assumption is that + * this only applies to structures and unions, which have a global + * namespace (it deliberately only traverses program scope), so this + * cache is indexed by name. If other declaration lookups were + * added to it, it would have to be indexed by name and tag + */ + cu_function_cache_t global_alias_cache; + + static int global_alias_caching_callback(Dwarf_Die *die, void *arg) + { + dwflpp *dw = static_cast(arg); + const char *name = dwarf_diename(die); + + if (!name) + return DWARF_CB_OK; + + string structure_name = name; + + if (!dwarf_hasattr(die, DW_AT_declaration) && + dw->global_alias_cache.find(structure_name) == + dw->global_alias_cache.end()) + dw->global_alias_cache[structure_name] = *die; + + return DWARF_CB_OK; + } + + Dwarf_Die *declaration_resolve(Dwarf_Die *die) + { + const char *name = dwarf_diename(die); + + if (!name) + return NULL; + + if (global_alias_cache.find(name) == global_alias_cache.end()) + return NULL; + + return &global_alias_cache[name]; + } + mod_cu_function_cache_t cu_function_cache; static int cu_function_caching_callback (Dwarf_Die* func, void *arg) @@ -1169,6 +1211,16 @@ struct dwflpp int iterate_over_functions (int (* callback)(Dwarf_Die * func, void * arg), void * data); + int iterate_over_globals (int (* callback)(Dwarf_Die *, void *), + void * data); + + int update_alias_cache(void) + { + int rc; + + rc = iterate_over_globals(global_alias_caching_callback, this); + return rc; + } bool has_single_line_record (dwarf_query * q, char const * srcfile, int lineno); @@ -1834,6 +1886,14 @@ struct dwflpp case DW_TAG_structure_type: case DW_TAG_union_type: struct_die = *die; + if (dwarf_hasattr(die, DW_AT_declaration)) + { + Dwarf_Die *tmpdie = dwflpp::declaration_resolve(die); + if (tmpdie == NULL) + throw semantic_error ("unresolved struct " + + string (dwarf_diename_integrate (die) ?: "")); + *die_mem = *tmpdie; + } switch (dwarf_child (die, die_mem)) { case 1: /* No children. */ @@ -2517,6 +2577,37 @@ dwflpp::has_single_line_record (dwarf_query * q, char const * srcfile, int linen return false; } +/* This basically only goes one level down from the compile unit so it + * only picks up top level stuff (i.e. nothing in a lower scope) */ +int +dwflpp::iterate_over_globals (int (* callback)(Dwarf_Die *, void *), + void * data) +{ + int rc = DWARF_CB_OK; + Dwarf_Die die; + + assert (module); + assert (cu); + assert (dwarf_tag(cu) == DW_TAG_compile_unit); + + if (dwarf_child(cu, &die) != 0) + return rc; + + do { + /* We're only currently looking for structures and unions, + * although other types of declarations exist */ + if (dwarf_tag(&die) != DW_TAG_structure_type && + dwarf_tag(&die) != DW_TAG_union_type) + continue; + + rc = (*callback)(&die, data); + if (rc != DWARF_CB_OK) + break; + + } while (dwarf_siblingof(&die, &die) == 0); + + return rc; +} int dwflpp::iterate_over_functions (int (* callback)(Dwarf_Die * func, void * arg), @@ -3505,6 +3596,8 @@ query_cu (Dwarf_Die * cudie, void * arg) { q->dw.focus_on_cu (cudie); + q->dw.update_alias_cache(); + if (false && q->sess.verbose>2) clog << "focused on CU '" << q->dw.cu_name << "', in module '" << q->dw.module_name << "'\n"; -- cgit From a3ee6543b34b773568961e3d48f6ea30e65bc59c Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Tue, 8 Jul 2008 12:38:58 -0500 Subject: Add test suite for declaration resolution This adds the test declaration.exp which checks that specific named declarations inside the kernel both fail and succeed. We get the failure by only using a single compile unit which is currently known to have the structure stubbed. We get exactly the same declaration to succeed by adding a CU that is known to have the declaration. Signed-off-by: James Bottomley --- testsuite/config/unix.exp | 1 + testsuite/lib/stap_compile.exp | 39 +++++++++++++++++++++++++++++++ testsuite/systemtap.base/declaration.exp | 19 +++++++++++++++ testsuite/systemtap.base/marker.exp | 40 -------------------------------- 4 files changed, 59 insertions(+), 40 deletions(-) create mode 100644 testsuite/lib/stap_compile.exp create mode 100644 testsuite/systemtap.base/declaration.exp diff --git a/testsuite/config/unix.exp b/testsuite/config/unix.exp index 625c5604..52560cac 100644 --- a/testsuite/config/unix.exp +++ b/testsuite/config/unix.exp @@ -3,3 +3,4 @@ load_lib "stap_run2.exp" load_lib "stap_run_exact.exp" load_lib "stap_run_binary.exp" load_lib "stap_run.exp" +load_lib "stap_compile.exp" diff --git a/testsuite/lib/stap_compile.exp b/testsuite/lib/stap_compile.exp new file mode 100644 index 00000000..8c6df0ee --- /dev/null +++ b/testsuite/lib/stap_compile.exp @@ -0,0 +1,39 @@ +# stap_compile TEST_NAME flags script args +# - TEST_NAME is the name of the current test +# - compile indicates whether the script is supposed to compile +# - script is the script to compile +# Additional arguments are passed to stap as-is. +proc stap_compile { TEST_NAME compile script args } { + set cmd [concat {stap -v -p4 -e} $script $args] + + verbose -log "running $cmd" + eval spawn $cmd + set compile_errors 0 + expect { + -re {^Pass\ [1234]:[^\r]*\ in\ .*\ ms.\r\n} {exp_continue} + -re {^Pass\ [34]: using cached [^\r\n]+\r\n} {exp_continue} + # pass-4 output + -re {^/[^\r\n]+.ko\r\n} {exp_continue} + -re "parse error" { incr compile_errors 1; exp_continue} + -re "compilation failed" {incr compile_errors 1; exp_continue} + -re "semantic error:" {incr compile_errors 1; exp_continue} + } + catch close + wait + + # If we've got compile errors and the script was supposed to + # compile, fail. + if {$compile_errors > 0} { + if {$compile == 1} { + fail "$TEST_NAME compilation failed" + } else { + pass "$TEST_NAME compilation failed correctly" + } + } else { + if {$compile == 1} { + pass "$TEST_NAME compilation succeeded" + } else { + fail "$TEST_NAME compilation succeeded unexpectedly" + } + } +} diff --git a/testsuite/systemtap.base/declaration.exp b/testsuite/systemtap.base/declaration.exp new file mode 100644 index 00000000..16498819 --- /dev/null +++ b/testsuite/systemtap.base/declaration.exp @@ -0,0 +1,19 @@ +# Declaration tests. Specifically looking for resolution of +# DW_AT_declaration from another module + +set TEST_NAME "RESOLVE_FAIL" + +# this test just makes sure $device is still stubbed with DW_AT_declaration +set failscript { + probe\ module(\"libata\").function(\"ata_qc_issue\")\ \{\ print(\$qc->\$scsicmd->\$device->\$host->\$host_no)\ \}; +} + +stap_compile $TEST_NAME 0 $failscript + +set TEST_NAME "RESOLVE_PASS" + +set passscript { + probe\ module(\"scsi_mod\").function(\"scsi_request_fn\")\ \{print(\$q)\} +} + +stap_compile $TEST_NAME 1 [concat $passscript $failscript ] \ No newline at end of file diff --git a/testsuite/systemtap.base/marker.exp b/testsuite/systemtap.base/marker.exp index 857fa5d2..89c0b8c3 100644 --- a/testsuite/systemtap.base/marker.exp +++ b/testsuite/systemtap.base/marker.exp @@ -3,46 +3,6 @@ # trigger a specific marker). So, we'll try to compile lots of tests # to do as much as we can. -# stap_compile TEST_NAME flags script args -# - TEST_NAME is the name of the current test -# - compile indicates whether the script is supposed to compile -# - script is the script to compile -# Additional arguments are passed to stap as-is. -proc stap_compile { TEST_NAME compile script args } { - set cmd [concat {stap -v -p4 -e} $script $args] - - verbose -log "running $cmd" - eval spawn $cmd - set compile_errors 0 - expect { - -re {^Pass\ [1234]:[^\r]*\ in\ .*\ ms.\r\n} {exp_continue} - -re {^Pass\ [34]: using cached [^\r\n]+\r\n} {exp_continue} - # pass-4 output - -re {^/[^\r\n]+.ko\r\n} {exp_continue} - -re "parse error" { incr compile_errors 1; exp_continue} - -re "compilation failed" {incr compile_errors 1; exp_continue} - -re "semantic error:" {incr compile_errors 1; exp_continue} - } - catch close - wait - - # If we've got compile errors and the script was supposed to - # compile, fail. - if {$compile_errors > 0} { - if {$compile == 1} { - fail "$TEST_NAME compilation failed" - } else { - pass "$TEST_NAME compilation failed correctly" - } - } else { - if {$compile == 1} { - pass "$TEST_NAME compilation succeeded" - } else { - fail "$TEST_NAME compilation succeeded unexpectedly" - } - } -} - # Initialize variables set kernel_markers_found 0 set kernel_marker_names {} -- cgit From 3559f184314739bebe527d279d2513ac5124260f Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 9 Jul 2008 07:14:32 -0400 Subject: add changelog entries for last two changes --- ChangeLog | 6 ++++++ testsuite/ChangeLog | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8ad842ce..ef6f41dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-07-09 Frank Ch. Eigler + + From James Bottomley + * tapsets.cxx: (dwflpp::global_alias_cache): New member. + (declaration_resolve): Search it, called from translate_components. + (update_alias_cache): Populate it, called from query_cu. 2008-07-09 diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 9353cc32..7296f52c 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-07-09 Frank Ch. Eigler + + From : + * systemtap.base/declaration.exp: New test. + * lib/stap_compile.exp: New file, stap_compile moved from ... + * systemtap.base/marker.exp: ... here. 2008-07-01 Wenji Huang -- cgit From 07bd3b82ab643ba1f889c07132074dd0cd8c2d1d Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 9 Jul 2008 11:16:36 -0400 Subject: clarify dejagnu test case name for empty-struct changes --- testsuite/systemtap.base/declaration.exp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testsuite/systemtap.base/declaration.exp b/testsuite/systemtap.base/declaration.exp index 16498819..e47898a7 100644 --- a/testsuite/systemtap.base/declaration.exp +++ b/testsuite/systemtap.base/declaration.exp @@ -1,7 +1,7 @@ # Declaration tests. Specifically looking for resolution of # DW_AT_declaration from another module -set TEST_NAME "RESOLVE_FAIL" +set TEST_NAME "empty-struct resolve-fail" # this test just makes sure $device is still stubbed with DW_AT_declaration set failscript { @@ -10,10 +10,10 @@ set failscript { stap_compile $TEST_NAME 0 $failscript -set TEST_NAME "RESOLVE_PASS" +set TEST_NAME "empty-struct resolve-pass" set passscript { probe\ module(\"scsi_mod\").function(\"scsi_request_fn\")\ \{print(\$q)\} } -stap_compile $TEST_NAME 1 [concat $passscript $failscript ] \ No newline at end of file +stap_compile $TEST_NAME 1 [concat $passscript $failscript ] -- cgit From 25814e6c66b461380bbc9ef8fa263c868983efa6 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 9 Jul 2008 17:14:01 +0200 Subject: Fix PR 6732: Add runtime/autoconf-real-parent.c check for task_struct field. --- ChangeLog | 6 ++++++ buildrun.cxx | 1 + runtime/ChangeLog | 8 ++++++++ runtime/autoconf-real-parent.c | 15 +++++++++++++++ runtime/task_finder.c | 3 ++- tapset/ChangeLog | 7 +++++++ tapset/context.stp | 8 ++++++++ tapset/task.stp | 4 ++++ 8 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 runtime/autoconf-real-parent.c diff --git a/ChangeLog b/ChangeLog index ef6f41dd..14c1ef14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-07-09 Mark Wielaard + + PR 6732 + * buildrun.cxx (compile_pass): Define STAPCONF_REAL_PARENT by + calling autoconf-real-parent.c + 2008-07-09 Frank Ch. Eigler From James Bottomley diff --git a/buildrun.cxx b/buildrun.cxx index a39f2b63..3183fe6b 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -96,6 +96,7 @@ compile_pass (systemtap_session& s) o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-nameidata.c, -DSTAPCONF_NAMEIDATA_CLEANUP,)" << endl; o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-unregister-kprobes.c, -DSTAPCONF_UNREGISTER_KPROBES,)" << endl; o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-module-nsections.c, -DSTAPCONF_MODULE_NSECTIONS,)" << endl; + o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-real-parent.c, -DSTAPCONF_REAL_PARENT,)" << endl; #if 0 /* NB: For now, the performance hit of probe_kernel_read/write (vs. our * homegrown safe-access functions) is deemed undesireable, so we'll skip diff --git a/runtime/ChangeLog b/runtime/ChangeLog index f7f1a5a8..25faffe2 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,11 @@ +2008-07-09 Mark Wielaard + + PR 6732 + * autoconf-real-parent.c: New file. + * task_finder.c (__stp_utrace_task_finder_report_exec): Define + real_parent using STAPCONF_REAL_PARENT. Undefine when no longer + needed. + 2008-07-01 David Smith * task_finder.c (__stp_get_mm_path): Corrected error return code. diff --git a/runtime/autoconf-real-parent.c b/runtime/autoconf-real-parent.c new file mode 100644 index 00000000..010792cb --- /dev/null +++ b/runtime/autoconf-real-parent.c @@ -0,0 +1,15 @@ +/* PR6732 - In RHEL5 and F[678] kernels, the utrace patch removed the + * ptrace-related parent field and renamed real_parent to parent. In + * future Fedora kernels, there may or may not be a ptrace-related + * parent field, but the real useful field will go back to being called + * real_parent. + */ +#include + +struct task_struct t; + +void foo (void) +{ + struct task_struct *p; + p = t.real_parent; +} diff --git a/runtime/task_finder.c b/runtime/task_finder.c index 316a9bc0..fc573eb6 100644 --- a/runtime/task_finder.c +++ b/runtime/task_finder.c @@ -485,7 +485,7 @@ __stp_utrace_task_finder_report_exec(struct utrace_attached_engine *engine, // '/bin/bash' clones and then execs '/bin/ls'. If the user // was probing '/bin/bash', the cloned thread is still // '/bin/bash' up until the exec. -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) +#if ! defined(STAPCONF_REAL_PARENT) #define real_parent parent #endif if (tsk != NULL && tsk->real_parent != NULL @@ -494,6 +494,7 @@ __stp_utrace_task_finder_report_exec(struct utrace_attached_engine *engine, // *could* call exec (although they aren't supposed to). __stp_utrace_attach_match_tsk(tsk->real_parent, tsk, 0, 1); } +#undef real_parent // We assume that all exec's are exec'ing a new process. Note // that we don't use bprm->filename, since that path can be diff --git a/tapset/ChangeLog b/tapset/ChangeLog index b1862324..670f3255 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,10 @@ +2008-07-09 Mark Wielaard + + PR 6732 + * context.stp (ppid): Use STAPCONF_REAL_PARENT. + (pexecname): Likewise. + * task.stp (task_parent): Likewise. + 2008-07-01 Wenji Huang * vfs.stp : Make _vfs.generic_commit_write only for kernel<=2.6.25 diff --git a/tapset/context.stp b/tapset/context.stp index 10c52226..017c934c 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -41,11 +41,19 @@ function tid:long () %{ /* pure */ %} function ppid:long () %{ /* pure */ +#if defined(STAPCONF_REAL_PARENT) + THIS->__retvalue = current->real_parent->tgid; +#else THIS->__retvalue = current->parent->tgid; +#endif %} function pexecname:string () %{ /* pure */ +#if defined(STAPCONF_REAL_PARENT) + strlcpy (THIS->__retvalue, current->real_parent->comm, MAXSTRINGLEN); +#else strlcpy (THIS->__retvalue, current->parent->comm, MAXSTRINGLEN); +#endif %} function gid:long () %{ /* pure */ diff --git a/tapset/task.stp b/tapset/task.stp index d89729e8..9215e83f 100644 --- a/tapset/task.stp +++ b/tapset/task.stp @@ -23,7 +23,11 @@ function task_current:long () %{ /* pure */ // Return the parent task_struct of the given task function task_parent:long (task:long) %{ /* pure */ struct task_struct *t = (struct task_struct *)(long)THIS->task; +#if defined(STAPCONF_REAL_PARENT) + THIS->__retvalue = (long)kread(&(t->real_parent)); +#else THIS->__retvalue = (long)kread(&(t->parent)); +#endif CATCH_DEREF_FAULT(); %} -- cgit From 51a3785482396c9f653e3e7647945bfc24f7b160 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 9 Jul 2008 22:36:46 -0400 Subject: fix shutdown race condition for scripts that might exit during begin probes --- runtime/transport/ChangeLog | 4 ++++ runtime/transport/transport.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog index 3dd65408..0a157390 100644 --- a/runtime/transport/ChangeLog +++ b/runtime/transport/ChangeLog @@ -1,4 +1,8 @@ +2008-07-09 Frank Ch. Eigler + PR5963 + * transport.c (_stp_work_queue): Don't signal a premature exit + if a begin probe happened to exit(). 2008-06-23 Wenji Huang PR 6646 diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c index a4e4e652..8fc06f37 100644 --- a/runtime/transport/transport.c +++ b/runtime/transport/transport.c @@ -160,9 +160,9 @@ static void _stp_work_queue(void *data) wake_up_interruptible(&_stp_ctl_wq); /* if exit flag is set AND we have finished with probe_start() */ - if (unlikely(_stp_exit_flag)) + if (unlikely(_stp_exit_flag && _stp_probes_started)) _stp_cleanup_and_exit(1); - else if (likely(_stp_attached)) + if (likely(_stp_attached)) queue_delayed_work(_stp_wq, &_stp_work, STP_WORK_TIMER); } -- cgit