summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2008-08-12 10:18:56 -0500
committerDavid Smith <dsmith@redhat.com>2008-08-12 10:18:56 -0500
commit6cdf2889024b6538665a00f2ecd7321626624bb8 (patch)
tree8f0286936a35e021c532336e4a672323b8db4bea /runtime
parent6503a1cce1cb2a2b88819b414650bd85340a4381 (diff)
downloadsystemtap-steved-6cdf2889024b6538665a00f2ecd7321626624bb8.tar.gz
systemtap-steved-6cdf2889024b6538665a00f2ecd7321626624bb8.tar.xz
systemtap-steved-6cdf2889024b6538665a00f2ecd7321626624bb8.zip
PR 6445 (partial). Implemented system-wide utrace probes.
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-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-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.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/ChangeLog8
-rw-r--r--runtime/task_finder.c38
2 files changed, 32 insertions, 14 deletions
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;