On Fri, Jun 02, 2017 at 05:05:56PM +0300, Victor Krapivensky wrote: > This change decouples waiting for next event from reacting to it. This > makes the control flow easier to understand, and serves as a preparation > for implementing a pull-style API for LuaJIT. > > * strace.c (enum trace_event): New enum. > (trace): Split into... > (next_event, dispatch_event): ...new functions. > (main): Use them.
Thanks, I merged this as you've probably noticed already. > --- > strace.c | 351 > ++++++++++++++++++++++++++++++++++++++------------------------- > 1 file changed, 211 insertions(+), 140 deletions(-) > > diff --git a/strace.c b/strace.c > index 42650ab..0d3c8e9 100644 > --- a/strace.c > +++ b/strace.c > @@ -2252,21 +2252,76 @@ print_event_exit(struct tcb *tcp) > line_ended(); > } > > -/* Returns true iff the main trace loop has to continue. */ > -static bool > -trace(void) > +enum trace_event { > + /* Break the main loop. */ > + TE_BREAK, > + > + /* Call next_event() again. */ > + TE_NEXT, > + > + /* Restart the tracee with signal 0 and call next_event() again. */ > + TE_RESTART, > + > + /* > + * For all the events below, current_tcp is set to current tracee's tcb. > + * All the suggested actions imply that you want to continue the > tracing of the current > + * tracee; alternatively, you can detach it. > + */ > + > + /* > + * Syscall entry or exit. > + * Restart the tracee with signal 0, or with an injected signal number. > + */ > + TE_SYSCALL_STOP, > + > + /* > + * Tracee received signal with number WSTOPSIG(*pstatus); signal info > is written to *si. > + * Restart the tracee (with that signal number if you want to deliver > it). > + */ > + TE_SIGNAL_DELIVERY_STOP, Some of these comments needed a wrap so I did it. -- ldv
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel