This is a cache of https://vccplus.brianholman.com/publications/vcc-plus-architecture/evidence/snippets/cpu-debug-hooks-hpp-inc/. It is a snapshot of the page as it appeared on 2026-11-21T00:03:10.247+0000.
snippets/cpu-debug-hooks.hpp.inc — supporting evidence · VCC Plus
← Supporting evidence

Evidence record

snippets/cpu-debug-hooks.hpp.inc

From Windows Application to Portable Emulation Platform

2,172 bytes

// Public source: https://vccplus-git.brianholman.com/VCCPlus/VCCPlusOSS/src/branch/main/src/core/CpuHost.h
// Selected code lines: 40; selection, not the full current source.
// Original copyright/license notice and selected code follow unchanged.
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include "MachineDefs.h"

namespace VCC {
// Called synchronously on the emulation thread. Install before execution and
// keep alive until detached. This does not make the legacy CPU globals reentrant.
class CpuDebugHooks {
public:
    virtual ~CpuDebugHooks() = default;
    virtual bool IsHalted() const = 0;
    virtual void Halt() = 0;
    virtual bool ShouldBreakAt(unsigned short) { return true; }
    virtual bool IsStepping() const { return false; }
    // Optional source stepping runs through normal execution, including IRQs.
    // Defaults keep the Windows debugger and ordinary execution unchanged.
    virtual bool IsSourceStepping() const { return false; }
    virtual bool SourceStepBefore(const CPUState&) { return false; }
    virtual void SourceStepAfter(const CPUState&) {}
    virtual void SourceStepInterrupt(const CPUState&) {}
    virtual bool IsTracingEnabled() const { return false; }
    virtual bool IsTracing() const { return false; }
    virtual bool Halt_Enabled() const { return false; }
    virtual bool Break_Enabled() const { return false; }
    virtual void ApplyHaltpoints(bool) {}
    virtual void TraceStart() {}
    virtual void TraceRegisterWrite(const char*) {}
    virtual void TraceVideoEvent(TraceEvent, unsigned int) {}
    virtual void DiagnosticMessage(const char*) {}
    virtual void TraceCaptureBefore(long, const CPUState&) {}
    virtual void TraceCaptureAfter(long, const CPUState&) {}
    virtual void TraceCaptureInterruptRequest(unsigned char, long, const CPUState&) {}
    virtual void TraceCaptureInterruptServicing(unsigned char, long, const CPUState&) {}
    virtual void TraceCaptureInterruptExecuting(unsigned char, long, const CPUState&) {}
};

CpuDebugHooks& CpuDebugger();
// nullptr restores the platform default (the existing debugger on Windows).
void SetCpuDebugHooks(CpuDebugHooks* hooks);
}

SHA-256bf139519c18eb4d31d0205b335aac50ca23561c384e9180e67ae1733da33fd9d

A closer look

Open original