]> sourceware.org Git - systemtap.git/commitdiff
PR27274: tolerate aborted update_visitor traversals
authorFrank Ch. Eigler <fche@redhat.com>
Mon, 3 May 2021 22:02:57 +0000 (18:02 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Mon, 3 May 2021 22:02:57 +0000 (18:02 -0400)
The update_visitor dtor has had an assert() for its value-stack
being empty by the time of its execution.  But some combinations
of errors (exceptions being thrown & caught), this assertion could
fire and those diagnostics hidden.  So we now ditch the assert()
and leave behind exceptions and other optimistic cleanup.

staptree.h

index a58008657e67528ac660ce2c54a1b6f06d34b218..228e8705ca183ea5195bfb292ace404940a5916f 100644 (file)
@@ -1346,10 +1346,17 @@ struct update_visitor: public visitor
   }
 
   update_visitor(unsigned v = 0): verbose(v), aborted_p(false), relaxed_p(true) {}
-  virtual ~update_visitor() { assert(values.empty()); }
+  virtual ~update_visitor() {
+    if (!values.empty())
+      /* PR27274: tolerate aborted traversals */
+      std::runtime_error(_("update_visitor dtor has unused values"));
+  }
 
   // Permit reuse of the visitor object. 
-  virtual void reset() { aborted_p = false; relaxed_p = true; }
+  virtual void reset() { aborted_p = false; relaxed_p = true;
+    /* PR27274: tolerate aborted traversals */
+    while (!values.empty()) values.pop();
+ }
   virtual bool relaxed() { return relaxed_p; }
     
   virtual void visit_block (block *s);
This page took 0.02857 seconds and 5 git commands to generate.