Refactoring recording loop

Robert O'Callahan robert at
Sun Feb 1 21:13:14 PST 2015

On Tue, Jan 27, 2015 at 11:35 AM, Robert O'Callahan <robert at>

> RecordSession::record_step is pretty complicated and hard to understand
> and I'm finding it very difficult to modify (e.g. to handle multiple
> pending signals). I'd like to simplify it.
> First it picks a task to schedule. That task usually has a pending
> wait_status we need to process, but sometimes doesn't (depending on the
> pending_events stack). record_step makes state changes based on the task's
> wait_status and pending_events stack, and then may continue the task via
> one of a few different paths, some of which wait and some don't. After
> continuing via the main resume_execution path, 'record_step' may make more
> state changes before returning.
> I think ideally each iteration of record_step would pick a task that has
> stopped, process that task's wait_status, fully consuming it (and resetting
> wait_status to 0 to ensure we don't process it again). Then and only then,
> as its last action, it would optionally resume the task.

This is mostly done now, and pushed upstream. Some more refactoring and
simplifications of record_step could be done, but it's much much better. It
would be nice eventually to have all task-continues that run tracee code
(i.e. not AutoRemoteSyscalls or other such puppetry) boil down to the
single task_continue at the end of record_step, so that all waits on tracee
execution happen in the Scheduler. But this is not important to me right

The same pushed branch reworked signal delivery while in syscallbuf so that
go_to_a_happy_place is entirely removed. No more singlestepping to find a
safe place to deliver a signal! That push also resolves handling of
multiple pending signals, up to my testing so far; some of the tests I
checked in are quite aggressive.

oIo otoeololo oyooouo otohoaoto oaonoyooonoeo owohooo oioso oaonogoroyo
owoiotoho oao oboroootohoeoro oooro osoiosotoeoro owoiololo oboeo
osouobojoeocoto otooo ojouodogomoeonoto.o oAogoaoiono,o oaonoyooonoeo
osoaoyoso otooo oao oboroootohoeoro oooro osoiosotoeoro,o o‘oRoaocoao,o’o
oaonosowoeoroaoboloeo otooo otohoeo ocooouoroto.o oAonodo oaonoyooonoeo
osoaoyoso,o o‘oYooouo ofooooolo!o’o owoiololo oboeo oiono odoaonogoeoro
otohoeo ofoioroeo ooofo ohoeololo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the rr-dev mailing list