Skip to content

Conversation

donadigo
Copy link

@donadigo donadigo commented Jan 15, 2024

This is an initial implementation of saving previous steps when stepping through the process on Windows.

The command is available in the Control -> Step back menu. This feature works similarly to what is implemented in Visual Studio Enterprise. If you stepped through a specific line, you'll be able to step back to it and inspect all locals and call stack (even the objects that were not expanded before, or with different view rules). The snapshots are released once the target enters run state again (continue).

Internally, a new entity kind is created in df and demon that represents a snapshot. Snapshots are children of threads and are created using PssCaptureSnapshot which greatly simplifies the implementation as Windows takes care of doing all of the copy-on-write work that's required to preserve the state. Once a snapshot is activated, we just change the entity we are reading from.

Things to check:

  • potential bugs/annoyances?

@donadigo donadigo changed the title Draft: Initial implementation of stepping back on Windows Initial implementation of stepping back on Windows Jan 15, 2024
@donadigo donadigo marked this pull request as ready for review January 19, 2024 00:41
@GloriousPtr
Copy link

Can't wait for this to be merged.

@FaultyPine
Copy link

Haven't tested this, but what came to mind reading this is taking the snapshot on every step might be slow. Of course, since it's copy-on-write, it's likely not that bad, but I find myself occasionally setting a breakpoint, and holding F5 or Step Over to really quickly blow through some code. Having this happen every time could be detrimental to that particular use case.
It would be worth it to actually profile the impact of this, but a reasonable fix if it is detrimental could be to have this be an opt-in user preference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants