summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-06-15 11:57:03 -0400
committerDave Brolley <brolley@redhat.com>2009-06-15 11:57:03 -0400
commit148b5d924e05124eae22a27ef670c480de76553a (patch)
tree894d71a8cc22f2c37cc1313154db9a8d1abb8b15
parentc3a47b9b2c204849646eda60e6fff9ea7625f122 (diff)
parentd438dd9bc070216016e02f4958fe9dea571712c9 (diff)
downloadsystemtap-steved-148b5d924e05124eae22a27ef670c480de76553a.tar.gz
systemtap-steved-148b5d924e05124eae22a27ef670c480de76553a.tar.xz
systemtap-steved-148b5d924e05124eae22a27ef670c480de76553a.zip
Merge branch 'master' of git://sources.redhat.com/git/systemtap
-rw-r--r--.mailmap1
-rw-r--r--AUTHORS2
-rw-r--r--NEWS12
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--doc/Language_Reference_Guide/README12
-rw-r--r--systemtap.spec6
-rw-r--r--tapsets.cxx28
-rwxr-xr-xtestsuite/buildok/thirtytwo.stp10
-rwxr-xr-xtestsuite/configure20
-rw-r--r--testsuite/configure.ac2
-rw-r--r--testsuite/systemtap.base/uprobes_lib.c21
-rw-r--r--testsuite/systemtap.base/uprobes_lib.exp46
-rw-r--r--testsuite/systemtap.base/uprobes_lib.stp15
-rw-r--r--testsuite/systemtap.base/uprobes_uname.exp46
-rw-r--r--testsuite/systemtap.base/uprobes_uname.stp7
-rw-r--r--testsuite/systemtap.base/uprobes_ustack.exp97
-rw-r--r--testsuite/systemtap.exelib/cleanup.tcl3
-rw-r--r--testsuite/systemtap.exelib/exelib.exp164
-rw-r--r--testsuite/systemtap.exelib/lib.stp18
-rw-r--r--testsuite/systemtap.exelib/lib.tcl13
-rw-r--r--testsuite/systemtap.exelib/mark.stp10
-rw-r--r--testsuite/systemtap.exelib/mark.tcl11
-rw-r--r--testsuite/systemtap.exelib/uname.stp10
-rw-r--r--testsuite/systemtap.exelib/uname.tcl13
-rw-r--r--testsuite/systemtap.exelib/uprobes_exe.c (renamed from testsuite/systemtap.base/uprobes_exe.c)20
-rw-r--r--testsuite/systemtap.exelib/uprobes_lib.c33
-rw-r--r--testsuite/systemtap.exelib/ustack.stp (renamed from testsuite/systemtap.base/uprobes_ustack.stp)5
-rw-r--r--testsuite/systemtap.exelib/ustack.tcl79
-rw-r--r--util.h2
30 files changed, 452 insertions, 276 deletions
diff --git a/.mailmap b/.mailmap
index b55c9ee3..653dd69e 100644
--- a/.mailmap
+++ b/.mailmap
@@ -54,6 +54,7 @@ K.Prasad <prasad@linux.vnet.ibm.com>
K.Prasad <root@srdronam.in.ibm.com>
Kent Sebastian <root@toddy.(none)>
Prerna Saxena <prerna@linux.vnet.ibm.com>
+Przemysław Pawełczyk <przemyslaw@pawelczyk.it>
Srinivasa DS <srinivasa@in.ibm.com>
Wenji Huang <wjhuang@dhcp-beijing-cdc-10-182-120-233.cn.oracle.com>
William Cohen <wcohen@peloton.usersys.redhat.com>
diff --git a/AUTHORS b/AUTHORS
index 417d6fc0..4ae6c8ff 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -40,7 +40,7 @@ Nobuhiro Tachino
Petr Muller
Phil Muldoon
Prerna Saxena
-Przemyslaw Pawelczyk
+Przemysław Pawełczyk
Rajan Arora
Roland McGrath
Shaohua Li
diff --git a/NEWS b/NEWS
index 6388cc9f..8fa10401 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,17 @@
* What's new
+- Systemwide kernel .function.return (kretprobe) maxactive defaults may
+ be overridden with the -DKRETACTIVE=nnn parameter.
+
+* What's new in version 0.9.8
+
+- Miscellaneous new tapset functions:
+ - sid() returns the session ID of the current process
+ - stringat() indexes a single character from a string.
+
+- Using %M in print formats for hex dumps can now print entire buffers,
+ instead of just small numbers.
+
- Dwarfless syscalls: The nd_syscalls tapset is now available to probe
system calls without requiring kernel debugging information. All of
the same probepoints in the normal syscalls tapset are available with
diff --git a/configure b/configure
index 8a2c7593..d1b39c34 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for systemtap 0.9.7.
+# Generated by GNU Autoconf 2.63 for systemtap 0.9.8.
#
# Report bugs to <systemtap@sources.redhat.com>.
#
@@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='systemtap'
PACKAGE_TARNAME='systemtap'
-PACKAGE_VERSION='0.9.7'
-PACKAGE_STRING='systemtap 0.9.7'
+PACKAGE_VERSION='0.9.8'
+PACKAGE_STRING='systemtap 0.9.8'
PACKAGE_BUGREPORT='systemtap@sources.redhat.com'
# Factoring default headers for most tests.
@@ -1363,7 +1363,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures systemtap 0.9.7 to adapt to many kinds of systems.
+\`configure' configures systemtap 0.9.8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1429,7 +1429,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of systemtap 0.9.7:";;
+ short | recursive ) echo "Configuration of systemtap 0.9.8:";;
esac
cat <<\_ACEOF
@@ -1559,7 +1559,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-systemtap configure 0.9.7
+systemtap configure 0.9.8
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1573,7 +1573,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by systemtap $as_me 0.9.7, which was
+It was created by systemtap $as_me 0.9.8, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -2291,7 +2291,7 @@ fi
# Define the identity of the package.
PACKAGE='systemtap'
- VERSION='0.9.7'
+ VERSION='0.9.8'
cat >>confdefs.h <<_ACEOF
@@ -9383,7 +9383,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by systemtap $as_me 0.9.7, which was
+This file was extended by systemtap $as_me 0.9.8, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -9446,7 +9446,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-systemtap config.status 0.9.7
+systemtap config.status 0.9.8
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/configure.ac b/configure.ac
index 403dfab2..747c549b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
dnl configure.ac --- autoconf input file for systemtap
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([systemtap], 0.9.7, systemtap@sources.redhat.com, systemtap)
+AC_INIT([systemtap], 0.9.8, systemtap@sources.redhat.com, systemtap)
dnl ^^^^^ see also NEWS, systemtap.spec, testsuite/configure.ac
AC_PREREQ(2.59)
diff --git a/doc/Language_Reference_Guide/README b/doc/Language_Reference_Guide/README
index d3175ae3..c99027db 100644
--- a/doc/Language_Reference_Guide/README
+++ b/doc/Language_Reference_Guide/README
@@ -14,3 +14,15 @@ The main source of the Language Reference Guide is in:
As such, any revisions to this document should be applied to ../langref.tex,
not to the source in this directory.
+
+IMPORTANT:
+The publicanize-langref.sh script uses latexml to create the raw XML files
+from langref.tex first before cleaning it up for Publican. You will need
+LaTeXML along with all its required perl modules to use publicanize-langref.sh.
+
+For more information on building from source, downloading, and installing LaTeXML,
+refer to the following URLs:
+
+http://dlmf.nist.gov/LaTeXML/download.html
+http://dlmf.nist.gov/LaTeXML/install.html
+
diff --git a/systemtap.spec b/systemtap.spec
index fab9c41c..d679d969 100644
--- a/systemtap.spec
+++ b/systemtap.spec
@@ -8,7 +8,7 @@
%{!?with_grapher: %define with_grapher 0}
Name: systemtap
-Version: 0.9.7
+Version: 0.9.8
Release: 1%{?dist}
# for version, see also configure.ac
Summary: Instrumentation System
@@ -117,7 +117,6 @@ Summary: Static probe support tools
Group: Development/System
License: GPLv2+
URL: http://sourceware.org/systemtap/
-Requires: systemtap
%description sdt-devel
Support tools to allow applications to use static probes.
@@ -359,6 +358,9 @@ exit 0
%changelog
+* Thu Jun 11 2009 Josh Stone <jistone@redhat.com> - 0.9.8-1
+- Upstream release.
+
* Thu Apr 23 2009 Josh Stone <jistone@redhat.com> - 0.9.7-1
- Upstream release.
diff --git a/tapsets.cxx b/tapsets.cxx
index 76c3c370..20404869 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -695,8 +695,8 @@ dwarf_builder::probe_table::probe_table(string& mark_name, systemtap_session & s
Dwarf_Addr bias;
size_t shstrndx;
- elf = (dwarf_getelf (dwfl_module_getdwarf (dw->module, &bias))
- ?: dwfl_module_getelf (dw->module, &bias));
+ // Explicitly look in the main elf file first.
+ elf = dwfl_module_getelf (dw->module, &bias);
Elf_Scn *probe_scn = NULL;
dwfl_assert ("getshstrndx", elf_getshstrndx (elf, &shstrndx));
@@ -716,17 +716,15 @@ dwarf_builder::probe_table::probe_table(string& mark_name, systemtap_session & s
}
}
- if (!have_probes)
- return;
-
// Older versions put .probes section in the debuginfo dwarf file,
- // so check if it actually exists, if not take the main elf file
- if (have_probes && shdr->sh_type == SHT_NOBITS)
+ // so check if it actually exists, if not take a look in the debuginfo file
+ if (! have_probes || (have_probes && shdr->sh_type == SHT_NOBITS))
{
- elf = dwfl_module_getelf (dw->module, &bias);
+ elf = dwarf_getelf (dwfl_module_getdwarf (dw->module, &bias));
+ if (! elf)
+ return;
dwfl_assert ("getshstrndx", elf_getshstrndx (elf, &shstrndx));
probe_scn = NULL;
- have_probes = false;
while ((probe_scn = elf_nextscn (elf, probe_scn)))
{
shdr = gelf_getshdr (probe_scn, &shdr_mem);
@@ -2907,6 +2905,10 @@ dwarf_derived_probe_group::emit_module_decls (systemtap_session& s)
s.op->newline() << "#endif";
s.op->newline();
+ s.op->newline() << "#ifndef KRETACTIVE";
+ s.op->newline() << "#define KRETACTIVE (max(15,6*NR_CPUS))";
+ s.op->newline() << "#endif";
+
// Forward declare the master entry functions
s.op->newline() << "static int enter_kprobe_probe (struct kprobe *inst,";
s.op->line() << " struct pt_regs *regs);";
@@ -3065,7 +3067,7 @@ dwarf_derived_probe_group::emit_module_init (systemtap_session& s)
s.op->newline() << "if (sdp->maxactive_p) {";
s.op->newline(1) << "kp->u.krp.maxactive = sdp->maxactive_val;";
s.op->newline(-1) << "} else {";
- s.op->newline(1) << "kp->u.krp.maxactive = max(10, 4*NR_CPUS);";
+ s.op->newline(1) << "kp->u.krp.maxactive = KRETACTIVE;";
s.op->newline(-1) << "}";
s.op->newline() << "kp->u.krp.handler = &enter_kretprobe_probe;";
// to ensure safeness of bspcache, always use aggr_kprobe on ia64
@@ -4555,6 +4557,10 @@ kprobe_derived_probe_group::emit_module_decls (systemtap_session& s)
s.op->newline() << "#endif";
s.op->newline();
+ s.op->newline() << "#ifndef KRETACTIVE";
+ s.op->newline() << "#define KRETACTIVE (max(15,6*NR_CPUS))";
+ s.op->newline() << "#endif";
+
// Forward declare the master entry functions
s.op->newline() << "static int enter_kprobe2_probe (struct kprobe *inst,";
s.op->line() << " struct pt_regs *regs);";
@@ -4700,7 +4706,7 @@ kprobe_derived_probe_group::emit_module_init (systemtap_session& s)
s.op->newline() << "if (sdp->maxactive_p) {";
s.op->newline(1) << "kp->u.krp.maxactive = sdp->maxactive_val;";
s.op->newline(-1) << "} else {";
- s.op->newline(1) << "kp->u.krp.maxactive = max(10, 4*NR_CPUS);";
+ s.op->newline(1) << "kp->u.krp.maxactive = KRETACTIVE;";
s.op->newline(-1) << "}";
s.op->newline() << "kp->u.krp.handler = &enter_kretprobe2_probe;";
// to ensure safeness of bspcache, always use aggr_kprobe on ia64
diff --git a/testsuite/buildok/thirtytwo.stp b/testsuite/buildok/thirtytwo.stp
new file mode 100755
index 00000000..d97aa50b
--- /dev/null
+++ b/testsuite/buildok/thirtytwo.stp
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+stap -t -p4 -DKRETACTIVE=8888 -e '
+probe kprobe.function("sys_open").return {}
+probe kprobe.function("sys_open").return.maxactive(100) {}
+probe kernel.function("sys_open").return {}
+probe kernel.function("sys_open").return.maxactive(100) {}
+probe syscall.*.return {}
+'
+
diff --git a/testsuite/configure b/testsuite/configure
index ecee48d8..09db931f 100755
--- a/testsuite/configure
+++ b/testsuite/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for systemtap 0.9.7.
+# Generated by GNU Autoconf 2.63 for systemtap 0.9.8.
#
# Report bugs to <systemtap@sources.redhat.com>.
#
@@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='systemtap'
PACKAGE_TARNAME='systemtap'
-PACKAGE_VERSION='0.9.7'
-PACKAGE_STRING='systemtap 0.9.7'
+PACKAGE_VERSION='0.9.8'
+PACKAGE_STRING='systemtap 0.9.8'
PACKAGE_BUGREPORT='systemtap@sources.redhat.com'
ac_subst_vars='LTLIBOBJS
@@ -1227,7 +1227,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures systemtap 0.9.7 to adapt to many kinds of systems.
+\`configure' configures systemtap 0.9.8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1293,7 +1293,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of systemtap 0.9.7:";;
+ short | recursive ) echo "Configuration of systemtap 0.9.8:";;
esac
cat <<\_ACEOF
@@ -1372,7 +1372,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-systemtap configure 0.9.7
+systemtap configure 0.9.8
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1386,7 +1386,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by systemtap $as_me 0.9.7, which was
+It was created by systemtap $as_me 0.9.8, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -2104,7 +2104,7 @@ fi
# Define the identity of the package.
PACKAGE='systemtap'
- VERSION='0.9.7'
+ VERSION='0.9.8'
cat >>confdefs.h <<_ACEOF
@@ -2749,7 +2749,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by systemtap $as_me 0.9.7, which was
+This file was extended by systemtap $as_me 0.9.8, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -2799,7 +2799,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-systemtap config.status 0.9.7
+systemtap config.status 0.9.8
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/testsuite/configure.ac b/testsuite/configure.ac
index 1a82fe36..62d6e1a8 100644
--- a/testsuite/configure.ac
+++ b/testsuite/configure.ac
@@ -1,7 +1,7 @@
dnl configure.ac --- autoconf input file for systemtap testsuite
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([systemtap], 0.9.7, systemtap@sources.redhat.com, systemtap)
+AC_INIT([systemtap], 0.9.8, systemtap@sources.redhat.com, systemtap)
AC_PREREQ(2.59)
AC_CONFIG_AUX_DIR(..)
diff --git a/testsuite/systemtap.base/uprobes_lib.c b/testsuite/systemtap.base/uprobes_lib.c
deleted file mode 100644
index 25297b6b..00000000
--- a/testsuite/systemtap.base/uprobes_lib.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* uprobes_lib test case - library helper
- * Copyright (C) 2009, Red Hat Inc.
- *
- * 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
- * Public License (GPL); either version 2, or (at your option) any
- * later version.
- */
-
-void
-lib_func (int bar)
-{
- if (bar > 1)
- lib_func (bar - 1);
-}
-
-void
-lib_main ()
-{
- lib_func (3);
-}
diff --git a/testsuite/systemtap.base/uprobes_lib.exp b/testsuite/systemtap.base/uprobes_lib.exp
deleted file mode 100644
index 313c01b6..00000000
--- a/testsuite/systemtap.base/uprobes_lib.exp
+++ /dev/null
@@ -1,46 +0,0 @@
-set test "uprobes_lib"
-set testpath "$srcdir/$subdir"
-set testsrc "$testpath/uprobes_exe.c"
-set testsrclib "$testpath/uprobes_lib.c"
-set testexe "./uprobes_exe"
-set testlibname "uprobes_lib"
-set testlibdir "."
-set testso "$testlibdir/lib${testlibname}.so"
-set testflags "additional_flags=-g additional_flags=-O"
-set testlibflags "$testflags additional_flags=-fPIC additional_flags=-shared"
-set maintestflags "$testflags additional_flags=-L$testlibdir additional_flags=-l$testlibname additional_flags=-Wl,-rpath,$testlibdir"
-
-# Compile our test program and library.
-set res [target_compile $testsrclib $testso executable $testlibflags]
-if { $res != "" } {
- verbose "target_compile for $testso failed: $res" 2
- fail "$test compile $testsrclib"
- return
-} else {
- pass "$test compile $testsrclib"
-}
-
-set res [target_compile $testsrc $testexe executable $maintestflags]
-if { $res != "" } {
- verbose "target_compile failed: $res" 2
- fail "$test compile $testsrc"
- return
-} else {
- pass "$test compile $testsrc"
-}
-
-set ::result_string {main
-main_func
-main_func
-main_func
-lib_main
-lib_func
-lib_func
-lib_func}
-
-# Only run on make installcheck
-if {! [installtest_p]} { untested "$test"; return }
-if {! [utrace_p]} { untested $test; return }
-stap_run2 $srcdir/$subdir/$test.stp -c $testexe
-
-#exec rm -f $testexe $testso
diff --git a/testsuite/systemtap.base/uprobes_lib.stp b/testsuite/systemtap.base/uprobes_lib.stp
deleted file mode 100644
index 459351a4..00000000
--- a/testsuite/systemtap.base/uprobes_lib.stp
+++ /dev/null
@@ -1,15 +0,0 @@
-probe process("uprobes_exe").function("main") {
- printf("main\n");
-}
-
-probe process("uprobes_exe").function("main_func") {
- printf("main_func\n");
-}
-
-probe process("libuprobes_lib.so").function("lib_main") {
- printf("lib_main\n");
-}
-
-probe process("libuprobes_lib.so").function("lib_func") {
- printf("lib_func\n");
-}
diff --git a/testsuite/systemtap.base/uprobes_uname.exp b/testsuite/systemtap.base/uprobes_uname.exp
deleted file mode 100644
index 65e1ff70..00000000
--- a/testsuite/systemtap.base/uprobes_uname.exp
+++ /dev/null
@@ -1,46 +0,0 @@
-set test "uprobes_uname"
-set testpath "$srcdir/$subdir"
-set testsrc "$testpath/uprobes_exe.c"
-set testsrclib "$testpath/uprobes_lib.c"
-set testexe "./uprobes_exe"
-set testlibname "uprobes_lib"
-set testlibdir "."
-set testso "$testlibdir/lib${testlibname}.so"
-set testflags "additional_flags=-g additional_flags=-O"
-set testlibflags "$testflags additional_flags=-fPIC additional_flags=-shared"
-set maintestflags "$testflags additional_flags=-L$testlibdir additional_flags=-l$testlibname additional_flags=-Wl,-rpath,$testlibdir"
-
-# Compile our test program and library.
-set res [target_compile $testsrclib $testso executable $testlibflags]
-if { $res != "" } {
- verbose "target_compile for $testso failed: $res" 2
- fail "$test compile $testsrclib"
- return
-} else {
- pass "$test compile $testsrclib"
-}
-
-set res [target_compile $testsrc $testexe executable $maintestflags]
-if { $res != "" } {
- verbose "target_compile failed: $res" 2
- fail "$test compile $testsrc"
- return
-} else {
- pass "$test compile $testsrc"
-}
-
-set ::result_string {exe: main=main
-exe: main_func=main_func
-exe: main_func=main_func
-exe: main_func=main_func
-lib: lib_main=lib_main
-lib: lib_func=lib_func
-lib: lib_func=lib_func
-lib: lib_func=lib_func}
-
-# Only run on make installcheck
-if {! [installtest_p]} { untested "$test"; return }
-if {! [utrace_p]} { untested $test; return }
-stap_run2 $srcdir/$subdir/$test.stp -c $testexe
-
-#exec rm -f $testexe $testso
diff --git a/testsuite/systemtap.base/uprobes_uname.stp b/testsuite/systemtap.base/uprobes_uname.stp
deleted file mode 100644
index a44d78d3..00000000
--- a/testsuite/systemtap.base/uprobes_uname.stp
+++ /dev/null
@@ -1,7 +0,0 @@
-probe process("uprobes_exe").function("*") {
- printf("exe: %s=%s\n",probefunc(), usymname(uaddr()));
-}
-
-probe process("libuprobes_lib.so").function("*") {
- printf("lib: %s=%s\n",probefunc(), usymname(uaddr()));
-}
diff --git a/testsuite/systemtap.base/uprobes_ustack.exp b/testsuite/systemtap.base/uprobes_ustack.exp
deleted file mode 100644
index bfc435e9..00000000
--- a/testsuite/systemtap.base/uprobes_ustack.exp
+++ /dev/null
@@ -1,97 +0,0 @@
-set test "uprobes_ustack"
-set testpath "$srcdir/$subdir"
-set testsrc "$testpath/uprobes_exe.c"
-set testsrclib "$testpath/uprobes_lib.c"
-set testexe "./uprobes_exe"
-set testlibname "uprobes_lib"
-set testlibdir "."
-set testso "$testlibdir/lib${testlibname}.so"
-set testflags "additional_flags=-g additional_flags=-O"
-set testlibflags "$testflags additional_flags=-fPIC additional_flags=-shared"
-set maintestflags "$testflags additional_flags=-L$testlibdir additional_flags=-l$testlibname additional_flags=-Wl,-rpath,$testlibdir"
-
-# Compile our test program and library.
-set res [target_compile $testsrclib $testso executable $testlibflags]
-if { $res != "" } {
- verbose "target_compile for $testso failed: $res" 2
- fail "$test compile $testsrclib"
- return
-} else {
- pass "$test compile $testsrclib"
-}
-
-set res [target_compile $testsrc $testexe executable $maintestflags]
-if { $res != "" } {
- verbose "target_compile failed: $res" 2
- fail "$test compile $testsrc"
- return
-} else {
- pass "$test compile $testsrc"
-}
-
-set ::result_string {exe: main=main
-exe: main_func=main_func
-exe: main_func=main_func
-exe: main_func=main_func
-lib: lib_main=lib_main
-lib: lib_func=lib_func
-lib: lib_func=lib_func
-lib: lib_func=lib_func}
-
-# Only run on make installcheck
-if {! [installtest_p]} { untested "$test"; return }
-if {! [utrace_p]} { untested $test; return }
-
-# Output is:
-#print_ubacktrace exe 0
-# 0x080484ba : main_func+0xa/0x29 [.../uprobes_exe]
-# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe]
-#print_ustack exe 1
-# 0x080484ba : main_func+0xa/0x29 [.../uprobes_exe]
-# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
-# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe]
-#print_ubacktrace lib 2
-# 0x00db2422 : lib_func+0x16/0x2b [.../libuprobes_lib.so]
-# 0x00db2455 : lib_main+0x1e/0x29 [.../libuprobes_lib.so]
-# 0x080484d0 : main_func+0x20/0x29 [.../uprobes_exe]
-# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
-# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
-# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe]
-#print_ustack lib 3
-# 0x00db2422 : lib_func+0x16/0x2b [.../libuprobes_lib.so]
-# 0x00db2431 : lib_func+0x25/0x2b [.../libuprobes_lib.so]
-# 0x00db2455 : lib_main+0x1e/0x29 [.../libuprobes_lib.so]
-# 0x080484d0 : main_func+0x20/0x29 [.../uprobes_exe]
-# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
-# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
-# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe]
-
-set print 0
-set main 0
-set main_func 0
-set lib_main 0
-set lib_func 0
-# Needs extra space since on 64bit the last ubacktrace string is
-# 7 entries * (16 hex + 2 for 0x + 1 space) = 133 chars.
-# Default MAXSTRINGLEN is 128 chars.
-spawn stap -DMAXSTRINGLEN=133 $srcdir/$subdir/$test.stp -c $testexe
-
-wait
-expect {
- -timeout 60
- -re {^print_[^\r\n]+\r\n} {incr print; exp_continue}
- -re {^ 0x[a-f0-9]+ : main\+0x[^\r\n]+\r\n} {incr main; exp_continue}
- -re {^ 0x[a-f0-9]+ : main_func\+0x[^\r\n]+\r\n} {incr main_func; exp_continue}
- -re {^ 0x[a-f0-9]+ : lib_main\+0x[^\r\n]+\r\n} {incr lib_main; exp_continue}
- -re {^ 0x[a-f0-9]+ : lib_func\+0x[^\r\n]+\r\n} {incr lib_func; exp_continue}
- timeout { fail "$test (timeout)" }
- eof { }
-}
-
-if {$print == 4} {pass "$test print"} {fail "$test print ($print)"}
-if {$main == 4} {pass "$test main"} {fail "$test main ($main)"}
-if {$main_func == 9} {pass "$test main_func"} {fail "$test main_func ($main_func)"}
-if {$lib_main == 2} {pass "$test lib_main"} {fail "$test lib_main ($lib_main)"}
-if {$lib_func == 3} {pass "$test lib_func"} {fail "$test lib_func ($lib_func)"}
-
-#exec rm -f $testexe $testso
diff --git a/testsuite/systemtap.exelib/cleanup.tcl b/testsuite/systemtap.exelib/cleanup.tcl
new file mode 100644
index 00000000..915587d4
--- /dev/null
+++ b/testsuite/systemtap.exelib/cleanup.tcl
@@ -0,0 +1,3 @@
+# Remove exes, libs and (possible) separate .debug files
+catch {exec rm -f $testexe ${testexe}.debug}
+catch {exec rm -f $testlib ${testlib}.debug}
diff --git a/testsuite/systemtap.exelib/exelib.exp b/testsuite/systemtap.exelib/exelib.exp
new file mode 100644
index 00000000..960ebbfa
--- /dev/null
+++ b/testsuite/systemtap.exelib/exelib.exp
@@ -0,0 +1,164 @@
+# Builds various variants of an executable and a shared library
+# (with gcc/g++, -O0/-O3, prelinked/pie, seperate debuginfo)
+# Then runs tests with a list of execs.
+
+set subtestlist {lib mark uname ustack cleanup}
+
+proc seperate_debuginfo {elffile} {
+ set objcopy [list "objcopy" "--only-keep-debug"]
+ lappend objcopy "$elffile"
+ lappend objcopy "${elffile}.debug"
+ send_log "Executing: $objcopy\n"
+ eval exec $objcopy
+
+ set objcopy [list "objcopy" "--strip-debug"]
+ lappend objcopy "$elffile"
+ send_log "Executing: $objcopy\n"
+ eval exec $objcopy
+
+ set objcopy [list "objcopy"]
+ lappend objcopy "--add-gnu-debuglink=${elffile}.debug"
+ lappend objcopy "$elffile"
+ send_log "Executing: $objcopy\n"
+ eval exec $objcopy
+}
+
+set testnames {}
+
+set testpath "$srcdir/$subdir"
+set testsrc "$testpath/uprobes_exe.c"
+set testsrclib "$testpath/uprobes_lib.c"
+set testlibdir "."
+
+set arches [list "default"]
+# BUG! non-default arch breaks ustack tests.
+#switch -regexp $::tcl_platform(machine) {
+# {^(x86_64|ppc64)$} { lappend arches "-m32" }
+# {^s390x$} { lappend arches "-m31" }
+#}
+
+foreach arch $arches {
+
+ foreach compiler {gcc g++} {
+
+ # Just try -O0 and -O3.
+ # Adding -O, -O2, -Os and mixing lib/exe is a bit overdone
+ foreach opt {-O0 -O3} {
+
+ foreach libprelink {no} { # BUG! "yes" breaks uname tests
+
+ # not done yet, "no" lib debug.
+ foreach libdebug {yes sep} {
+
+ set libname "uprobeslib${compiler}${opt}${arch}"
+
+ if {$libprelink == "yes"} {
+ set libname $libname-prelink
+ }
+
+ if {$libdebug == "sep"} {
+ set libname $libname-sep-debug
+ } else {
+ set libname $libname-debug
+ }
+
+ # General compiler flags
+ # We want the sdt.h from the source dir.
+ set testflags "additional_flags=-I$srcdir/../includes/sys"
+ # For now we always require debuginfo
+ set testflags "$testflags additional_flags=-g"
+ if {$arch != "default"} {
+ set testflags "$testflags additional_flags=$arch"
+ }
+ if {$compiler == "g++"} {
+ set testflags "$testflags additional_flags=-x additional_flags=c++"
+ }
+ set testflags "$testflags additional_flags=$opt"
+
+ # Extra flags for libraries
+ set testlibflags "$testflags additional_flags=-fPIC"
+ set testlibflags "$testlibflags additional_flags=-shared"
+
+ set testso "$testlibdir/lib${libname}.so"
+ set res [target_compile $testsrclib $testso executable $testlibflags]
+ if { $res != "" } {
+ verbose "target_compile for $testso failed: $res" 2
+ fail "$libname compile $testsrclib"
+ return
+ } else {
+ pass "$libname compile $testsrclib"
+ }
+
+
+ if {$libdebug == "sep"} {
+ seperate_debuginfo $testso
+ }
+
+ if {$libprelink == "yes"} {
+ set prelink_bin "/usr/sbin/prelink"
+ set addr "-r 0x6400000"
+ set prelink_cmd [concat $prelink_bin -vfNR $addr $testso]
+ send_log "Executing: $prelink_cmd\n"
+ catch {eval exec $prelink_cmd} result
+ verbose -log "result is $result"
+ }
+
+ # should we also prelink exes?
+ foreach exepie {no yes} {
+ # not supported, "no" exe debug.
+ foreach exedebug {yes sep} {
+
+ set exename uprobes$compiler$opt$arch
+
+ # Extra exe compile flags to include lib
+ set testexeflags "$testflags additional_flags=-L$testlibdir additional_flags=-l$libname additional_flags=-Wl,-rpath,$testlibdir"
+
+ if {$exepie == "yes"} {
+ set exename $exename-pie
+ set testexeflags "$testexeflags additional_flags=-fPIE additional_flags=-pie"
+ }
+
+ if {$exedebug == "sep"} {
+ set exename $exename-sep-debug
+ } else {
+ set exename $exename-debug
+ }
+
+ set exename $exename-$libname
+
+ set testexe "$testlibdir/${exename}_exe"
+ set res [target_compile $testsrc $testexe executable $testexeflags]
+ if { $res != "" } {
+ verbose "target_compile for $testexe failed: $res" 2
+ fail "$exename compile $testsrc"
+ return
+ } else {
+ pass "$exename compile $testsrc"
+ }
+
+ if {$exedebug == "sep"} {
+ seperate_debuginfo $testexe
+ }
+
+ set testname "${exename}_${libname}"
+ lappend testnames $testname
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+# Call a test for each exe, set lib to shared library used
+foreach subtest $subtestlist {
+ foreach testname $testnames {
+ set exelib [split $testname {_}]
+ set testexe [lindex $exelib 0]
+ set testexe "${testlibdir}/${testexe}_exe"
+ set testlib [lindex $exelib 1]
+ set testlib "${testlibdir}/lib${testlib}.so"
+ send_log "sourcing: $srcdir/$subdir/$subtest.tcl for $testname\n"
+ source $srcdir/$subdir/$subtest.tcl
+ }
+}
diff --git a/testsuite/systemtap.exelib/lib.stp b/testsuite/systemtap.exelib/lib.stp
new file mode 100644
index 00000000..0151282e
--- /dev/null
+++ b/testsuite/systemtap.exelib/lib.stp
@@ -0,0 +1,18 @@
+// Plain function call probes in executable and shared library
+// Arguments: @1 uprobes_exe, @2 libuprobes_lib.so
+
+probe process(@1).function("main") {
+ printf("main\n");
+}
+
+probe process(@1).function("main_func") {
+ printf("main_func\n");
+}
+
+probe process(@2).function("lib_main") {
+ printf("lib_main\n");
+}
+
+probe process(@2).function("lib_func") {
+ printf("lib_func\n");
+}
diff --git a/testsuite/systemtap.exelib/lib.tcl b/testsuite/systemtap.exelib/lib.tcl
new file mode 100644
index 00000000..d34ac9ff
--- /dev/null
+++ b/testsuite/systemtap.exelib/lib.tcl
@@ -0,0 +1,13 @@
+set ::result_string {main
+main_func
+main_func
+main_func
+lib_main
+lib_func
+lib_func
+lib_func}
+
+# Only run on make installcheck
+if {! [installtest_p]} { untested "lib-$testname"; return }
+if {! [utrace_p]} { untested "lib-$testname"; return }
+stap_run3 lib-$testname $srcdir/$subdir/lib.stp $testexe $testlib -c $testexe
diff --git a/testsuite/systemtap.exelib/mark.stp b/testsuite/systemtap.exelib/mark.stp
new file mode 100644
index 00000000..6b354dff
--- /dev/null
+++ b/testsuite/systemtap.exelib/mark.stp
@@ -0,0 +1,10 @@
+// Markers probes in executable and shared library plus argument.
+// Arguments: @1 uprobes_exe, @2 libuprobes_lib.so
+
+probe process(@1).mark("main_count") {
+ printf("main_count: %d\n", $arg1);
+}
+
+probe process(@2).mark("func_count") {
+ printf("func_count: %d\n", $arg1);
+}
diff --git a/testsuite/systemtap.exelib/mark.tcl b/testsuite/systemtap.exelib/mark.tcl
new file mode 100644
index 00000000..1f21aabc
--- /dev/null
+++ b/testsuite/systemtap.exelib/mark.tcl
@@ -0,0 +1,11 @@
+set ::result_string {main_count: 3
+main_count: 2
+main_count: 1
+func_count: 3
+func_count: 2
+func_count: 1}
+
+# Only run on make installcheck
+if {! [installtest_p]} { untested "lib-$testname"; return }
+if {! [utrace_p]} { untested "lib-$testname"; return }
+stap_run3 mark-$testname $srcdir/$subdir/mark.stp $testexe $testlib -c $testexe
diff --git a/testsuite/systemtap.exelib/uname.stp b/testsuite/systemtap.exelib/uname.stp
new file mode 100644
index 00000000..aaf7ef1f
--- /dev/null
+++ b/testsuite/systemtap.exelib/uname.stp
@@ -0,0 +1,10 @@
+// Prints probefunc() and usymname(uaddr()) to check they are similar.
+// Arguments: @1 uprobes_exe, @2 libuprobes_lib.so
+
+probe process(@1).function("*") {
+ printf("exe: %s=%s\n",probefunc(), usymname(uaddr()));
+}
+
+probe process(@2).function("*") {
+ printf("lib: %s=%s\n",probefunc(), usymname(uaddr()));
+}
diff --git a/testsuite/systemtap.exelib/uname.tcl b/testsuite/systemtap.exelib/uname.tcl
new file mode 100644
index 00000000..804d8f0b
--- /dev/null
+++ b/testsuite/systemtap.exelib/uname.tcl
@@ -0,0 +1,13 @@
+set ::result_string {exe: main=main
+exe: main_func=main_func
+exe: main_func=main_func
+exe: main_func=main_func
+lib: lib_main=lib_main
+lib: lib_func=lib_func
+lib: lib_func=lib_func
+lib: lib_func=lib_func}
+
+# Only run on make installcheck
+if {! [installtest_p]} { untested "uname-$testname"; return }
+if {! [utrace_p]} { untested "uname-$testname; return }
+stap_run3 uname-$testname $srcdir/$subdir/uname.stp $testexe $testlib -c $testexe
diff --git a/testsuite/systemtap.base/uprobes_exe.c b/testsuite/systemtap.exelib/uprobes_exe.c
index b4811335..da65efa7 100644
--- a/testsuite/systemtap.base/uprobes_exe.c
+++ b/testsuite/systemtap.exelib/uprobes_exe.c
@@ -7,23 +7,33 @@
* later version.
*/
-#include <unistd.h>
+#include "sdt.h" /* Really <sys/sdt.h>, but pick current source version. */
// function from our library
int lib_main (void);
-void
+// volatile static variable to prevent folding of main_func
+static volatile int bar;
+
+// Marked noinline and has an empty asm statement to prevent inlining
+// or optimizing away totally.
+int
+__attribute__((noinline))
main_func (int foo)
{
- if (foo > 1)
- main_func (foo - 1);
+ asm ("");
+ STAP_PROBE1(test, main_count, foo);
+ if (foo - bar > 0)
+ bar = main_func (foo - bar);
else
lib_main();
+ return bar;
}
int
main (int argc, char *argv[], char *envp[])
{
- main_func (3);
+ bar = 1;
+ bar = main_func (3);
return 0;
}
diff --git a/testsuite/systemtap.exelib/uprobes_lib.c b/testsuite/systemtap.exelib/uprobes_lib.c
new file mode 100644
index 00000000..e3416d17
--- /dev/null
+++ b/testsuite/systemtap.exelib/uprobes_lib.c
@@ -0,0 +1,33 @@
+/* uprobes_lib test case - library helper
+ * Copyright (C) 2009, Red Hat Inc.
+ *
+ * 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
+ * Public License (GPL); either version 2, or (at your option) any
+ * later version.
+ */
+
+#include "sdt.h" /* Really <sys/sdt.h>, but pick current source version. */
+
+// volatile static variable to prevent folding of lib_func
+static volatile int foo;
+
+// Marked noinline and has an empty asm statement to prevent inlining
+// or optimizing away totally.
+int
+__attribute__((noinline))
+lib_func (int bar)
+{
+ asm ("");
+ STAP_PROBE1(test, func_count, bar);
+ if (bar - foo > 0)
+ foo = lib_func (bar - foo);
+ return foo;
+}
+
+void
+lib_main ()
+{
+ foo = 1;
+ foo = lib_func (3);
+}
diff --git a/testsuite/systemtap.base/uprobes_ustack.stp b/testsuite/systemtap.exelib/ustack.stp
index 6de03b42..314620d8 100644
--- a/testsuite/systemtap.base/uprobes_ustack.stp
+++ b/testsuite/systemtap.exelib/ustack.stp
@@ -1,8 +1,9 @@
// Prints backtrace from lib through exe twice using diffent ustack functions.
+// Arguments: @1 uprobes_exe, @2 libuprobes_lib.so
global hits = 0;
-probe process("uprobes_exe").function("main_func")
+probe process(@1).function("main_func")
{
if (hits == 0)
{
@@ -18,7 +19,7 @@ probe process("uprobes_exe").function("main_func")
}
}
-probe process("libuprobes_lib.so").function("lib_func")
+probe process(@2).function("lib_func")
{
if (hits == 2)
{
diff --git a/testsuite/systemtap.exelib/ustack.tcl b/testsuite/systemtap.exelib/ustack.tcl
new file mode 100644
index 00000000..b70b8334
--- /dev/null
+++ b/testsuite/systemtap.exelib/ustack.tcl
@@ -0,0 +1,79 @@
+set ::result_string {exe: main=main
+exe: main_func=main_func
+exe: main_func=main_func
+exe: main_func=main_func
+lib: lib_main=lib_main
+lib: lib_func=lib_func
+lib: lib_func=lib_func
+ lib: lib_func=lib_func}
+
+# Only run on make installcheck
+if {! [installtest_p]} { untested "ustack-$testname"; return }
+if {! [utrace_p]} { untested "ustack-$testname"; return }
+
+# Output is:
+#print_ubacktrace exe 0
+# 0x080484ba : main_func+0xa/0x29 [.../uprobes_exe]
+# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe]
+#print_ustack exe 1
+# 0x080484ba : main_func+0xa/0x29 [.../uprobes_exe]
+# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
+# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe]
+#print_ubacktrace lib 2
+# 0x00db2422 : lib_func+0x16/0x2b [.../libuprobes_lib.so]
+# 0x00db2455 : lib_main+0x1e/0x29 [.../libuprobes_lib.so]
+# 0x080484d0 : main_func+0x20/0x29 [.../uprobes_exe]
+# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
+# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
+# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe]
+#print_ustack lib 3
+# 0x00db2422 : lib_func+0x16/0x2b [.../libuprobes_lib.so]
+# 0x00db2431 : lib_func+0x25/0x2b [.../libuprobes_lib.so]
+# 0x00db2455 : lib_main+0x1e/0x29 [.../libuprobes_lib.so]
+# 0x080484d0 : main_func+0x20/0x29 [.../uprobes_exe]
+# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
+# 0x080484c9 : main_func+0x19/0x29 [.../uprobes_exe]
+# 0x080484f6 : main+0x1d/0x37 [.../uprobes_exe]
+
+set print 0
+set main 0
+set main_func 0
+set lib_main 0
+set lib_func 0
+# Needs extra space since on 64bit the last ubacktrace string is
+# 7 entries * (16 hex + 2 for 0x + 1 space) = 133 chars.
+# Default MAXSTRINGLEN is 128 chars.
+send_log "Running: stap -DMAXSTRINGLEN=133 $srcdir/$subdir/ustack.stp $testexe $testlib -c $testexe\n"
+spawn stap -DMAXSTRINGLEN=133 $srcdir/$subdir/ustack.stp $testexe $testlib -c $testexe
+
+wait
+expect {
+ -timeout 60
+ -re {^print_[^\r\n]+\r\n} {incr print; exp_continue}
+ -re {^ 0x[a-f0-9]+ : main\+0x[^\r\n]+\r\n} {incr main; exp_continue}
+ -re {^ 0x[a-f0-9]+ : main_func\+0x[^\r\n]+\r\n} {incr main_func; exp_continue}
+ -re {^ 0x[a-f0-9]+ : lib_main\+0x[^\r\n]+\r\n} {incr lib_main; exp_continue}
+ -re {^ 0x[a-f0-9]+ : lib_func\+0x[^\r\n]+\r\n} {incr lib_func; exp_continue}
+ timeout { fail "ustack-$testname (timeout)" }
+ eof { }
+}
+
+if {$print == 4} { pass "ustack-$testname print" } {
+ fail "ustack-$testname print ($print)"
+}
+
+if {$main == 4} { pass "ustack-$testname main" } {
+ fail "ustack-$testname main ($main)"
+}
+
+if {$main_func == 9} { pass "ustack-$testname main_func" } {
+ fail "ustack-$testname main_func ($main_func)"
+}
+
+if {$lib_main == 2} { pass "ustack-$testname lib_main" } {
+ fail "ustack-$testname lib_main ($lib_main)"
+}
+
+if {$lib_func == 3} { pass "ustack-$testname lib_func" } {
+ fail "ustack-$testname lib_func ($lib_func)"
+}
diff --git a/util.h b/util.h
index d249a71b..4921cef7 100644
--- a/util.h
+++ b/util.h
@@ -72,7 +72,7 @@ lex_cast_qstring(IN const & in)
out2 += '"';
for (unsigned i=0; i<out.length(); i++)
{
- char c = out[i];
+ unsigned char c = out[i];
if (! isprint(c))
{
out2 += '\\';