]> sourceware.org Git - systemtap.git/commitdiff
translator: probe-condition error handling
authorFrank Ch. Eigler <fche@redhat.com>
Fri, 7 Aug 2020 15:57:08 +0000 (11:57 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Fri, 7 Aug 2020 15:57:08 +0000 (11:57 -0400)
Ensure generated code for runtime errors in probe condition
expressions have a proper exit label to jump to.

testsuite/runok/badregs.stp [changed mode: 0644->0755]
testsuite/runok/errcond.stp [new file with mode: 0755]
translate.cxx

old mode 100644 (file)
new mode 100755 (executable)
diff --git a/testsuite/runok/errcond.stp b/testsuite/runok/errcond.stp
new file mode 100755 (executable)
index 0000000..7415fe5
--- /dev/null
@@ -0,0 +1,3 @@
+#! stap -p5
+
+global x  probe end if (x/0) { }  probe begin { x = 1 exit() }
index b10af5ab54568c71d6b135aa93759ae16ad645c5..a29d9da2914e097acb8c8b30c528b6d4b24d11f5 100644 (file)
@@ -2903,7 +2903,15 @@ c_unparser::emit_probe (derived_probe* v)
           for (set<derived_probe*>::const_iterator
                 it  = v->probes_with_affected_conditions.begin();
                 it != v->probes_with_affected_conditions.end(); ++it)
-            emit_probe_condition_update(*it);
+            {
+              // emit a local out: label, for error catching in these condition exprs
+              o->newline() << "{";
+              o->newline(1) << "__label__ out, deref_fault;";
+              emit_probe_condition_update(*it);
+              o->newline(-1) << "deref_fault: __attribute__((unused));";
+              o->newline() << "out: __attribute__((unused));";
+              o->newline() << "}";
+            }
         }
 
       if (v->needs_global_locks ())
This page took 0.035796 seconds and 5 git commands to generate.