Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/runtime/linux/debug.h b/runtime/linux/debug.h
- index e23ee96e7..02921de0d 100644
- --- a/runtime/linux/debug.h
- +++ b/runtime/linux/debug.h
- @@ -73,6 +73,16 @@
- #define dbug_unwind(level, args...) ;
- #endif
- +
- +#ifdef DEBUG_TASK_FINDER
- +#define dbug_task(args...) do { \
- + _stp_dbug(__FUNCTION__, __LINE__, args); \
- + } while (0)
- +#else
- +#define dbug_task(level, args...) ;
- +#endif
- +
- +
- #if defined(DEBUG_TASK_FINDER_VMA)
- #define dbug_task_vma(level, args...) do { \
- if ((level) <= DEBUG_TASK_FINDER_VMA) \
- diff --git a/runtime/linux/task_finder2.c b/runtime/linux/task_finder2.c
- index 6f5d637da..66b884917 100644
- --- a/runtime/linux/task_finder2.c
- +++ b/runtime/linux/task_finder2.c
- @@ -36,9 +36,9 @@ static atomic_t __stp_attach_count = ATOMIC_INIT (0);
- #define debug_task_finder_attach() (atomic_inc(&__stp_attach_count))
- #define debug_task_finder_detach() (atomic_dec(&__stp_attach_count))
- #define debug_task_finder_report() \
- - (printk(KERN_ERR "%s:%d - attach count: %d, inuse count: %d\n", \
- - __FUNCTION__, __LINE__, atomic_read(&__stp_attach_count), \
- - atomic_read(&__stp_inuse_count)))
- + dbug_task("attach count: %d, inuse count: %d\n", \
- + atomic_read(&__stp_attach_count), \
- + atomic_read(&__stp_inuse_count))
- #else
- #define debug_task_finder_attach() /* empty */
- #define debug_task_finder_detach() /* empty */
- @@ -248,6 +248,8 @@ stap_register_task_finder_target(struct stap_task_finder_target *new_tgt)
- else
- new_tgt->pathlen = 0;
- + dbug_task("find target");
- +
- // Make sure everything is initialized properly.
- new_tgt->engine_attached = 0;
- new_tgt->mmap_events = 0;
- @@ -519,6 +521,7 @@ __stp_utrace_attach(struct task_struct *tsk,
- engine = utrace_attach_task(tsk, UTRACE_ATTACH_CREATE, ops, data);
- if (IS_ERR(engine)) {
- int error = -PTR_ERR(engine);
- + dbug_task("utrace_attach_task returned an error: %d", error);
- if (error != ESRCH && error != ENOENT) {
- _stp_error("utrace_attach returned error %d on pid %d",
- error, (int)tsk->pid);
- @@ -526,12 +529,15 @@ __stp_utrace_attach(struct task_struct *tsk,
- }
- }
- else if (unlikely(engine == NULL)) {
- + dbug_task("utrace_attach_task returned NULL");
- _stp_error("utrace_attach returned NULL on pid %d",
- (int)tsk->pid);
- rc = EFAULT;
- }
- else {
- + dbug_task("utrace_attach_task returned successfully");
- rc = utrace_set_events(tsk, engine, event_flags);
- + dbug_task("utrace_set_events returned %d", rc);
- if (rc == -EINPROGRESS) {
- /*
- * It's running our callback, so we have to
- @@ -553,6 +559,7 @@ __stp_utrace_attach(struct task_struct *tsk,
- if (action != UTRACE_RESUME) {
- rc = utrace_control(tsk, engine, action);
- + dbug_task("utrace_control returned %d", rc);
- /* If utrace_control() returns
- * EINPROGRESS when we're trying to
- * stop/interrupt, that means the task
- @@ -588,9 +595,13 @@ __stp_call_callbacks(struct stap_task_finder_target *tgt,
- struct list_head *cb_node;
- int rc;
- + dbug_task("entering tgt=%p tsk=%p pid=%d", tgt, tsk, tsk ? tsk->tgid : -1);
- +
- if (tgt == NULL || tsk == NULL)
- return;
- + dbug_task("pid: %d", tsk->tgid);
- +
- list_for_each(cb_node, &tgt->callback_list_head) {
- struct stap_task_finder_target *cb_tgt;
- @@ -599,7 +610,15 @@ __stp_call_callbacks(struct stap_task_finder_target *tgt,
- if (cb_tgt == NULL || cb_tgt->callback == NULL)
- continue;
- + dbug_task("calling %s callback %p (proc=%s pid=%d, pathlen=%d, "
- + "engine-attached=%d)",
- + (cb_tgt->purpose?:""), cb_tgt->callback, cb_tgt->procname, cb_tgt->pid,
- + (int) cb_tgt->pathlen, cb_tgt->engine_attached);
- +
- rc = cb_tgt->callback(cb_tgt, tsk, register_p, process_p);
- +
- + dbug_task("callback returned %d", rc);
- +
- if (rc != 0) {
- _stp_warn("task_finder %s%scallback for task %d failed: %d",
- (cb_tgt->purpose?:""), (cb_tgt->purpose?" ":""),
- @@ -834,8 +853,10 @@ __stp_utrace_attach_match_filename(struct task_struct *tsk,
- continue;
- else if (tgt->pathlen > 0
- && (tgt->pathlen != filelen
- - || strcmp(tgt->procname, filename) != 0))
- + || strcmp(tgt->procname, filename) != 0)) {
- + dbug_task("path NOT equal: [%s] != [%s]", tgt->procname, filename);
- continue;
- + }
- /* Ignore pid-based target, they were handled at startup. */
- else if (tgt->pid != 0)
- continue;
- @@ -854,6 +875,7 @@ __stp_utrace_attach_match_filename(struct task_struct *tsk,
- }
- #endif
- + dbug_task("utrace attach to %d", tsk->tgid);
- // Set up events we need for attached tasks. We won't
- // actually call the callbacks here - we'll call them
- @@ -1657,9 +1679,14 @@ stap_start_task_finder(void)
- if (_stp_target && tsk->tgid != _stp_target)
- continue;
- + dbug_task("utrace attaching pid %d", tsk->tgid);
- +
- rc = __stp_utrace_attach(tsk, &__stp_utrace_task_finder_ops, 0,
- __STP_TASK_FINDER_EVENTS,
- UTRACE_RESUME);
- +
- + dbug_task("utrace attach returned %d", rc);
- +
- if (rc == EPERM) {
- /* Ignore EPERM errors, which mean this wasn't
- * a thread we can attach to. */
- @@ -1724,13 +1751,20 @@ stap_start_task_finder(void)
- else if (tgt->pathlen > 0
- && (tgt->pathlen != mmpathlen
- || strcmp(tgt->procname, mmpath) != 0))
- + {
- + dbug_task("path not equal: [%s] != [%s]", tgt->procname, mmpath);
- continue;
- + }
- /* 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. */
- + if (tgt->pathlen > 0) {
- + dbug_task("path equal: [%s] == [%s]", tgt->procname, mmpath);
- + }
- +
- #if ! STP_PRIVILEGE_CONTAINS (STP_PRIVILEGE, STP_PR_STAPDEV) && \
- ! STP_PRIVILEGE_CONTAINS (STP_PRIVILEGE, STP_PR_STAPSYS)
- /* Make sure unprivileged users only probe their own threads. */
- @@ -1739,14 +1773,20 @@ stap_start_task_finder(void)
- _stp_warn("Process %d does not belong to unprivileged user %d",
- tsk->pid, _stp_uid);
- }
- + dbug_task("uid != euid: %d != %d", _stp_uid, tsk_euid);
- continue;
- }
- #endif
- + dbug_task("setting up events for %d", tsk->tgid);
- +
- // Set up events we need for attached tasks.
- rc = __stp_utrace_attach(tsk, &tgt->ops, tgt,
- __STP_ATTACHED_TASK_EVENTS,
- UTRACE_STOP);
- +
- + dbug_task("utrace attach returned %d", rc);
- +
- if (rc != 0 && rc != EPERM)
- goto stf_err;
- rc = 0; /* ignore EPERM */
- @@ -1771,18 +1811,13 @@ stap_task_finder_post_init(void)
- return;
- }
- -#ifdef DEBUG_TASK_FINDER
- - printk(KERN_ERR "%s:%d - entry.\n", __FUNCTION__, __LINE__);
- -#endif
- + dbug_task("entry.");
- rcu_read_lock();
- do_each_thread(grp, tsk) {
- struct list_head *tgt_node;
- if (atomic_read(&__stp_task_finder_state) != __STP_TF_RUNNING) {
- -#ifdef DEBUG_TASK_FINDER
- - printk(KERN_ERR "%s:%d - exiting early...\n",
- - __FUNCTION__, __LINE__);
- -#endif
- + dbug_task("exiting early...");
- break;
- }
- @@ -1794,6 +1829,8 @@ stap_task_finder_post_init(void)
- if (tsk->tgid != tsk->pid)
- continue;
- + dbug_task("checking task %d:%d", tsk->pid, tsk->tgid);
- +
- /* See if we need to "poke" this thread. */
- list_for_each(tgt_node, &__stp_task_finder_list) {
- struct stap_task_finder_target *tgt;
- @@ -1804,14 +1841,19 @@ stap_task_finder_post_init(void)
- if (tgt == NULL || !tgt->engine_attached)
- continue;
- + dbug_task("attaching to task %d", tsk->tgid);
- +
- // If we found an "interesting" task earlier,
- // stop it.
- engine = utrace_attach_task(tsk,
- UTRACE_ATTACH_MATCH_OPS,
- &tgt->ops, tgt);
- if (engine != NULL && !IS_ERR(engine)) {
- + int rc;
- + dbug_task("found the target task %d, stopping it...", tsk->tgid);
- +
- /* We found a target task. Stop it. */
- - int rc = utrace_control(tsk, engine,
- + rc = utrace_control(tsk, engine,
- UTRACE_INTERRUPT);
- /* If utrace_control() returns
- * EINPROGRESS when we're
- @@ -1824,6 +1866,9 @@ stap_task_finder_post_init(void)
- _stp_error("utrace_control returned error %d on pid %d",
- rc, (int)tsk->pid);
- }
- +
- + dbug_task("interrupting task returned %d (%d)", rc, -EINPROGRESS);
- +
- utrace_engine_put(engine);
- /* Since we only need to interrupt
- @@ -1835,9 +1880,7 @@ stap_task_finder_post_init(void)
- } while_each_thread(grp, tsk);
- rcu_read_unlock();
- atomic_set(&__stp_task_finder_complete, 1);
- -#ifdef DEBUG_TASK_FINDER
- - printk(KERN_ERR "%s:%d - exit.\n", __FUNCTION__, __LINE__);
- -#endif
- + dbug_task("exit.");
- return;
- }
- @@ -1858,7 +1901,7 @@ stap_stop_task_finder(void)
- #ifdef DEBUG_TASK_FINDER
- int i = 0;
- - printk(KERN_ERR "%s:%d - entry\n", __FUNCTION__, __LINE__);
- + dbug_task("entry");
- #endif
- if (atomic_read(&__stp_task_finder_state) == __STP_TF_UNITIALIZED)
- return;
- @@ -1886,7 +1929,7 @@ stap_stop_task_finder(void)
- }
- #ifdef DEBUG_TASK_FINDER
- if (i > 0)
- - printk(KERN_ERR "it took %d polling loops to quit.\n", i);
- + dbug_task("it took %d polling loops to quit.", i);
- #endif
- debug_task_finder_report();
- @@ -1903,9 +1946,7 @@ stap_stop_task_finder(void)
- * everything. */
- __stp_tf_free_all_task_work();
- -#ifdef DEBUG_TASK_FINDER
- - printk(KERN_ERR "%s:%d - exit\n", __FUNCTION__, __LINE__);
- -#endif
- + dbug_task("exit");
- }
- #endif /* TASK_FINDER2_C */
- diff --git a/tapset-been.cxx b/tapset-been.cxx
- index 61b3b18a3..1107d3e76 100644
- --- a/tapset-been.cxx
- +++ b/tapset-been.cxx
- @@ -149,7 +149,7 @@ be_derived_probe_group::emit_module_decls (systemtap_session& s)
- s.op->newline() << "static void enter_be_probe (struct stap_be_probe *stp) {";
- s.op->indent(1);
- - common_probe_entryfn_prologue (s, "stp->state", "stp->probe",
- + common_probe_entryfn_prologue (s, "stp->state", "", "stp->probe",
- "stp_probe_type_been", false);
- s.op->newline() << "(*stp->probe->ph) (c);";
- common_probe_entryfn_epilogue (s, false, otf_safe_context(s));
- diff --git a/tapset-itrace.cxx b/tapset-itrace.cxx
- index 4682e7674..0a262076c 100644
- --- a/tapset-itrace.cxx
- +++ b/tapset-itrace.cxx
- @@ -199,7 +199,7 @@ itrace_derived_probe_group::emit_module_decls (systemtap_session& s)
- s.op->newline() << "static void enter_itrace_probe(struct stap_itrace_probe *p, struct pt_regs *regs, void *data) {";
- s.op->indent(1);
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "p->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "p->probe",
- "stp_probe_type_itrace");
- s.op->newline() << "c->uregs = regs;";
- s.op->newline() << "c->user_mode_p = 1;";
- diff --git a/tapset-mark.cxx b/tapset-mark.cxx
- index 2dec501c8..5a48eaa76 100644
- --- a/tapset-mark.cxx
- +++ b/tapset-mark.cxx
- @@ -509,7 +509,7 @@ mark_derived_probe_group::emit_module_decls (systemtap_session& s)
- s.op->newline();
- s.op->newline() << "static void enter_marker_probe (void *probe_data, void *call_data, const char *fmt, va_list *args) {";
- s.op->newline(1) << "struct stap_marker_probe *smp = (struct stap_marker_probe *)probe_data;";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "smp->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "smp->probe",
- "stp_probe_type_marker");
- s.op->newline() << "c->ips.kmark.marker_name = smp->name;";
- s.op->newline() << "c->ips.kmark.marker_format = smp->format;";
- diff --git a/tapset-netfilter.cxx b/tapset-netfilter.cxx
- index 1c6952e1f..a6ae5909d 100644
- --- a/tapset-netfilter.cxx
- +++ b/tapset-netfilter.cxx
- @@ -313,7 +313,7 @@ netfilter_derived_probe_group::emit_module_decls (systemtap_session& s)
- s.op->newline() << "#elif defined(STAPCONF_NETFILTER_V41)";
- s.op->newline() << "int (*nf_okfn)(struct sock *, struct sk_buff *) = nf_state->okfn;";
- s.op->newline() << "#endif";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "stp",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "stp",
- "stp_probe_type_netfilter",
- false);
- diff --git a/tapset-perfmon.cxx b/tapset-perfmon.cxx
- index 11dbbd32b..2b9f5ad42 100644
- --- a/tapset-perfmon.cxx
- +++ b/tapset-perfmon.cxx
- @@ -235,7 +235,7 @@ perf_derived_probe_group::emit_module_decls (systemtap_session& s)
- s.op->newline() << "static void handle_perf_probe (unsigned i, struct pt_regs *regs)";
- s.op->newline() << "{";
- s.op->newline(1) << "struct stap_perf_probe* stp = & stap_perf_probes [i];";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "stp->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "stp->probe",
- "stp_probe_type_perf");
- s.op->newline() << "if (user_mode(regs)) {";
- s.op->newline(1)<< "c->user_mode_p = 1;";
- diff --git a/tapset-procfs.cxx b/tapset-procfs.cxx
- index c39f20fcb..c5087afcb 100644
- --- a/tapset-procfs.cxx
- +++ b/tapset-procfs.cxx
- @@ -366,7 +366,7 @@ procfs_derived_probe_group::emit_module_decls (systemtap_session& s)
- {
- s.op->newline() << "struct _stp_procfs_data pdata;";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "",
- "spp->read_probe",
- "stp_probe_type_procfs");
- @@ -412,7 +412,7 @@ procfs_derived_probe_group::emit_module_decls (systemtap_session& s)
- {
- s.op->newline() << "struct _stp_procfs_data pdata;";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "",
- "spp->write_probes[0]",
- "stp_probe_type_procfs");
- diff --git a/tapset-timers.cxx b/tapset-timers.cxx
- index 8dd00a1b9..4949b6e14 100644
- --- a/tapset-timers.cxx
- +++ b/tapset-timers.cxx
- @@ -136,7 +136,7 @@ timer_derived_probe_group::emit_module_decls (systemtap_session& s)
- s.op->line() << ");";
- s.op->newline(-1) << "{";
- s.op->indent(1);
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "stp->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "stp->probe",
- "stp_probe_type_timer");
- s.op->newline() << "(*stp->probe->ph) (c);";
- common_probe_entryfn_epilogue (s, true, otf_safe_context(s));
- @@ -293,7 +293,7 @@ hrtimer_derived_probe_group::emit_module_decls (systemtap_session& s)
- s.op->newline() << "{";
- s.op->indent(1);
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "stp->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "stp->probe",
- "stp_probe_type_hrtimer");
- s.op->newline() << "(*stp->probe->ph) (c);";
- common_probe_entryfn_epilogue (s, true, otf_safe_context(s));
- @@ -315,7 +315,8 @@ hrtimer_derived_probe_group::emit_module_decls (systemtap_session& s)
- s.op->newline() << "{";
- s.op->indent(1);
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "stp->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "",
- + "stp->probe",
- "stp_probe_type_hrtimer");
- s.op->newline() << "(*stp->probe->ph) (c);";
- common_probe_entryfn_epilogue (s, true, otf_safe_context(s));
- @@ -483,7 +484,7 @@ profile_derived_probe_group::emit_module_decls (systemtap_session& s)
- s.op->newline() << "static void enter_all_profile_probes (struct pt_regs *regs) {";
- s.op->newline(1) << "const struct stap_probe * probe = "
- << common_probe_init (probes[0]) << ";";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "probe",
- "stp_probe_type_profile_timer");
- // Timer interrupts save all registers, so if the interrupt happened
- // in user space we can rely on it being the full user pt_regs.
- diff --git a/tapset-utrace.cxx b/tapset-utrace.cxx
- index 2b644843a..2214e3010 100644
- --- a/tapset-utrace.cxx
- +++ b/tapset-utrace.cxx
- @@ -862,10 +862,13 @@ utrace_derived_probe_group::emit_module_linux_decls (systemtap_session& s)
- s.op->newline() << "static void stap_utrace_probe_handler(struct task_struct *tsk, struct stap_utrace_probe *p) {";
- s.op->indent(1);
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "p->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING",
- + "STAP_SESSION_STARTING",
- + "p->probe",
- "stp_probe_type_utrace");
- // call probe function
- + s.op->newline() << "dbug_task(\"calling UDPF probe function\");";
- s.op->newline() << "(*p->probe->ph) (c);";
- common_probe_entryfn_epilogue (s, true, otf_safe_context(s));
- @@ -889,7 +892,7 @@ utrace_derived_probe_group::emit_module_linux_decls (systemtap_session& s)
- s.op->indent(1);
- s.op->newline() << "struct stap_utrace_probe *p = (struct stap_utrace_probe *)engine->data;";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "p->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "p->probe",
- "stp_probe_type_utrace_syscall");
- s.op->newline() << "c->uregs = regs;";
- s.op->newline() << "c->user_mode_p = 1;";
- @@ -914,6 +917,7 @@ utrace_derived_probe_group::emit_module_linux_decls (systemtap_session& s)
- s.op->newline() << "int rc = 0;";
- s.op->newline() << "struct stap_utrace_probe *p = container_of(tgt, struct stap_utrace_probe, tgt);";
- s.op->newline() << "struct utrace_engine *engine;";
- + s.op->newline() << "dbug_task(\"utrace probe cb: register_p=%d process_p=%d, p->flags=%x (begin: %d, thr begin: %d)\", register_p, process_p, (unsigned) p->flags, UDPF_BEGIN, UDPF_THREAD_BEGIN);";
- s.op->newline() << "if (register_p) {";
- s.op->indent(1);
- @@ -1176,7 +1180,7 @@ utrace_derived_probe_group::emit_module_dyninst_decls (systemtap_session& s)
- << "(uint64_t index, struct pt_regs *regs) {";
- s.op->newline(1) << "struct stapdu_probe *sup = &stapdu_probes[index];";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "sup->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "sup->probe",
- "stp_probe_type_utrace");
- s.op->newline() << "c->uregs = regs ?: &stapdu_dummy_uregs;";
- s.op->newline() << "c->user_mode_p = 1;";
- diff --git a/tapsets.cxx b/tapsets.cxx
- index b83960a2e..24b4e264d 100644
- --- a/tapsets.cxx
- +++ b/tapsets.cxx
- @@ -91,7 +91,7 @@ common_probe_init (derived_probe* p)
- void
- common_probe_entryfn_prologue (systemtap_session& s,
- - string statestr, string probe,
- + string statestr, string statestr2, string probe,
- string probe_type, bool overload_processing,
- void (*declaration_callback)(systemtap_session& s, void *data),
- void (*pre_context_callback)(systemtap_session& s, void *data),
- @@ -159,9 +159,25 @@ common_probe_entryfn_prologue (systemtap_session& s,
- s.op->newline(-1) << "}";
- }
- - s.op->newline() << "if (atomic_read (session_state()) != " << statestr << ")";
- - s.op->newline(1) << "goto probe_epilogue;";
- - s.op->indent(-1);
- + s.op->newline() << "{";
- + s.op->newline(1) << "unsigned sess_state = atomic_read (session_state());";
- + s.op->newline() << "#ifdef DEBUG_PROBES";
- + s.op->newline() << "_stp_dbug(__FUNCTION__, __LINE__, \"session state: %d\", "
- + "sess_state);";
- + s.op->newline() << "#endif";
- + s.op->newline() << "if (sess_state != " << statestr
- + << (statestr2.empty() ? "" : string(" && sess_state != ") + statestr2)
- + << ") {";
- + s.op->newline(1) << "#ifdef DEBUG_PROBES";
- + s.op->newline() << "_stp_dbug(__FUNCTION__, __LINE__, \"session state %d != "
- + << statestr << " (%d)" << (statestr2.empty() ? "" : string(" or ")
- + + statestr2 + " (%d)")
- + << "\", sess_state, " << statestr
- + << (statestr2.empty() ? "" : string(", ") + statestr2) << ");";
- + s.op->newline() << "#endif";
- + s.op->newline() << "goto probe_epilogue;";
- + s.op->newline(-1) << "}";
- + s.op->newline(-1) << "}";
- if (pre_context_callback)
- {
- @@ -6079,7 +6095,7 @@ generic_kprobe_derived_probe_group::emit_module_decls (systemtap_session& s)
- s.op->line() << "kprobe_idx:0)"; // NB: at least we avoid memory corruption
- // XXX: it would be nice to give a more verbose error though; BUG_ON later?
- s.op->line() << "];";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "skp->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "skp->probe",
- "stp_probe_type_kprobe");
- s.op->newline() << "c->kregs = regs;";
- @@ -6116,7 +6132,7 @@ generic_kprobe_derived_probe_group::emit_module_decls (systemtap_session& s)
- s.op->newline() << "const struct stap_probe *sp = entry ? skp->entry_probe : skp->probe;";
- s.op->newline() << "if (sp) {";
- s.op->indent(1);
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "sp",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "sp",
- "stp_probe_type_kretprobe");
- s.op->newline() << "c->kregs = regs;";
- @@ -9465,7 +9481,7 @@ uprobe_derived_probe_group::emit_module_utrace_decls (systemtap_session& s)
- s.op->newline() << "static void enter_uprobe_probe (struct uprobe *inst, struct pt_regs *regs) {";
- s.op->newline(1) << "struct stap_uprobe *sup = container_of(inst, struct stap_uprobe, up);";
- s.op->newline() << "const struct stap_uprobe_spec *sups = &stap_uprobe_specs [sup->spec_index];";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "sups->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "sups->probe",
- "stp_probe_type_uprobe", true,
- udpg_entryfn_prologue_declaration_callback,
- udpg_entryfn_prologue_pre_context_callback,
- @@ -9500,7 +9516,7 @@ uprobe_derived_probe_group::emit_module_utrace_decls (systemtap_session& s)
- s.op->newline() << "static void enter_uretprobe_probe (struct uretprobe_instance *inst, struct pt_regs *regs) {";
- s.op->newline(1) << "struct stap_uprobe *sup = container_of(inst->rp, struct stap_uprobe, urp);";
- s.op->newline() << "const struct stap_uprobe_spec *sups = &stap_uprobe_specs [sup->spec_index];";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "sups->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "sups->probe",
- "stp_probe_type_uretprobe", true,
- udpg_entryfn_prologue_declaration_callback,
- udpg_entryfn_prologue_pre_context_callback,
- @@ -9664,7 +9680,7 @@ uprobe_derived_probe_group::emit_module_inode_decls (systemtap_session& s)
- // Since we're sharing the entry function, we have to dynamically choose the probe_type
- string probe_type = "(sup->return_p ? stp_probe_type_uretprobe : stp_probe_type_uprobe)";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "sup->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "sup->probe",
- probe_type, true,
- udpg_entryfn_prologue_declaration_callback,
- udpg_entryfn_prologue_pre_context_callback,
- @@ -9857,7 +9873,7 @@ uprobe_derived_probe_group::emit_module_dyninst_decls (systemtap_session& s)
- // Since we're sharing the entry function, we have to dynamically choose the probe_type
- string probe_type = "((sup->flags & STAPDYN_PROBE_FLAG_RETURN) ?"
- " stp_probe_type_uretprobe : stp_probe_type_uprobe)";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "sup->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "sup->probe",
- probe_type);
- s.op->newline() << "c->uregs = regs ?: &stapdu_dummy_uregs;";
- @@ -10546,7 +10562,7 @@ hwbkpt_derived_probe_group::emit_module_decls (systemtap_session& s)
- // XXX: why not match stap_hwbkpt_ret_array[i] against bp instead?
- s.op->newline() << "if (bp->attr.bp_addr==hp->bp_addr && bp->attr.bp_type==hp->bp_type && bp->attr.bp_len==hp->bp_len) {";
- s.op->newline(1) << "struct stap_hwbkpt_probe *skp = &stap_hwbkpt_probes[i];";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "skp->probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "skp->probe",
- "stp_probe_type_hwbkpt");
- s.op->newline() << "if (user_mode(regs)) {";
- s.op->newline(1)<< "c->user_mode_p = 1;";
- @@ -11866,7 +11882,7 @@ tracepoint_derived_probe_group::emit_module_decls (systemtap_session& s)
- s.op->newline() << "{";
- s.op->newline(1) << "const struct stap_probe * const probe = "
- << common_probe_init (p) << ";";
- - common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "probe",
- + common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "", "probe",
- "stp_probe_type_tracepoint");
- s.op->newline() << "c->ips.tp.tracepoint_system = "
- << lex_cast_qstring (p->tracepoint_system)
- diff --git a/tapsets.h b/tapsets.h
- index b52c35c21..2a11ebd6f 100644
- --- a/tapsets.h
- +++ b/tapsets.h
- @@ -21,6 +21,7 @@ void register_standard_tapsets(systemtap_session& sess);
- std::vector<derived_probe_group*> all_session_groups(systemtap_session& s);
- std::string common_probe_init (derived_probe* p);
- void common_probe_entryfn_prologue (systemtap_session& s, std::string statestr,
- + std::string statestr2,
- std::string probe, std::string probe_type,
- bool overload_processing = true,
- void (*declaration_callback)(systemtap_session& s, void* data) = NULL,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement