-
-
Save agentzh/8c1180ac71ae899f222e3a54b0253ed6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/NEWS b/NEWS | |
index 303a1075e..c927c0f69 100644 | |
--- a/NEWS | |
+++ b/NEWS | |
@@ -2,6 +2,9 @@ | |
* What's new in version 4.2, 2019-11-18 | |
+- The process(EXE).begin probe handlers are now always triggered for | |
+ already-running target processes. | |
+ | |
- Initial support for multi-dimensional supports has been added to | |
the stapbpf backend. Note that these arrays cannot be iterated upon | |
with a foreach loop. | |
diff --git a/runtime/linux/debug.h b/runtime/linux/debug.h | |
index e23ee96e7..d2ab9e8db 100644 | |
--- a/runtime/linux/debug.h | |
+++ b/runtime/linux/debug.h | |
@@ -73,6 +73,17 @@ | |
#define dbug_unwind(level, args...) ; | |
#endif | |
+ | |
+#ifdef DEBUG_TASK_FINDER | |
+#define dbug_task(level, args...) do { \ | |
+ if ((level) <= DEBUG_TASK_FINDER) \ | |
+ _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..d4d811834 100644 | |
--- a/runtime/linux/task_finder2.c | |
+++ b/runtime/linux/task_finder2.c | |
@@ -35,10 +35,10 @@ 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))) | |
+#define debug_task_finder_report() \ | |
+ dbug_task(1, "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 */ | |
@@ -532,6 +532,8 @@ __stp_utrace_attach(struct task_struct *tsk, | |
} | |
else { | |
rc = utrace_set_events(tsk, engine, event_flags); | |
+ dbug_task(2, "utrace_set_events(%lu) returned %d", event_flags, | |
+ rc); | |
if (rc == -EINPROGRESS) { | |
/* | |
* It's running our callback, so we have to | |
@@ -553,6 +555,7 @@ __stp_utrace_attach(struct task_struct *tsk, | |
if (action != UTRACE_RESUME) { | |
rc = utrace_control(tsk, engine, action); | |
+ dbug_task(2, "utrace_control(%d) returned %d", action, rc); | |
/* If utrace_control() returns | |
* EINPROGRESS when we're trying to | |
* stop/interrupt, that means the task | |
@@ -588,6 +591,8 @@ __stp_call_callbacks(struct stap_task_finder_target *tgt, | |
struct list_head *cb_node; | |
int rc; | |
+ dbug_task(2, "entering tgt=%p tsk=%p pid=%d", tgt, tsk, tsk ? tsk->tgid : -1); | |
+ | |
if (tgt == NULL || tsk == NULL) | |
return; | |
@@ -600,6 +605,13 @@ __stp_call_callbacks(struct stap_task_finder_target *tgt, | |
continue; | |
rc = cb_tgt->callback(cb_tgt, tsk, register_p, process_p); | |
+ | |
+ dbug_task(2, "tgt %s callback returned %d (proc=%s pid=%d, " | |
+ "pathlen=%d, engine-attached=%d)", | |
+ (cb_tgt->purpose?:""), rc, cb_tgt->procname, | |
+ cb_tgt->pid, (int) cb_tgt->pathlen, | |
+ cb_tgt->engine_attached); | |
+ | |
if (rc != 0) { | |
_stp_warn("task_finder %s%scallback for task %d failed: %d", | |
(cb_tgt->purpose?:""), (cb_tgt->purpose?" ":""), | |
@@ -835,7 +847,11 @@ __stp_utrace_attach_match_filename(struct task_struct *tsk, | |
else if (tgt->pathlen > 0 | |
&& (tgt->pathlen != filelen | |
|| strcmp(tgt->procname, filename) != 0)) | |
+ { | |
+ dbug_task(2, "target path NOT matched: [%s] != [%s]", | |
+ tgt->procname, filename); | |
continue; | |
+ } | |
/* Ignore pid-based target, they were handled at startup. */ | |
else if (tgt->pid != 0) | |
continue; | |
@@ -1660,6 +1676,10 @@ stap_start_task_finder(void) | |
rc = __stp_utrace_attach(tsk, &__stp_utrace_task_finder_ops, 0, | |
__STP_TASK_FINDER_EVENTS, | |
UTRACE_RESUME); | |
+ | |
+ dbug_task(2, "__stp_utrace_attach() for pid %d returned %d", | |
+ tsk->tgid, rc); | |
+ | |
if (rc == EPERM) { | |
/* Ignore EPERM errors, which mean this wasn't | |
* a thread we can attach to. */ | |
@@ -1724,7 +1744,11 @@ stap_start_task_finder(void) | |
else if (tgt->pathlen > 0 | |
&& (tgt->pathlen != mmpathlen | |
|| strcmp(tgt->procname, mmpath) != 0)) | |
+ { | |
+ dbug_task(2, "target path not matched: [%s] != [%s]", | |
+ tgt->procname, mmpath); | |
continue; | |
+ } | |
/* pid-based target */ | |
else if (tgt->pid != 0 && tgt->pid != tsk->pid) | |
continue; | |
@@ -1747,6 +1771,10 @@ stap_start_task_finder(void) | |
rc = __stp_utrace_attach(tsk, &tgt->ops, tgt, | |
__STP_ATTACHED_TASK_EVENTS, | |
UTRACE_STOP); | |
+ | |
+ dbug_task(2, "__stp_utrace_attach() for %d returned %d", tsk->tgid, | |
+ rc); | |
+ | |
if (rc != 0 && rc != EPERM) | |
goto stf_err; | |
rc = 0; /* ignore EPERM */ | |
@@ -1771,18 +1799,13 @@ stap_task_finder_post_init(void) | |
return; | |
} | |
-#ifdef DEBUG_TASK_FINDER | |
- printk(KERN_ERR "%s:%d - entry.\n", __FUNCTION__, __LINE__); | |
-#endif | |
+ dbug_task(2, "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(2, "exiting early..."); | |
break; | |
} | |
@@ -1824,6 +1847,10 @@ stap_task_finder_post_init(void) | |
_stp_error("utrace_control returned error %d on pid %d", | |
rc, (int)tsk->pid); | |
} | |
+ | |
+ dbug_task(2, "utrace_control(UTRACE_INTERRUPT) for pid %d " | |
+ "returned %d (%d)", tsk->pid, rc, -EINPROGRESS); | |
+ | |
utrace_engine_put(engine); | |
/* Since we only need to interrupt | |
@@ -1835,9 +1862,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(2, "exit."); | |
return; | |
} | |
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..f85607398 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(2, \"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,10 @@ 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(2, \"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 +1183,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..68ec74b43 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,20 @@ 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, " | |
+ "expecting " << statestr << " (%d)" | |
+ << (statestr2.empty() ? "" : string(" or ") + statestr2 + " (%d)") | |
+ << "\", sess_state, " << statestr | |
+ << (statestr2.empty() ? "" : string(", ") + statestr2) << ");"; | |
+ s.op->newline() << "#endif"; | |
+ s.op->newline() << "if (sess_state != " << statestr | |
+ << (statestr2.empty() ? "" : string(" && sess_state != ") + statestr2) | |
+ << ")"; | |
+ s.op->newline() << "goto probe_epilogue;"; | |
+ s.op->newline(-1) << "}"; | |
if (pre_context_callback) | |
{ | |
@@ -6079,7 +6090,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 +6127,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 +9476,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 +9511,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 +9675,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 +9868,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 +10557,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 +11877,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, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment