diff options
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | Makefile.in | 4 | ||||
-rw-r--r-- | README | 35 | ||||
-rw-r--r-- | buildrun.cxx | 8 | ||||
-rw-r--r-- | runtime/ChangeLog | 8 | ||||
-rw-r--r-- | runtime/task_finder.c | 38 | ||||
-rw-r--r-- | stapprobes.5.in | 3 | ||||
-rw-r--r-- | tapsets.cxx | 21 | ||||
-rw-r--r-- | testsuite/ChangeLog | 6 | ||||
-rwxr-xr-x | testsuite/semko/utrace14.stp | 4 | ||||
-rw-r--r-- | testsuite/systemtap.base/utrace_p4.exp | 9 |
12 files changed, 125 insertions, 35 deletions
@@ -8,6 +8,26 @@ in the background and wait for it. (terminate,interupt): New functions. +2008-08-13 Frank Ch. Eigler <fche@elastic.org> + + * Makefile.am (stamp-elfutils): Override build-elfutils' + bin_PROGRAMS to not bother build binaries we're not using. + * Makefile.in: Regenerated. + +2008-08-12 Frank Ch. Eigler <fche@elastic.org> + + * buildrun.cxx (compile_pass): Add ugly kbuild hack for hand-built + x86 kernels that are made with O= (separate object/module-building + directory). + +2008-08-12 David Smith <dsmith@redhat.com> + + PR 6445 (partial) + * tapsets.cxx (utrace_builder::build): Validates pid and allows + probing of "*" to mean all threads. + * stapprobes.5.in: Added note about a process path of "*" means to + probe all threads. + 2008-08-11 Wenji Huang <wenji.huang@oracle.com> * tapsets.cxx : Fixed compilation warning on gcc 3.x. diff --git a/Makefile.am b/Makefile.am index e6a5654c..05da9fad 100644 --- a/Makefile.am +++ b/Makefile.am @@ -85,9 +85,9 @@ stap_LDFLAGS += -Llib-elfutils -Wl,-rpath-link,lib-elfutils \ BUILT_SOURCES += stamp-elfutils CLEANFILES += stamp-elfutils stamp-elfutils: config.status - $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils all + $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils all bin_PROGRAMS= for dir in libelf libebl libdw libdwfl backends; do \ - $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils/$$dir install; \ + $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils/$$dir bin_PROGRAMS= install; \ done touch $@ stap_DEPENDENCIES = lib-elfutils/libdw.so diff --git a/Makefile.in b/Makefile.in index 4ed771e8..9de49415 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1530,9 +1530,9 @@ cscope: (echo -q ; git ls-files '*.cxx' '*.c' '*.h' | grep -v '^testsuite' ) > cscope.files && \ cscope -b -q @BUILD_ELFUTILS_TRUE@stamp-elfutils: config.status -@BUILD_ELFUTILS_TRUE@ $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils all +@BUILD_ELFUTILS_TRUE@ $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils all bin_PROGRAMS= @BUILD_ELFUTILS_TRUE@ for dir in libelf libebl libdw libdwfl backends; do \ -@BUILD_ELFUTILS_TRUE@ $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils/$$dir install; \ +@BUILD_ELFUTILS_TRUE@ $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils/$$dir bin_PROGRAMS= install; \ @BUILD_ELFUTILS_TRUE@ done @BUILD_ELFUTILS_TRUE@ touch $@ @BUILD_ELFUTILS_TRUE@lib-elfutils/libdw.so: stamp-elfutils ; @@ -13,27 +13,26 @@ Prerequisites: - kernel module build environment (kernel-devel or kernel-smp-devel rpm) - kernel debugging information (kernel-debuginfo rpm) - C compiler (same as what kernel was compiled with) -- elfutils with libdwfl (possible to reuse system elfutils if new and - complete enough, otherwise download source snapshot and build - together with systemtap as follows) +- elfutils with libdwfl for debugging informatin parsing - root privileges Installation steps: -- Install the kernel-debuginfo, kernel-[smp-]devel, gcc packages. +- Install the kernel-debuginfo, kernel-devel, gcc packages. - Install the systemtap package, if one already exists. Build steps: - Install the kernel-debuginfo, kernel-[smp-]devel, gcc and libcap-devel packages (or see below if you are building your own kernels from source). + If avaialable, install your distribution's copy of elfutils and its + development headers/libraries. -- If desired, download a recent elfutils snapshot to build in "bundled mode". - If desired, build it separately one time, and install it to /usr/local. - - ftp://sources.redhat.com/pub/systemtap/elfutils/elfutils-NNNN.tar.gz - ftp://sources.redhat.com/pub/systemtap/elfutils/elfutils-portability.patch -- Untar the snapshot in some new directory; apply patch (don't ask, long story) +- Or if desired, download an elfutils source release to build in + "bundled mode" (below), and untar it into some new directory. + Or if desired, build elfutils separately one time, and install + it to /usr/local. + See http://fedorahosted.org/elfutils/ - Download systemtap sources: http://sources.redhat.com/systemtap/ftp/releases/ @@ -42,11 +41,16 @@ Build steps: git clone git://sources.redhat.com/git/systemtap.git (or) http://sources.redhat.com/git/systemtap.git -- Build it: - .../configure [--with-elfutils=PATCHED-ELFUTILS-DIR] [other autoconf options] - make all check - sudo make install - sudo make installcheck +- Build systemtap normally: + % .../configure [other autoconf options] + Or, with build it with a bundled internal copy of elfutils: + % .../configure --with-elfutils=ELFUTILS-SOURCE-DIR [other autoconf options] + Consider configuring with "--enable-dejazilla" to automatically + contribute to our public test result database. + + % make all check + % sudo make install + % sudo make installcheck Tips: @@ -54,6 +58,7 @@ Tips: /boot/vmlinux-`uname -r` /usr/lib/debug/lib/modules/`uname -r`/vmlinux /lib/modules/`uname -r`/vmlinux + /lib/modules/`uname -r`/build/vmlinux Building a kernel.org kernel: diff --git a/buildrun.cxx b/buildrun.cxx index c2ebdce5..159e1c6e 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -87,6 +87,14 @@ compile_pass (systemtap_session& s) string module_cflags = "EXTRA_CFLAGS"; o << module_cflags << " :=" << endl; + + // XXX: This gruesome hack is needed on some kernels built with separate O=directory, + // where files like 2.6.27 x86's asm/mach-*/mach_mpspec.h are not found on the cpp path. + // This could be a bug in arch/x86/Makefile that names + // mflags-y += -Iinclude/asm-x86/mach-default + // but that path does not exist in an O= build tree. + o << module_cflags << " += -Iinclude2/asm/mach-default" << endl; + o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-hrtimer-rel.c, -DSTAPCONF_HRTIMER_REL,)" << endl; o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-inode-private.c, -DSTAPCONF_INODE_PRIVATE,)" << endl; o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-constant-tsc.c, -DSTAPCONF_CONSTANT_TSC,)" << endl; diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 7dfade1c..7ec5d453 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,11 @@ +2008-08-12 David Smith <dsmith@redhat.com> + + PR 6445 (partial) + * task_finder.c (stap_register_task_finder_target): Handles + probing all threads. + (__stp_utrace_attach_match_filename): Ditto. + (stap_start_task_finder): Ditto. + 2008-08-08 David Smith <dsmith@redhat.com> * task_finder.c (stap_utrace_detach): New function. diff --git a/runtime/task_finder.c b/runtime/task_finder.c index 1832c795..26375780 100644 --- a/runtime/task_finder.c +++ b/runtime/task_finder.c @@ -130,8 +130,10 @@ stap_register_task_finder_target(struct stap_task_finder_target *new_tgt) && ((new_tgt->pathlen > 0 && tgt->pathlen == new_tgt->pathlen && strcmp(tgt->pathname, new_tgt->pathname) == 0) - /* pid-based target */ - || (new_tgt->pid != 0 && tgt->pid == new_tgt->pid))) { + /* pid-based target (a specific pid or all + * pids) */ + || (new_tgt->pathlen == 0 + && tgt->pid == new_tgt->pid))) { found_node = 1; break; } @@ -375,23 +377,29 @@ __stp_utrace_attach_match_filename(struct task_struct *tsk, size_t filelen; struct list_head *tgt_node; struct stap_task_finder_target *tgt; - int found_node = 0; filelen = strlen(filename); list_for_each(tgt_node, &__stp_task_finder_list) { + struct list_head *cb_node; + tgt = list_entry(tgt_node, struct stap_task_finder_target, list); - // Note that we don't bother with looking for pids - // here, since they are handled at startup. - if (tgt != NULL && tgt->pathlen > 0 - && tgt->pathlen == filelen - && strcmp(tgt->pathname, filename) == 0) { - found_node = 1; - break; - } - } - if (found_node) { - struct list_head *cb_node; + // If we've got a matching pathname or we're probing + // all threads, we've got a match. We've got to keep + // matching since a single thread could match a + // pathname and match an "all thread" probe. + if (tgt == NULL) + continue; + else if (tgt->pathlen > 0 + && (tgt->pathlen != filelen + || strcmp(tgt->pathname, filename) != 0)) + continue; + /* Ignore pid-based target, they were handled at startup. */ + else if (tgt->pid != 0) + continue; + /* Notice that "pid == 0" (which means to probe all + * threads) falls through. */ + list_for_each(cb_node, &tgt->callback_list_head) { struct stap_task_finder_target *cb_tgt; int rc; @@ -1030,6 +1038,8 @@ stap_start_task_finder(void) /* pid-based target */ else if (tgt->pid != 0 && tgt->pid != tsk->pid) continue; + /* Notice that "pid == 0" (which means to + * probe all threads) falls through. */ list_for_each(cb_node, &tgt->callback_list_head) { struct stap_task_finder_target *cb_tgt; diff --git a/stapprobes.5.in b/stapprobes.5.in index d20ea006..c71f79d3 100644 --- a/stapprobes.5.in +++ b/stapprobes.5.in @@ -423,6 +423,9 @@ Note that names refer to executables that are searched the same way shells do: relative to the working directory if they contain a "/" character, otherwise in .BR $PATH . +A +.I PATH +of "*" means to probe all threads. .SS PROCFS diff --git a/tapsets.cxx b/tapsets.cxx index 6dcd2c00..664dfb1f 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -5931,8 +5931,25 @@ struct utrace_builder: public derived_probe_builder else if (has_null_param (parameters, TOK_END)) flags = UDPF_END; - // If we have a path, we need to validate it. - if (has_path) + // Validate pid. + if (has_pid) + { + // We can't probe 'init' (pid 1). + if (pid < 2) + throw semantic_error ("process pid must be greater than 1", + location->tok); + } + // If we have a path whose value is "*", this means to probe + // everything. Convert this to a pid-based probe. + else if (has_path && path == "*") + { + has_path = false; + path.clear(); + has_pid = true; + pid = 0; + } + // If we have a regular path, we need to validate it. + else if (has_path) { string::size_type start_pos, end_pos; string component; diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index ed11d429..c6d86142 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -4,6 +4,12 @@ global. (systemtap_exit): Remove the directory named by $client_path. +2008-08-12 David Smith <dsmith@redhat.com> + + PR 6445 (partial) + * systemtap.base/utrace_p4.exp: Added test that probes all threads. + * semko/utrace14.stp: New test. + 2008-08-11 Frank Ch. Eigler <fche@elastic.org> * systemtap.base/vars.exp: Adjust to loss of "\n" at end of $$vars diff --git a/testsuite/semko/utrace14.stp b/testsuite/semko/utrace14.stp new file mode 100755 index 00000000..80847f7f --- /dev/null +++ b/testsuite/semko/utrace14.stp @@ -0,0 +1,4 @@ +#! stap -p2 + +# pid can't be less than 2 +probe process(1).begin { } diff --git a/testsuite/systemtap.base/utrace_p4.exp b/testsuite/systemtap.base/utrace_p4.exp index 3083b97f..081fee95 100644 --- a/testsuite/systemtap.base/utrace_p4.exp +++ b/testsuite/systemtap.base/utrace_p4.exp @@ -15,6 +15,7 @@ set syscall_script {"probe process(\"/bin/ls\").syscall { printf(\"|%d\", \$sysc set syscall_return_script {"probe process(\"/bin/ls\").syscall.return { printf(\"|%d\", \$syscall) }"} set thread_begin_script {"probe process(\"/bin/ls\").thread.begin { print(\"ls thread.begin\") }"} set thread_end_script {"probe process(\"/bin/ls\").thread.end { print(\"ls thread.end\") }"} +set all_begin_script {"probe process(\"*\").begin { print(\"begin\") }"} set pid_begin_script {"probe process(123).begin { print(\"123 begin\") }"} set pid_end_script {"probe process(123).end { print(\"123 end\") }"} @@ -128,3 +129,11 @@ if {$utrace_support_found == 0} { # Try compiling an thread.end script using a pid stap_compile $TEST_NAME 1 $pid_thread_end_script } + +set TEST_NAME "UTRACE_P4_07" +if {$utrace_support_found == 0} { + untested "$TEST_NAME : no kernel utrace support found" +} else { + # Try compiling an begin script using a path of "*" + stap_compile $TEST_NAME 1 $all_begin_script +} |