From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2392 invoked by alias); 18 Dec 2011 19:47:25 -0000 Received: (qmail 2384 invoked by uid 22791); 18 Dec 2011 19:47:24 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 18 Dec 2011 19:47:12 +0000 From: "fche at redhat dot com" To: systemtap@sourceware.org Subject: [Bug translator/13516] New: more robust handling of ^C Date: Mon, 19 Dec 2011 20:58:00 -0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: translator X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fche at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2011-q4/txt/msg00392.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=13516 Bug #: 13516 Summary: more robust handling of ^C Product: systemtap Version: unspecified Status: NEW Severity: normal Priority: P2 Component: translator AssignedTo: systemtap@sourceware.org ReportedBy: fche@redhat.com Classification: Unclassified In many places in the translator, we check for pending_interrupts, and simply return or quit nested loops early, being assured that eventually we'll bubble back up to the top level and get a proper rc=EXIT_FAILURE. This is not quite good enough. In some cases, an unfortunately timed interrupt can result in an exit from a routine, with expected post-conditions not met. For example, elaborate.cxx includes: 1665 1666 // Add created probe 1667 p->body = b; 1668 derive_probes (s, p, dps); 1669 for (unsigned i = 0; i < dps.size(); i++) 1670 { 1671 derived_probe* dp = dps[i]; 1672 s.probes.push_back (dp); 1673 dp->join_group (s); 1674 } 1675 // Repopulate symbol and type info 1676 symresolution_info sym (s); 1677 sym.current_function = 0; 1678 sym.current_probe = dps[0]; 1679 dps[0]->body->visit (& sym); If the interrupt was taken during the derive_probes() call, it will have left the dps[] array empty, but will simply return. On line 1678, dps[0] will be dereferenced, bang, segv. The code could, I suppose, protect itself with more explicit checks, but this seems to be more labour than necessary. Let's instead explore replacing all if (pending_interrupts) break; or if (pending_interrupts) return; with if (pending_interrupts) throw runtime_error("interrupt received"); and catch that in main() someplace. This should make it unnecessary to check & test in quite so many places. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.