From 49abf162fa91397b0c65d41f5c9af31ace4e6290 Mon Sep 17 00:00:00 2001 From: fche Date: Thu, 28 Feb 2008 21:34:46 +0000 Subject: PR5045: clean up after interrupts 2008-02-28 Frank Ch. Eigler PR5045 * session.h (pending_interrupts): New global. * main.cxx (handle_interrupts): New fn to handle SIGINT* etc. * elaborate.cxx, translate.cxx, tapsets.cxx, main.cxx (*): Insert pending_interrupts escape hatches inside potentially timetaking loops. * buildrun.cxx: Don't deal with signals. --- elaborate.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'elaborate.cxx') diff --git a/elaborate.cxx b/elaborate.cxx index 7f4ccf35..75714102 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -344,6 +344,8 @@ match_node::find_and_build (systemtap_session& s, const match_key& subkey = i->first; match_node* subnode = i->second; + if (pending_interrupts) break; + if (match.globmatch(subkey)) { if (s.verbose > 2) @@ -627,6 +629,8 @@ derive_probes (systemtap_session& s, { for (unsigned i = 0; i < p->locations.size(); ++i) { + if (pending_interrupts) break; + probe_point *loc = p->locations[i]; try @@ -1070,6 +1074,7 @@ semantic_pass_symbols (systemtap_session& s) s.files.push_back (s.user_file); for (unsigned i = 0; i < s.files.size(); i++) { + if (pending_interrupts) break; stapfile* dome = s.files[i]; // Pass 1: add globals and functions to systemtap-session master list, @@ -1088,6 +1093,7 @@ semantic_pass_symbols (systemtap_session& s) for (unsigned i=0; ifunctions.size(); i++) { + if (pending_interrupts) break; functiondecl* fd = dome->functions[i]; try @@ -1107,6 +1113,7 @@ semantic_pass_symbols (systemtap_session& s) for (unsigned i=0; iprobes.size(); i++) { + if (pending_interrupts) break; probe* p = dome->probes [i]; vector dps; @@ -1116,6 +1123,7 @@ semantic_pass_symbols (systemtap_session& s) for (unsigned j=0; jjoin_group (s); @@ -2025,6 +2033,8 @@ semantic_pass_optimize1 (systemtap_session& s) bool relaxed_p = false; while (! relaxed_p) { + if (pending_interrupts) break; + relaxed_p = true; // until proven otherwise semantic_pass_opt1 (s, relaxed_p); @@ -2052,6 +2062,7 @@ semantic_pass_optimize2 (systemtap_session& s) bool relaxed_p = false; while (! relaxed_p) { + if (pending_interrupts) break; relaxed_p = true; // until proven otherwise semantic_pass_opt5 (s, relaxed_p); @@ -2082,12 +2093,16 @@ semantic_pass_types (systemtap_session& s) // XXX: maybe convert to exception-based error signalling while (1) { + if (pending_interrupts) break; + iterations ++; ti.num_newly_resolved = 0; ti.num_still_unresolved = 0; for (unsigned j=0; j