From: Frank Ch. Eigler Date: Fri, 7 May 2010 16:57:50 +0000 (-0400) Subject: PR11573: infer need for uprobes from special embedded-c markup tag X-Git-Tag: release-1.3~370 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=6a80494e753367b7096a928705312dfdfa437201;p=systemtap.git PR11573: infer need for uprobes from special embedded-c markup tag * tapset/ucontext-unwind.stp: Mark up these babies with /* pragma:uprobes */. * elaborate.cxx (typeresolution_info::visit_embeddedcode): Look for that and activate session.need_uprobes if found. --- diff --git a/elaborate.cxx b/elaborate.cxx index 0ff40316f..b5279e57c 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -4251,8 +4251,21 @@ typeresolution_info::visit_try_block (try_block* e) void -typeresolution_info::visit_embeddedcode (embeddedcode*) +typeresolution_info::visit_embeddedcode (embeddedcode* s) { + // PR11573. If we have survived thus far with a piece of embedded + // code that requires uprobes, we need to track this. + // + // This is an odd place for this check, as opposed + // to a separate 'optimization' pass, or c_unparser::visit_embeddedcode + // over yonder in pass 3. However, we want to do it during pass 2 so + // that cached sessions also get the uprobes treatment. + if (!session.need_uprobes && s->code.find("/* pragma:uprobes */") != string::npos) + { + if (session.verbose > 2) + clog << "Activating uprobes support because /* pragma:uprobes */ seen." << endl; + session.need_uprobes = true; + } } diff --git a/tapset/ucontext-unwind.stp b/tapset/ucontext-unwind.stp index b9a9fbb53..b1545bc6f 100644 --- a/tapset/ucontext-unwind.stp +++ b/tapset/ucontext-unwind.stp @@ -24,7 +24,7 @@ * Equivalent to print_ustack(ubacktrace()), * except that deeper stack nesting may be supported. Return nothing. */ -function print_ubacktrace () %{ /* unprivileged */ +function print_ubacktrace () %{ /* unprivileged */ /* pragma:uprobes */ assert_is_myproc(); if (CONTEXT->regs) { _stp_stack_print(CONTEXT->regs, 1, CONTEXT->pi, MAXTRACE, @@ -41,7 +41,7 @@ function print_ubacktrace () %{ /* unprivileged */ * shorter (just name and offset), and the function address is * printed if it can't be mapped to a name. */ -function print_ubacktrace_brief () %{ /* unprivileged */ +function print_ubacktrace_brief () %{ /* unprivileged */ /* pragma:uprobes */ assert_is_myproc(); if (CONTEXT->regs) { _stp_stack_print(CONTEXT->regs, SYM_VERBOSE_BRIEF, CONTEXT->pi, @@ -59,7 +59,7 @@ function print_ubacktrace_brief () %{ /* unprivileged */ * string length. Returns empty string when current probe point cannot * determine user backtrace. */ -function ubacktrace:string () %{ /* pure */ /* unprivileged */ +function ubacktrace:string () %{ /* pure */ /* unprivileged */ /* pragma:uprobes */ assert_is_myproc(); if (CONTEXT->regs) _stp_stack_snprint (THIS->__retvalue, MAXSTRINGLEN,