Add configurable VM debug snapshots - #7110
Open
spark2k06 wants to merge 5 commits into
Open
Conversation
Add a paused-VM snapshot facility that writes CPU state, recent I/O port accesses, conventional RAM, and active device metadata to timestamped directories. Expose snapshot contents through the Qt UI and add an optional device_t callback so devices can provide detailed dumps without manual provider registration. The conventional RAM dump is capped at 640 KB and records the actual configured size in the manifest.
Implement the device debug snapshot callback for IBM EGA and compatible EGA variants. The dump records EGA registers and key display state in ega.txt, and writes the current EGA VRAM contents to ega_vram.bin for offline comparison.
Implement the device debug snapshot callback for IBM CGA and the Pravetz VDC-2 variant. The dump records CGA CRTC registers, mode and timing state in cga.txt, and writes the 16 KB CGA VRAM contents to cga_vram.bin.
Describe the paused-VM snapshot workflow, selectable core data, conventional RAM sizing, and the currently implemented EGA and CGA device dumps. Also document that future devices can opt in by filling the optional debug_snapshot callback in their device_t definition.
Author
|
Addressed the CodeQL findings in Changes made:
|
| #ifdef _WIN32 | ||
| return plat_fopen(path, "wb"); | ||
| #else | ||
| int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); |
Author
|
This remaining CodeQL path-injection alert is on the centralized snapshot file helper. The filename component is now restricted to fixed/sanitized names and POSIX files are created with I believe this is a false positive for this feature rather than an additional security issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a paused-VM debug snapshot facility for collecting emulator state into timestamped directories under the VM path.
The snapshot contents are configurable from the UI and currently include:
device_tcallbackDetailed device snapshot support is currently implemented for:
ega.txt,ega_vram.bin)cga.txt,cga_vram.bin)This is intended to make paused emulator state easier to inspect and share when debugging hardware-specific issues, while keeping the mechanism extensible for additional devices.
Checklist
References
The initial use case for this feature is comparing paused emulator state while improving compatibility in MiSTer PC/XT-family FPGA cores and derived projects. The snapshot output makes it easier to compare CPU state, conventional RAM, I/O activity, and video adapter state against 86Box.
Related projects:
No ROM or asset changes are required.