summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2007-10-05 15:03:17 -0400
committerFrank Ch. Eigler <fche@elastic.org>2007-10-05 15:03:17 -0400
commite400d0192edc3a8d39ed8e87414fe2faa8cbbf69 (patch)
tree374015c0f1693e1c9491836b1dc43401c54d9f08
parentfdcb26bc8815c4dc31a2a869b4ab376675ef546f (diff)
parent8f3c45cc3da3ce3a325acbc593ed434580a1bb71 (diff)
downloadsystemtap-steved-e400d0192edc3a8d39ed8e87414fe2faa8cbbf69.tar.gz
systemtap-steved-e400d0192edc3a8d39ed8e87414fe2faa8cbbf69.tar.xz
systemtap-steved-e400d0192edc3a8d39ed8e87414fe2faa8cbbf69.zip
Merge branch 'master' of git://sources.redhat.com/git/systemtap
-rw-r--r--ChangeLog8
-rw-r--r--Makefile.am4
-rw-r--r--Makefile.in4
-rw-r--r--systemtap.spec.in32
-rw-r--r--tapset/ChangeLog14
-rw-r--r--tapset/aux_syscalls.stp128
-rw-r--r--tapset/syscalls2.stp64
7 files changed, 168 insertions, 86 deletions
diff --git a/ChangeLog b/ChangeLog
index 8c2b1535..56783eec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-10-05 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 5036
+ * systemtap.spec.in: Create new systemtap-testsuite sub-rpm.
+ Install crash(8)'s staplog.so into -runtime sub-rpm if built.
+ * Makefile.am (rpm): New target.
+ * Makefile.in: Regenerated.
+
2007-10-04 Frank Ch. Eigler <fche@elastic.org>
* stapfuncs.5.in: Document inet.stp tapset functions.
diff --git a/Makefile.am b/Makefile.am
index 1f558741..f9939685 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -91,6 +91,7 @@ $(STAPLOG): staplog.c
$(CC) -shared -rdynamic $(LDFLAGS) $(CFLAGS) -fPIC -o $@ $<
all-local: $(STAPLOG)
install-exec-local: $(STAPLOG)
+ -$(MKDIR_P) $(DESTDIR)$(pkglibdir)
$(INSTALL) $(STAPLOG) $(DESTDIR)$(pkglibdir)
else
endif
@@ -171,3 +172,6 @@ check:
installcheck:
$(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)"
+
+rpm: systemtap.spec dist
+ rpmbuild --define "_sourcedir $(PWD)/" -ba systemtap.spec
diff --git a/Makefile.in b/Makefile.in
index 47509606..2951f717 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1476,6 +1476,7 @@ install-exec-hook:
@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@ -$(MKDIR_P) $(DESTDIR)$(pkglibdir)
@BUILD_CRASHMOD_TRUE@ $(INSTALL) $(STAPLOG) $(DESTDIR)$(pkglibdir)
# Copy some of the testsuite sample scripts to the distdir
@@ -1531,6 +1532,9 @@ check:
installcheck:
$(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)"
+
+rpm: systemtap.spec dist
+ rpmbuild --define "_sourcedir $(PWD)/" -ba systemtap.spec
# 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/systemtap.spec.in b/systemtap.spec.in
index 1b66c068..aeb8f99a 100644
--- a/systemtap.spec.in
+++ b/systemtap.spec.in
@@ -85,6 +85,17 @@ SystemTap runtime is the runtime component of an instrumentation
system for systems running Linux 2.6. Developers can write
instrumentation to collect data on the operation of the system.
+%package testsuite
+Summary: Instrumentation System Testsuite
+Group: Development/System
+License: GPLv2+
+URL: http://sourceware.org/systemtap/
+Requires: systemtap
+
+%description testsuite
+The testsuite allows testing of the entire SystemTap toolchain
+without having to rebuild from sources.
+
%prep
%setup -q %{?setup_elfutils}
@@ -133,12 +144,22 @@ chmod -x examples/samples/kmalloc-top
rm -rf ${RPM_BUILD_ROOT}
make DESTDIR=$RPM_BUILD_ROOT install
-# Because "make install" installs staprun with mode 04111, the
+# 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
# permissions back to 04111 in the %files section below.
chmod 755 $RPM_BUILD_ROOT%{_bindir}/staprun
+# Copy over the testsuite
+cp -rp testsuite $RPM_BUILD_ROOT%{_datadir}/systemtap
+
+if [ -f $RPM_BUILD_ROOT%{_libdir}/%{name}/staplog.so ]; then
+ echo %{_libdir}/%{name}/staplog.so > runtime-addl-files.txt
+else
+ touch runtime-addl-files.txt
+fi
+
+
%check
make check %{?elfutils_mflags} || :
@@ -165,10 +186,10 @@ exit 0
%if %{bundled_elfutils}
%dir %{_libdir}/%{name}
-%{_libdir}/%{name}/*.so*
+%{_libdir}/%{name}/lib*.so*
%endif
-%files runtime
+%files runtime -f runtime-addl-files.txt
%defattr(-,root,root)
%attr(4111,root,root) %{_bindir}/staprun
%{_libexecdir}/systemtap
@@ -176,6 +197,11 @@ exit 0
%doc README AUTHORS NEWS COPYING
+%files testsuite
+%defattr(-,root,root)
+%{_datadir}/systemtap/testsuite
+
+
%changelog
* Thu Aug 9 2007 David Smith <dsmith@redhat.com> - 0.6-1
- Bumped version, added libcap-devel BuildRequires.
diff --git a/tapset/ChangeLog b/tapset/ChangeLog
index e22dde29..362d0996 100644
--- a/tapset/ChangeLog
+++ b/tapset/ChangeLog
@@ -1,3 +1,17 @@
+2007-10-05 Martin Hunt <hunt@redhat.com>
+
+ * syscalls2.stp (rt_sigaction, sigaction): Call
+ _struct_sigaction_u().
+
+ * aux_syscalls.stp (_struct_timeval): Removed. No longer
+ necessary now that we have structure access in scripts.
+ (_struct_timespec): Ditto.
+ (_struct_itimerval): Ditto.
+ (_struct_timezone_u): Remove random CATCH_DEREF_FAULT()
+ line.
+ (_stp_sigset_str): New.
+ (_struct_sigaction_u): New.
+
2007-10-04 Frank Ch. Eigler <fche@elastic.org>
* inet.stp: New tapset for htonl and friends.
diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp
index d43e981e..117a60f8 100644
--- a/tapset/aux_syscalls.stp
+++ b/tapset/aux_syscalls.stp
@@ -44,19 +44,6 @@ function _struct_compat_timeval_u:string(uaddr:long, n:long)
#endif
%}
-
-function _struct_timeval:string(addr:long)
-%{ /* pure */
- struct timeval *tv = (struct timeval *)(unsigned long)THIS->addr;
-
- if (tv == NULL)
- strlcpy (THIS->__retvalue, "NULL", MAXSTRINGLEN);
- else
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "[%ld.%06ld]",
- kread(&(tv->tv_sec)), kread(&(tv->tv_usec)));
- CATCH_DEREF_FAULT();
-%}
-
function _struct_timezone_u:string(uaddr:long)
%{ /* pure */
struct timezone tz;
@@ -70,7 +57,6 @@ function _struct_timezone_u:string(uaddr:long)
else
strlcpy (THIS->__retvalue, "UNKNOWN", MAXSTRINGLEN);
}
- CATCH_DEREF_FAULT();
%}
%{
@@ -212,19 +198,6 @@ function _struct_compat_timespec_u:string(uaddr:long, n:long)
}
%}
-function _struct_timespec:string(addr:long)
-%{ /* pure */
- struct timespec *ts = (struct timespec *)(unsigned long)THIS->addr;
-
- if (ts == NULL)
- strlcpy (THIS->__retvalue, "NULL", MAXSTRINGLEN);
- else {
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "[%ld.%09ld]",
- (unsigned long)kread(&(ts->tv_sec)),
- (unsigned long)kread(&(ts->tv_nsec)));
- }
- CATCH_DEREF_FAULT();
-%}
function _struct_itimerspec_u:string(uaddr:long)
%{ /* pure */
@@ -277,21 +250,6 @@ function _struct_compat_itimerval_u:string(uaddr:long)
}
%}
-function _struct_itimerval:string(addr:long)
-%{ /* pure */
- struct itimerval *itv = (char *)(unsigned long)THIS->addr;
-
- if (itv == NULL)
- strlcpy (THIS->__retvalue, "NULL", MAXSTRINGLEN);
- else {
- snprintf(THIS->__retvalue, MAXSTRINGLEN, "[%d.%06d,%d.%06d]",
- (int)kread(&(itv->it_interval.tv_sec)),
- (int)kread(&(itv->it_interval.tv_usec)),
- (int)kread(&(itv->it_value.tv_sec)),
- (int)kread(&(itv->it_value.tv_usec)));
- }
- CATCH_DEREF_FAULT();
-%}
%{
#include <linux/version.h>
@@ -1615,6 +1573,23 @@ const _stp_val_array const _stp_signal_list[] = {
V(SIGPWR),
{0, NULL}
};
+
+void _stp_sigset_str(sigset_t *mask, char *ptr, int len)
+{
+ const _stp_val_array * const array = _stp_signal_list;
+ int i = 0, flag = 0;
+ while (array[i].name) {
+ if (sigismember(mask, array[i].val)) {
+ if (flag)
+ strlcat(ptr, "|", len);
+ strlcat(ptr, array[i].name, len);
+ flag = 1;
+ }
+ i++;
+ }
+ if (flag == 0)
+ strlcat(ptr, "EMPTY", len);
+}
%}
function _signal_name:string(sig:long)
@@ -1646,6 +1621,21 @@ function _semctl_cmd:string(cmd:long)
_stp_lookup_str(_stp_semctl_list, THIS->cmd, THIS->__retvalue, MAXSTRINGLEN);
%}
+function _stp_sigset_u:string(setptr:long)
+%{ /* pure */
+ char *ptr = (char *)(unsigned long)THIS->setptr;
+ sigset_t set;
+
+ if (ptr == NULL)
+ strlcpy (THIS->__retvalue, "NULL", MAXSTRINGLEN);
+ else {
+ if(_stp_copy_from_user((char*)&set,ptr,sizeof(sigset_t)) == 0)
+ _stp_sigset_str(&set, THIS->__retvalue, MAXSTRINGLEN);
+ else
+ strlcpy (THIS->__retvalue, "UNKNOWN", MAXSTRINGLEN);
+ }
+%}
+
%{
const _stp_val_array const _stp_fork_list[] = {
V(CLONE_VM),
@@ -1714,6 +1704,7 @@ function _shmat_flags_str:string(f:long)
%{
const _stp_val_array const _stp_mprotect_list[] = {
+ {0, "PROT_NONE"},
V(PROT_READ),
V(PROT_WRITE),
V(PROT_EXEC),
@@ -1724,10 +1715,7 @@ const _stp_val_array const _stp_mprotect_list[] = {
function _mprotect_prot_str:string(prot:long)
%{ /* pure */
- if (THIS->prot)
- _stp_lookup_or_str(_stp_mprotect_list, THIS->prot, THIS->__retvalue, MAXSTRINGLEN);
- else
- strlcpy (THIS->__retvalue, "PROT_NONE", MAXSTRINGLEN);
+ _stp_lookup_or_str(_stp_mprotect_list, THIS->prot, THIS->__retvalue, MAXSTRINGLEN);
%}
%{
@@ -1779,10 +1767,7 @@ function get_mmap_args:string (args:long)
if(_stp_copy_from_user((char *)&a,(char *)(unsigned long)THIS->args, sizeof(a))== 0) {
int len;
_stp_snprintf(THIS->__retvalue, MAXSTRINGLEN, "0x%lx, %ld, ", (long)a.addr, (long)a.len);
- if (a.prot)
- _stp_lookup_or_str(_stp_mprotect_list, a.prot, THIS->__retvalue, MAXSTRINGLEN);
- else
- strlcat (THIS->__retvalue, "PROT_NONE", MAXSTRINGLEN);
+ _stp_lookup_or_str(_stp_mprotect_list, a.prot, THIS->__retvalue, MAXSTRINGLEN);
strlcat (THIS->__retvalue, ", ", MAXSTRINGLEN);
_stp_lookup_or_str(_stp_mmap_list, a.flags, THIS->__retvalue, MAXSTRINGLEN);
strlcat (THIS->__retvalue, ", ", MAXSTRINGLEN);
@@ -1791,3 +1776,46 @@ function get_mmap_args:string (args:long)
} else
strlcpy (THIS->__retvalue, "UNKNOWN", MAXSTRINGLEN);
%}
+
+function _struct_sigaction_u:string(uaddr:long)
+%{ /* pure */
+ static const _stp_val_array const _stp_sa_handler_list[] = {
+ {0, "SIG_DFL"},
+ {1, "SIG_IGN"},
+ {0, NULL}
+ };
+ static const _stp_val_array const _stp_sa_flags_list[] = {
+ V(SA_NOCLDSTOP),
+ V(SA_NOCLDWAIT),
+ V(SA_RESETHAND),
+ V(SA_ONSTACK),
+ V(SA_RESTART),
+ V(SA_NODEFER),
+ V(SA_SIGINFO),
+ V(SA_SIGINFO),
+ V(SA_RESTORER),
+ {0, NULL}
+ };
+
+ struct sigaction act;
+ char *ptr = (char *)(unsigned long)THIS->uaddr;
+
+ if (ptr == NULL)
+ strlcpy (THIS->__retvalue, "NULL", MAXSTRINGLEN);
+ else {
+ if(_stp_copy_from_user((char*)&act,ptr,sizeof(struct sigaction)) == 0) {
+ int len;
+ _stp_lookup_str(_stp_sa_handler_list, (long)act.sa_handler, THIS->__retvalue, MAXSTRINGLEN);
+ if (act.sa_handler != SIG_IGN && act.sa_handler != SIG_DFL) {
+ strlcat (THIS->__retvalue, ", ", MAXSTRINGLEN);
+ _stp_lookup_or_str(_stp_sa_flags_list, act.sa_flags, THIS->__retvalue, MAXSTRINGLEN);
+ strlcat (THIS->__retvalue, ", ", MAXSTRINGLEN);
+ len = strlen(THIS->__retvalue);
+ _stp_snprintf(THIS->__retvalue + len, MAXSTRINGLEN - len, "0x%lx, [", (long)act.sa_restorer);
+ _stp_sigset_str(&act.sa_mask, THIS->__retvalue, MAXSTRINGLEN);
+ strlcat (THIS->__retvalue, "]", MAXSTRINGLEN);
+ }
+ } else
+ strlcpy (THIS->__retvalue, "UNKNOWN", MAXSTRINGLEN);
+ }
+%}
diff --git a/tapset/syscalls2.stp b/tapset/syscalls2.stp
index 3c09c2ed..acb2c137 100644
--- a/tapset/syscalls2.stp
+++ b/tapset/syscalls2.stp
@@ -888,29 +888,16 @@ probe syscall.rmdir.return = kernel.function("sys_rmdir").return {
# struct sigaction __user *oact,
# size_t sigsetsize)
#
-# compat_sys_rt_sigaction(int sig,
-# const struct sigaction __user *act,
-# struct sigaction __user *oact,
-# size_t sigsetsize)
-#
-probe syscall.rt_sigaction =
- kernel.function("sys_rt_sigaction") ?,
- kernel.function("compat_sys_rt_sigaction") ?
-{
+probe syscall.rt_sigaction = kernel.function("sys_rt_sigaction") ? {
name = "rt_sigaction"
sig = $sig
act_uaddr = $act
oact_uaddr = $oact
sigsetsize = $sigsetsize
-
- //FIXME - decode $act
- argstr = sprintf("%s, %p, %p, %d", _signal_name($sig),
- $act, $oact, $sigsetsize)
+ argstr = sprintf("%s, {%s}, %p, %d", _signal_name($sig),
+ _struct_sigaction_u($act), $oact, $sigsetsize)
}
-probe syscall.rt_sigaction.return =
- kernel.function("sys_rt_sigaction").return ?,
- kernel.function("compat_sys_rt_sigaction").return ?
-{
+probe syscall.rt_sigaction.return = kernel.function("sys_rt_sigaction").return ? {
name = "rt_sigaction"
retstr = returnstr(1)
}
@@ -920,18 +907,25 @@ probe syscall.rt_sigaction.return =
# struct sigaction32 __user *act,
# struct sigaction32 __user *oact,
# unsigned int sigsetsize)
-probe syscall.rt_sigaction32 = kernel.function("sys32_rt_sigaction") ? {
+# ppc only
+# compat_sys_rt_sigaction(int sig,
+# const struct sigaction32 __user *act,
+# struct sigaction32 __user *oact,
+# size_t sigsetsize)
+
+probe syscall.rt_sigaction32 = kernel.function("sys32_rt_sigaction") ?,
+ kernel.function("compat_sys_rt_sigaction") ?
+{
name = "rt_sigaction"
sig = $sig
act_uaddr = $act
oact_uaddr = $oact
sigsetsize = $sigsetsize
-
- //FIXME - decode $act
- argstr = sprintf("%s, %p, %p, %d", _signal_name($sig),
- $act, $oact, $sigsetsize)
+ argstr = sprintf("%s, %p, %p, %d", _signal_name($sig), $act, $oact, $sigsetsize)
}
-probe syscall.rt_sigaction32.return = kernel.function("sys32_rt_sigaction").return ? {
+probe syscall.rt_sigaction32.return = kernel.function("sys32_rt_sigaction").return ?,
+ kernel.function("compat_sys_rt_sigaction").return ?
+{
name = "rt_sigaction"
retstr = returnstr(1)
}
@@ -966,7 +960,7 @@ probe syscall.rt_sigprocmask =
how_str = _sigprocmask_how_str($how)
set_uaddr = $set
oldset_uaddr = $oset
- argstr = sprintf("%s, %p, %p, %d", how_str, $set,
+ argstr = sprintf("%s, [%s], %p, %d", how_str, _stp_sigset_u($set),
$oset, $sigsetsize)
}
probe syscall.rt_sigprocmask.return =
@@ -2098,21 +2092,25 @@ probe syscall.shutdown.return = kernel.function("sys_shutdown").return ? {
# sys_sigaction(int sig, const struct old_sigaction __user *act, struct old_sigaction __user *oact)
# sys32_sigaction(int sig, struct old_sigaction32 __user *act, struct old_sigaction32 __user *oact)
#
-probe syscall.sigaction =
- kernel.function("sys_sigaction") ?,
- kernel.function("sys32_sigaction") ?
-{
+probe syscall.sigaction = kernel.function("sys_sigaction") ? {
+ name = "sigaction"
+ sig = $sig
+ act_uaddr = $act
+ oact_uaddr = $oact
+ argstr = sprintf("%s, {%s}, %p", _signal_name($sig), _struct_sigaction_u($act), $oact)
+}
+probe syscall.sigaction.return = kernel.function("sys_sigaction").return ? {
+ name = "sigaction"
+ retstr = returnstr(1)
+}
+probe syscall.sigaction32 = kernel.function("sys32_sigaction") ? {
name = "sigaction"
sig = $sig
act_uaddr = $act
oact_uaddr = $oact
- # FIXME - decode $act
argstr = sprintf("%s, %p, %p", _signal_name($sig), $act, $oact)
}
-probe syscall.sigaction.return =
- kernel.function("sys_sigaction").return ?,
- kernel.function("sys32_sigaction").return ?
-{
+probe syscall.sigaction32.return = kernel.function("sys32_sigaction").return ? {
name = "sigaction"
retstr = returnstr(1)
}