// Public source: https://vccplus-git.brianholman.com/VCCPlus/VCCPlusOSS/src/branch/main/src/core/MachineSession.cpp
// Selected code lines: 12; selection, not the full current source.
// Original copyright/license notice and selected code follow unchanged.
// SPDX-License-Identifier: GPL-3.0-or-later
void MachineSession::debuggerStepSource(SourceStepMode mode, const std::vector<DebugSourceInstruction>& instructions,
std::uint64_t expectedGeneration, std::uint64_t expectedProgramRevision,
std::uint64_t expectedMappingFingerprint, std::uint16_t expectedPC,
unsigned maximumInstructions, unsigned maximumFrames) {
if (!impl || impl->state != RunState::Paused) throw std::logic_error("Pause at a verified C source location before stepping");
if (mode != SourceStepMode::Into && mode != SourceStepMode::Over && mode != SourceStepMode::Out)
throw std::invalid_argument("Unknown C stepping mode");
if (expectedGeneration != generation || expectedProgramRevision != debuggerProgramRevision ||
expectedMappingFingerprint != mappingFingerprint(GetMMUState()) || expectedPC != impl->CpuState().PC)
throw std::invalid_argument("The paused program changed; refresh before C stepping");
if (instructions.empty() || instructions.size() > 65536 || !maximumInstructions || maximumInstructions > 1000000 || !maximumFrames || maximumFrames > 600)
throw std::invalid_argument("Invalid C step locations or execution limit");
Evidence record
snippets/source-step-guards.cpp.inc
From Windows Application to Portable Emulation Platform
1,573 bytes
SHA-25610a531a8f58fa740fb745f2f499c3263f57ed1fe38c6a9c2460797c3bb2ad433