summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfche <fche>2007-07-02 19:40:50 +0000
committerfche <fche>2007-07-02 19:40:50 +0000
commit35a04c8ed90f82fd0b6ec28c1f9413c7273361c6 (patch)
tree411e31714e07b4ce35db24776ef58d1eee3668ed
parent6deb97532a3cd8f2b6cd8bf34dc903232fd65f6b (diff)
downloadsystemtap-steved-35a04c8ed90f82fd0b6ec28c1f9413c7273361c6.tar.gz
systemtap-steved-35a04c8ed90f82fd0b6ec28c1f9413c7273361c6.tar.xz
systemtap-steved-35a04c8ed90f82fd0b6ec28c1f9413c7273361c6.zip
2007-07-02 Frank Ch. Eigler <fche@rechat.com>
* staplog.c: New file from Satoru MORIYA <satoru.moriya.br@hitachi.com>, prototype crash(8) extension module. * configure.ac: Look for crash/defs.h. * Makefile.am: Build/install staplog.so shared library if found. * configure, Makefile, config.in, runtime/lket/b2a/Makefile.in: Regenerated.
-rw-r--r--ChangeLog11
-rw-r--r--Makefile.am17
-rw-r--r--Makefile.in43
-rw-r--r--config.in6
-rwxr-xr-xconfigure341
-rw-r--r--configure.ac9
-rw-r--r--runtime/lket/b2a/Makefile.in2
-rw-r--r--staplog.c401
8 files changed, 562 insertions, 268 deletions
diff --git a/ChangeLog b/ChangeLog
index 06a8c776..c12f18b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,19 @@
+2007-07-02 Frank Ch. Eigler <fche@rechat.com>
+
+ * staplog.c: New file from Satoru MORIYA
+ <satoru.moriya.br@hitachi.com>, prototype crash(8) extension module.
+ * configure.ac: Look for crash/defs.h.
+ * Makefile.am: Build/install staplog.so shared library if found.
+ * configure, Makefile, config.in, runtime/lket/b2a/Makefile.in:
+ Regenerated.
+
2007-07-02 William Cohen <wcohen@redhat.com>
+
PR 4720
* staptree.cxx (probe_point::print): Remove stray output.
2007-06-29 William Cohen <wcohen@redhat.com>
+
PR 4529
* configure.ac:
* Makefile.am: Limit where sqlite3 linked in.
diff --git a/Makefile.am b/Makefile.am
index 51b3e5bb..1cda3601 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -70,6 +70,18 @@ loc2c_test_LDADD = $(stap_LDADD)
stap_merge_SOURCES = runtime/staprun/stap_merge.c
stap_merge_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS)
+# crash(8) extension
+if BUILD_CRASHMOD
+STAPLOG=staplog.so
+
+$(STAPLOG): staplog.c
+ $(CC) -shared -rdynamic $(LDFLAGS) $(CFLAGS) -fPIC -o $@ $<
+all-local: $(STAPLOG)
+install-exec-local: $(STAPLOG)
+ $(INSTALL) $(STAPLOG) $(pkglibdir)
+else
+endif
+
# Get extra libs as needed
LDADD =
@@ -127,11 +139,14 @@ clean-local:
rm -rf ${PACKAGE_TARNAME}-${PACKAGE_VERSION}
rm -rf $(TEST_COV_DIR)
rm -rf stap.info
+ rm -rf staplog.so
uninstall-local:
rm -rf $(DESTDIR)$(pkgdatadir)
rm -rf $(DESTDIR)$(libexecdir)/$(PACKAGE)
+ rm -rf $(DESTDIR)$(libdir)/$(PACKAGE)
-rm -rf $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)
+# XXX: leaves behind man pages
SUBDIRS = testsuite
if BUILD_LKET_B2A
@@ -145,5 +160,3 @@ check:
installcheck:
$(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)"
-
-# env SYSTEMTAP_RUNTIME=$(DESTDIR)$(pkgdatadir)/runtime SYSTEMTAP_TAPSET=$(DESTDIR)$(pkgdatadir)/tapset $(MAKE) LD_LIBRARY_PATH=$(DESTDIR)$(libdir)/systemtap PATH=$(DESTDIR)$(bindir):$$PATH -C testsuite installcheck
diff --git a/Makefile.in b/Makefile.in
index a58a26da..aea6e217 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -62,7 +62,8 @@ DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \
$(top_srcdir)/man/stapprobes.socket.5.in \
$(top_srcdir)/man/stapprobes.tcp.5.in \
$(top_srcdir)/man/stapprobes.udp.5.in AUTHORS COPYING \
- ChangeLog INSTALL NEWS compile depcomp install-sh missing
+ ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \
+ install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -172,7 +173,6 @@ CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
-CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
@@ -295,6 +295,9 @@ loc2c_test_LDADD = $(stap_LDADD)
stap_merge_SOURCES = runtime/staprun/stap_merge.c
stap_merge_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS)
+# crash(8) extension
+@BUILD_CRASHMOD_TRUE@STAPLOG = staplog.so
+
# Get extra libs as needed
LDADD =
EXTRA_DIST = buildrun.h elaborate.h loc2c.h session.h \
@@ -312,6 +315,7 @@ SAMPLE_SRC = $(srcdir)/testsuite/systemtap.samples/iotask.stp \
$(srcdir)/testsuite/systemtap.samples/topsys.stp
TEST_COV_DIR = coverage
+# XXX: leaves behind man pages
SUBDIRS = testsuite $(am__append_4)
SRCDIR = $(shell cd $(srcdir); pwd)
all: $(BUILT_SOURCES) config.h
@@ -1248,7 +1252,8 @@ distcleancheck: distclean
check-am: all-am
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-recursive
-all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS) config.h
+@BUILD_CRASHMOD_FALSE@all-local:
+all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS) config.h all-local
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkglibexecdir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \
@@ -1279,7 +1284,7 @@ maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-@BUILD_ELFUTILS_FALSE@install-exec-local:
+@BUILD_CRASHMOD_FALSE@@BUILD_ELFUTILS_FALSE@install-exec-local:
clean: clean-recursive
clean-am: clean-binPROGRAMS clean-generic clean-local \
@@ -1349,16 +1354,16 @@ uninstall-man: uninstall-man1 uninstall-man5 uninstall-man8
install-strip
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am am--refresh check check-am clean clean-binPROGRAMS \
- clean-generic clean-local clean-noinstPROGRAMS ctags \
- ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \
- 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 \
- install-binPROGRAMS install-data install-data-am \
- install-data-local install-dvi install-dvi-am install-exec \
- install-exec-am install-exec-local install-html \
+ all all-am all-local am--refresh check check-am clean \
+ clean-binPROGRAMS clean-generic clean-local \
+ clean-noinstPROGRAMS ctags ctags-recursive dist dist-all \
+ dist-bzip2 dist-gzip dist-hook 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 install-binPROGRAMS install-data \
+ install-data-am install-data-local install-dvi install-dvi-am \
+ install-exec install-exec-am install-exec-local install-html \
install-html-am install-info install-info-am install-man \
install-man1 install-man5 install-man8 install-pdf \
install-pdf-am install-pkglibexecSCRIPTS install-ps \
@@ -1386,6 +1391,12 @@ uninstall-man: uninstall-man1 uninstall-man5 uninstall-man8
@BUILD_ELFUTILS_TRUE@ done
@BUILD_ELFUTILS_TRUE@install-exec-local: install-elfutils
+@BUILD_CRASHMOD_TRUE@$(STAPLOG): staplog.c
+@BUILD_CRASHMOD_TRUE@ $(CC) -shared -rdynamic $(LDFLAGS) $(CFLAGS) -fPIC -o $@ $<
+@BUILD_CRASHMOD_TRUE@all-local: $(STAPLOG)
+@BUILD_CRASHMOD_TRUE@install-exec-local: $(STAPLOG)
+@BUILD_CRASHMOD_TRUE@ $(INSTALL) $(STAPLOG) $(pkglibdir)
+
# Copy some of the testsuite sample scripts to the distdir
# 'examples/samples' directory.
dist-add-samples: $(SAMPLE_SRC)
@@ -1423,10 +1434,12 @@ clean-local:
rm -rf ${PACKAGE_TARNAME}-${PACKAGE_VERSION}
rm -rf $(TEST_COV_DIR)
rm -rf stap.info
+ rm -rf staplog.so
uninstall-local:
rm -rf $(DESTDIR)$(pkgdatadir)
rm -rf $(DESTDIR)$(libexecdir)/$(PACKAGE)
+ rm -rf $(DESTDIR)$(libdir)/$(PACKAGE)
-rm -rf $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)
check:
@@ -1434,8 +1447,6 @@ check:
installcheck:
$(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)"
-
-# env SYSTEMTAP_RUNTIME=$(DESTDIR)$(pkgdatadir)/runtime SYSTEMTAP_TAPSET=$(DESTDIR)$(pkgdatadir)/tapset $(MAKE) LD_LIBRARY_PATH=$(DESTDIR)$(libdir)/systemtap PATH=$(DESTDIR)$(bindir):$$PATH -C testsuite installcheck
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/config.in b/config.in
index 326ecb27..f9b13645 100644
--- a/config.in
+++ b/config.in
@@ -6,6 +6,9 @@
/* make -P prologue-searching default */
#undef ENABLE_PROLOGUES
+/* Define to 1 if you have the <crash/defs.h> header file. */
+#undef HAVE_CRASH_DEFS_H
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -18,6 +21,9 @@
/* Define to 1 if you have the `pfm' library (-lpfm). */
#undef HAVE_LIBPFM
+/* Define to 1 if you have the `sqlite3' library (-lsqlite3). */
+#undef HAVE_LIBSQLITE3
+
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
diff --git a/configure b/configure
index a9f05f6c..556456f1 100755
--- a/configure
+++ b/configure
@@ -711,8 +711,9 @@ BUILD_ELFUTILS_FALSE
elfutils_abs_srcdir
BUILD_LKET_B2A_TRUE
BUILD_LKET_B2A_FALSE
+BUILD_CRASHMOD_TRUE
+BUILD_CRASHMOD_FALSE
MYSQL_CONFIG
-CXXCPP
HAS_MYSQL_TRUE
HAS_MYSQL_FALSE
HAS_MYSQL_CONFIG_TRUE
@@ -735,8 +736,7 @@ CPPFLAGS
CXX
CXXFLAGS
CCC
-CPP
-CXXCPP'
+CPP'
ac_subdirs_all='testsuite'
# Initialize some variables set by options.
@@ -1338,7 +1338,6 @@ Some influential environment variables:
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CPP C preprocessor
- CXXCPP C++ preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -5576,12 +5575,6 @@ fi
done
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
@@ -5818,7 +5811,6 @@ fi
if test $perfmon_support = yes; then
-
{ echo "$as_me:$LINENO: checking for pfm_start in -lpfm" >&5
echo $ECHO_N "checking for pfm_start in -lpfm... $ECHO_C" >&6; }
if test "${ac_cv_lib_pfm_pfm_start+set}" = set; then
@@ -5862,7 +5854,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
- test -z "$ac_cxx_werror_flag" ||
+ test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
@@ -5974,7 +5966,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
- test -z "$ac_cxx_werror_flag" ||
+ test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
@@ -6047,6 +6039,78 @@ else
fi
+
+
+for ac_header in crash/defs.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#define NR_CPUS 256
+
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ build_crashmod=yes
+else
+ build_crashmod=no
+fi
+
+done
+
+ if test $build_crashmod = yes; then
+ BUILD_CRASHMOD_TRUE=
+ BUILD_CRASHMOD_FALSE='#'
+else
+ BUILD_CRASHMOD_TRUE='#'
+ BUILD_CRASHMOD_FALSE=
+fi
+
+
mysql=false
SAVE_LDFLAGS=$LDFLAGS
@@ -6103,233 +6167,6 @@ else
LDFLAGS="`mysql_config --libs` $LDFLAGS"
fi
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
-echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; }
-if test -z "$CXXCPP"; then
- if test "${ac_cv_prog_CXXCPP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Double quotes because CXXCPP needs to be expanded
- for CXXCPP in "$CXX -E" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_cxx_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- }; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- break
-fi
-
- done
- ac_cv_prog_CXXCPP=$CXXCPP
-
-fi
- CXXCPP=$ac_cv_prog_CXXCPP
-else
- ac_cv_prog_CXXCPP=$CXXCPP
-fi
-{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
-echo "${ECHO_T}$CXXCPP" >&6; }
-ac_preproc_ok=false
-for ac_cxx_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- }; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
-else
- { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-
for ac_header in mysql/mysql.h
do
@@ -6370,7 +6207,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
- test -z "$ac_cxx_werror_flag" ||
+ test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_header_compiler=yes
@@ -6409,7 +6246,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null && {
- test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then
ac_header_preproc=yes
@@ -6425,7 +6262,7 @@ rm -f conftest.err conftest.$ac_ext
echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
@@ -6513,7 +6350,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
- test -z "$ac_cxx_werror_flag" ||
+ test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
@@ -6620,7 +6457,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
- test -z "$ac_cxx_werror_flag" ||
+ test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
@@ -6696,7 +6533,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
- test -z "$ac_cxx_werror_flag" ||
+ test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
@@ -6908,6 +6745,13 @@ echo "$as_me: error: conditional \"BUILD_LKET_B2A\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${BUILD_CRASHMOD_TRUE}" && test -z "${BUILD_CRASHMOD_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"BUILD_CRASHMOD\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_CRASHMOD\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${HAS_MYSQL_TRUE}" && test -z "${HAS_MYSQL_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"HAS_MYSQL\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -7614,8 +7458,9 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
+BUILD_CRASHMOD_TRUE!$BUILD_CRASHMOD_TRUE$ac_delim
+BUILD_CRASHMOD_FALSE!$BUILD_CRASHMOD_FALSE$ac_delim
MYSQL_CONFIG!$MYSQL_CONFIG$ac_delim
-CXXCPP!$CXXCPP$ac_delim
HAS_MYSQL_TRUE!$HAS_MYSQL_TRUE$ac_delim
HAS_MYSQL_FALSE!$HAS_MYSQL_FALSE$ac_delim
HAS_MYSQL_CONFIG_TRUE!$HAS_MYSQL_CONFIG_TRUE$ac_delim
@@ -7628,7 +7473,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 12; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 13; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/configure.ac b/configure.ac
index 2fd7f311..a94274d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,6 @@ AC_PROG_CPP
AM_PROG_CC_STDC
AM_PROG_CC_C_O
AM_C_PROTOTYPES
-AC_LANG_CPLUSPLUS
AC_PROG_RANLIB
AC_OBJEXT
AC_EXEEXT
@@ -98,6 +97,14 @@ AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes],
AM_CONDITIONAL(BUILD_LKET_B2A, pkg-config --atleast-version 2.0.0 glib-2.0)
+
+AC_CHECK_HEADERS(crash/defs.h,
+ build_crashmod=yes,build_crashmod=no,
+ [
+#define NR_CPUS 256
+])
+AM_CONDITIONAL(BUILD_CRASHMOD, test $build_crashmod = yes)
+
mysql=false
SAVE_LDFLAGS=$LDFLAGS
diff --git a/runtime/lket/b2a/Makefile.in b/runtime/lket/b2a/Makefile.in
index 4c3aac35..7b061034 100644
--- a/runtime/lket/b2a/Makefile.in
+++ b/runtime/lket/b2a/Makefile.in
@@ -77,7 +77,6 @@ CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
-CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
@@ -157,6 +156,7 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
+sqlite3_LIBS = @sqlite3_LIBS@
srcdir = @srcdir@
stap_LIBS = @stap_LIBS@
subdirs = @subdirs@
diff --git a/staplog.c b/staplog.c
new file mode 100644
index 00000000..645f7441
--- /dev/null
+++ b/staplog.c
@@ -0,0 +1,401 @@
+/*
+ crash shared object for retrieving systemtap buffer
+ Copyright (c) 2007 Hitachi,Ltd.,
+ Created by Satoru Moriya &lt;satoru.moriya.br@hitachi.com&gt;
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+
+/* crash/defs.h defines NR_CPUS based upon architecture macros
+ X86, X86_64, etc. See crash/configure.c (!). */
+#ifdef __alpha__
+#define ALPHA
+#endif
+#ifdef __i386__
+#define X86
+#endif
+#ifdef __powerpc__
+#define PPC
+#endif
+#ifdef __ia64__
+#define IA64
+#endif
+#ifdef __s390__
+#define S390
+#endif
+#ifdef __s390x__
+#define S390X
+#endif
+#ifdef __powerpc64__
+#define PPC64
+#endif
+#ifdef __x86_64__
+#define X86_64
+#endif
+
+#include <crash/defs.h>
+
+#define STPLOG_NO_MOD -1
+#define STPLOG_NO_SYM -2
+
+struct rchan_offsets {
+ long subbuf_size;
+ long n_subbufs;
+ long buf;
+ long buf_start;
+ long buf_offset;
+ long buf_subbufs_produced;
+ long buf_padding;
+};
+
+struct fake_rchan_buf {
+ void *start;
+ size_t offset;
+ size_t subbufs_produced;
+ size_t *padding;
+};
+
+struct fake_rchan {
+ size_t subbuf_size;
+ size_t n_subbufs;
+};
+
+struct per_cpu_data {
+ struct fake_rchan_buf buf;
+};
+
+static struct rchan_offsets rchan_offsets;
+static struct fake_rchan chan;
+static struct per_cpu_data per_cpu[NR_CPUS];
+static FILE *outfp;
+static char *subbuf;
+static int is_global;
+static int old_format;
+
+void cmd_staplog(void);
+void cmd_staplog_cleanup(void);
+char *help_staplog[];
+char *help_staplog_cleanup[];
+
+static struct command_table_entry command_table[] = {
+ {"staplog", cmd_staplog, help_staplog, 0},
+ {"staplog_cleanup", cmd_staplog_cleanup, help_staplog_cleanup, CLEANUP},
+ {NULL, NULL, NULL, 0},
+};
+
+static void get_rchan_offsets(void)
+{
+ rchan_offsets.subbuf_size = MEMBER_OFFSET("rchan", "subbuf_size");
+ if (rchan_offsets.subbuf_size < 0)
+ goto ERR;
+ rchan_offsets.n_subbufs = MEMBER_OFFSET("rchan", "n_subbufs");
+ if (rchan_offsets.n_subbufs < 0)
+ goto ERR;
+ rchan_offsets.buf = MEMBER_OFFSET("rchan", "buf");
+ if (rchan_offsets.buf < 0)
+ goto ERR;
+ rchan_offsets.buf_start = MEMBER_OFFSET("rchan_buf", "start");
+ if (rchan_offsets.buf_start < 0)
+ goto ERR;
+ rchan_offsets.buf_offset = MEMBER_OFFSET("rchan_buf", "offset");
+ if (rchan_offsets.buf_offset < 0)
+ goto ERR;
+ rchan_offsets.buf_subbufs_produced
+ = MEMBER_OFFSET("rchan_buf", "subbufs_produced");
+ if (rchan_offsets.buf_subbufs_produced < 0)
+ goto ERR;
+ rchan_offsets.buf_padding = MEMBER_OFFSET("rchan_buf", "padding");
+ if (rchan_offsets.buf_padding < 0)
+ goto ERR;
+ return;
+ERR:
+ error(FATAL, "cannot get rchan offset\n");
+}
+
+static ulong get_rchan(ulong chan_addr)
+{
+ ulong rchan;
+
+ readmem(chan_addr, KVADDR, &rchan, sizeof(void*),
+ "stp_channel", FAULT_ON_ERROR);
+ readmem(rchan + rchan_offsets.subbuf_size,
+ KVADDR, &chan.subbuf_size, sizeof(size_t),
+ "stp_channel.subbuf_size", FAULT_ON_ERROR);
+ readmem(rchan + rchan_offsets.n_subbufs,
+ KVADDR, &chan.n_subbufs, sizeof(size_t),
+ "stp_channel.n_subbufs", FAULT_ON_ERROR);
+ return rchan;
+}
+
+static void get_rchan_buf(int cpu, ulong rchan)
+{
+ ulong rchan_buf;
+ struct per_cpu_data *pcd;
+
+ pcd = &per_cpu[cpu];
+ readmem(rchan + rchan_offsets.buf + sizeof(void*) * cpu,
+ KVADDR, &rchan_buf, sizeof(void*),
+ "stp_channel.buf", FAULT_ON_ERROR);
+ readmem(rchan_buf + rchan_offsets.buf_start,
+ KVADDR, &pcd->buf.start, sizeof(void*),
+ "stp_channel.buf.start", FAULT_ON_ERROR);
+ readmem(rchan_buf + rchan_offsets.buf_offset,
+ KVADDR, &pcd->buf.offset, sizeof(size_t),
+ "stp_channel.buf.offset", FAULT_ON_ERROR);
+ readmem(rchan_buf + rchan_offsets.buf_subbufs_produced,
+ KVADDR, &pcd->buf.subbufs_produced, sizeof(size_t),
+ "stp_channel.buf.subbufs_produced", FAULT_ON_ERROR);
+ readmem(rchan_buf + rchan_offsets.buf_padding,
+ KVADDR, &pcd->buf.padding, sizeof(size_t*),
+ "stp_channel.buf.padding", FAULT_ON_ERROR);
+ return;
+}
+
+static ulong get_rchan_addr(ulong stp_utt_addr)
+{
+ ulong stp_utt;
+
+ readmem(stp_utt_addr, KVADDR, &stp_utt, sizeof(void*),
+ "stp_utt", FAULT_ON_ERROR);
+ return (stp_utt + sizeof(int));
+}
+
+static int check_global_buffer(ulong rchan)
+{
+ int cpu;
+ ulong rchan_buf[2];
+
+ for (cpu = 0; cpu < 2; cpu++) {
+ readmem(rchan + rchan_offsets.buf + sizeof(void*) * cpu,
+ KVADDR, &rchan_buf[cpu], sizeof(void*),
+ "stp_channel.buf", FAULT_ON_ERROR);
+ }
+ if (rchan_buf[0] == rchan_buf[1])
+ return 1;
+ return 0;
+}
+
+static void setup_global_data(char *module)
+{
+ int i;
+ ulong stp_utt_addr = 0;
+ ulong stp_rchan_addr = 0;
+ ulong rchan;
+
+ stp_utt_addr = symbol_value_module("_stp_utt", module);
+ if (stp_utt_addr == 0) {
+ stp_rchan_addr = symbol_value_module("_stp_chan", module);
+ if (stp_rchan_addr == 0) {
+ error(FATAL, "Failed to find _stp_utt/_stp_chan.\n",
+ module);
+ }
+ old_format = 1;
+ } else {
+ stp_rchan_addr = get_rchan_addr(stp_utt_addr);
+ if (stp_rchan_addr == 0) {
+ error(FATAL, "Failed to find _stp_utt/_stp_chan.\n",
+ module);
+ }
+ }
+ rchan = get_rchan(stp_rchan_addr);
+ for (i = 0; i < kt->cpus; i++)
+ get_rchan_buf(i, rchan);
+
+ if (kt->cpus > 1) {
+ is_global = check_global_buffer(rchan);
+ }
+ return;
+}
+
+static void output_cpu_logs(char *filename)
+{
+ int i, max = 256;
+ struct per_cpu_data *pcd;
+ size_t n, idx, start, end, ready, len;
+ unsigned padding;
+ char fname[max + 1], *source;
+ DIR *dir;
+
+ /* check and create log directory */
+ dir = opendir(filename);
+ if (dir) {
+ closedir(dir);
+ } else {
+ if (mkdir(filename, S_IRWXU) < 0) {
+ error(FATAL, "cannot create log directory '%s\n'", filename);
+ }
+ }
+
+ /* allocate subbuf memory */
+ subbuf = GETBUF(chan.subbuf_size);
+ if (!subbuf) {
+ error(FATAL, "cannot allocate memory\n");
+ }
+
+ fname[max] = '\0';
+ for (i = 0; i < kt->cpus; i++) {
+ int adjust = 0;
+ pcd = &per_cpu[i];
+
+ if (pcd->buf.offset == 0 ||
+ pcd->buf.offset == chan.subbuf_size + 1) {
+ adjust = 0;
+ } else {
+ adjust = 1;
+ }
+ ready = pcd->buf.subbufs_produced + adjust;
+
+ if (ready > chan.n_subbufs) {
+ start = ready;
+ end = start + chan.n_subbufs;
+ } else {
+ start = 0;
+ end = ready;
+ }
+ /* print information */
+ fprintf(fp, "--- generating 'cpu%d' ---\n", i);
+ fprintf(fp, " subbufs ready on relayfs:%ld\n", (long)ready);
+ fprintf(fp, " n_subbufs:%ld, read from:%ld to:%ld (offset:%ld)\n\n",
+ (long)chan.n_subbufs, (long)start, (long)end, (long)pcd->buf.offset);
+
+ /* create log file */
+ snprintf(fname, max, "%s/cpu%d", filename, i);
+ outfp = fopen(fname, "w");
+ if (!outfp) {
+ error(FATAL, "cannot create log file '%s'\n", fname);
+ }
+ for (n = start; n < end; n++) {
+ /* read relayfs subbufs and write to log file */
+ idx = n % chan.n_subbufs;
+ source = pcd->buf.start + idx * chan.subbuf_size;
+ readmem((ulong)pcd->buf.padding + sizeof(padding) * idx,
+ KVADDR, &padding, sizeof(padding),
+ "padding", FAULT_ON_ERROR);
+ if (n == end - 1 && 0 < pcd->buf.offset &&
+ pcd->buf.offset < chan.subbuf_size) {
+ len = pcd->buf.offset;
+ } else {
+ len = chan.subbuf_size;
+ }
+ if (old_format == 1) {
+ source += sizeof(padding);
+ len -= sizeof(padding) + padding;
+ } else {
+ len -= padding;
+ }
+ if (len) {
+ readmem((ulong)source, KVADDR, subbuf, len,
+ "subbuf", FAULT_ON_ERROR);
+ if (fwrite(subbuf, len, 1, outfp) != 1) {
+ error(FATAL, "cannot write log data\n");
+ }
+ }
+ }
+ fclose(outfp);
+ outfp = NULL;
+ if (is_global == 1)
+ break;
+ }
+ if (subbuf) {
+ FREEBUF(subbuf);
+ subbuf = NULL;
+ }
+ return;
+}
+
+static void do_staplog(char *module, char *filename)
+{
+ setup_global_data(module);
+ output_cpu_logs(filename);
+ return;
+}
+
+void cmd_staplog(void)
+{
+
+ int c;
+ char *module = NULL;
+ char *filename = NULL;
+
+ while ((c = getopt(argcnt, args, "o:")) != EOF) {
+ switch (c) {
+ case 'o':
+ filename = optarg;
+ break;
+ default:
+ argerrs++;
+ break;
+ }
+ }
+ module = args[optind];
+
+ if (!module || argerrs)
+ cmd_usage(pc->curcmd, SYNOPSIS);
+
+ if (filename == NULL && module != NULL)
+ filename = module;
+ do_staplog(module, filename);
+ return;
+}
+
+void cmd_staplog_cleanup(void)
+{
+ if (outfp) {
+ fclose(outfp);
+ outfp = NULL;
+ }
+ return;
+}
+
+char *help_staplog[] = {
+ "systemtaplog",
+ "Retrieve SystemTap log data",
+ "[-o dir_name] module_name",
+ " Retrieve SystemTap's log data and write them to files.\n",
+ " module_name All valid SystemTap log data made by the trace",
+ " module which name is 'module_name' are written",
+ " into log files. If you don't use -o option, the",
+ " log files are created in `module_name` directory.",
+ " The name of each log file is cpu0, cpu1...cpuN. ",
+ " They have same format data as channel buffer",
+ " except padding(This command removes padding). ",
+ "",
+ " -o file_name Specify the output directory.",
+ NULL,
+};
+
+char *help_staplog_cleanup[] = {
+ "systemtaplog cleanup (hidden)",
+ "Cleanup command for staplog",
+ "",
+ " This command is called during restore_sanity() prior to each ",
+ " command prompt to close the files which was opened and failed to",
+ " close by staplog command.",
+ NULL,
+};
+
+static void __attribute__ ((constructor)) _init(void)
+{
+ get_rchan_offsets();
+ register_extension(command_table);
+ return;
+}
+
+
+static void __attribute__ ((destructor)) _fini(void)
+{
+ return;
+}