public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/13516] New: more robust handling of ^C
@ 2011-12-19 20:58 fche at redhat dot com
  2012-06-06 15:50 ` [Bug translator/13516] " cmeek at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: fche at redhat dot com @ 2011-12-19 20:58 UTC (permalink / raw)
  To: systemtap

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug translator/13516] more robust handling of ^C
  2011-12-19 20:58 [Bug translator/13516] New: more robust handling of ^C fche at redhat dot com
@ 2012-06-06 15:50 ` cmeek at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: cmeek at redhat dot com @ 2012-06-06 15:50 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=13516

Chris Meek <cmeek at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |cmeek at redhat dot com
         Resolution|                            |FIXED
         AssignedTo|systemtap at sourceware dot |cmeek at redhat dot com
                   |org                         |

--- Comment #1 from Chris Meek <cmeek at redhat dot com> 2012-06-06 15:50:38 UTC ---
Fixed in commit 985892de26421

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-06 15:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-19 20:58 [Bug translator/13516] New: more robust handling of ^C fche at redhat dot com
2012-06-06 15:50 ` [Bug translator/13516] " cmeek at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).