This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug translator/13516] New: more robust handling of ^C
- From: "fche at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sourceware dot org
- Date: Sun, 18 Dec 2011 19:46:55 +0000
- Subject: [Bug translator/13516] New: more robust handling of ^C
- Auto-submitted: auto-generated
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.