summaryrefslogtreecommitdiffstats
path: root/runtime/task_finder.c
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2008-08-17 13:39:39 -0400
committerFrank Ch. Eigler <fche@elastic.org>2008-08-17 13:39:39 -0400
commitc569c2e4973296701cd4caff35847e2fde32754a (patch)
tree2d50f5882d019cc47d8c0c52571098b906a25ee8 /runtime/task_finder.c
parent00cf370953d55d0c79a746b4e7d65ce29266afc4 (diff)
parent8d4b1ab0732bd51e4b8f1e7cdb2550a9d67f21bc (diff)
downloadsystemtap-steved-c569c2e4973296701cd4caff35847e2fde32754a.tar.gz
systemtap-steved-c569c2e4973296701cd4caff35847e2fde32754a.tar.xz
systemtap-steved-c569c2e4973296701cd4caff35847e2fde32754a.zip
Merge commit 'origin/master' into pr4225
* commit 'origin/master': Mention distro specific elfutils development sub-packages needed when not found. Change system-wide probes from 'process("*").begin' to 'process.begin'. PR6836: tweak $$return formatting extend callgraph example to use $$parms / $$return PR6836: $$vars extensions, $$return small patch ... PR 6834 PR6842: work around possibly null task->signal in utrace death callback Minor bugs in stap-client. build compatibility and speed hack for bundled-elfutils mode revise build instructions; clarifying elfutils bundling and its new hosting site kbuild compatibility hack for separate-objdir O= builds PR 6445 (partial). Implemented system-wide utrace probes. Fixed compilation warning on gcc 3.x let $$vars work even with unsupported c types (e.g., funkytown floats)
Diffstat (limited to 'runtime/task_finder.c')
-rw-r--r--runtime/task_finder.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/runtime/task_finder.c b/runtime/task_finder.c
index 541e5a04..59b83b76 100644
--- a/runtime/task_finder.c
+++ b/runtime/task_finder.c
@@ -140,8 +140,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;
}
@@ -385,23 +387,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;
@@ -1041,6 +1049,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;