]> sourceware.org Git - systemtap.git/commitdiff
PR11573: infer need for uprobes from special embedded-c markup tag
authorFrank Ch. Eigler <fche@elastic.org>
Fri, 7 May 2010 16:57:50 +0000 (12:57 -0400)
committerFrank Ch. Eigler <fche@elastic.org>
Fri, 7 May 2010 16:57:50 +0000 (12:57 -0400)
* 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.

elaborate.cxx
tapset/ucontext-unwind.stp

index 0ff40316fbe0ad143dfeecf42415bf7e5b95d036..b5279e57c5071ae128bd64a50a1c440a955e3d8a 100644 (file)
@@ -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;
+    }
 }
 
 
index b9a9fbb534a5ebec898c16471ca1a18ed3a92700..b1545bc6ffe65a78f639748a0341766af6340b31 100644 (file)
@@ -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,
This page took 0.047508 seconds and 5 git commands to generate.