64kramsystem / 64kramsystem/ghidra-vice-connector
CPU execution history: show last N instructions on stop
- Vorherrschende Sprache
- Python
- Sterne
- 1
- Forks
- 0
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
## Summary
After hitting a breakpoint, display the last N instructions that were executed — PC, register snapshot, and clock cycle for each. This is critical for understanding how execution arrived at a given point, especially in interrupt-driven game code.
Source: VICE BMP `CPU History` command (0x86), also used by RetroDebugger's "Rewind" view.
---
## BMP protocol details
**Command:** `CMD_CPU_HISTORY = 0x86`
**Request payload:**
```
num_instructions (2 LE) — how many history entries to return
```
**Response:** one `RESP_CPU_HISTORY` (0x86) frame per instruction (most recent last), each entry:
```
cycle_count (8 bytes LE) — CPU clock cycle at the time
addr (2 LE) — PC value
op (1) — opcode byte
p (1) — processor status (FL)
sp (1) — stack pointer
a (1)
x (1)
y (1)
```
(Format confirmed from VICE source `src/monitor/monitor_binary.c` `monitor_binary_response_cpu_history`.)
The terminal frame is `RESP_CPU_HISTORY_END` (0x87).
---
## Implementation plan
### 1. `util.py`
```python
CMD_CPU_HISTORY = 0x86
RESP_CPU_HISTORY = 0x86
RESP_CPU_HISTORY_END = 0x87
def cpu_history(self, count: int = 256) -> list[dict]:
frames = self._command_multi(
CMD_CPU_HISTORY,
struct.pack('
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Das Issue beschreibt das BMP-Protokoll und enthält einen vollständigen Implementierungsplan. Lies zunächst den VICE-Quellcode-Link, um das Binärformat zu verstehen. Die zu ändernden Dateien sind aufgeführt: Füge util.py Konstanten und die Methode cpu_history() hinzu, füge methods.py die Methode show_cpu_history hinzu und integriere dies optional in on_stop() von commands.py. Teste dies, indem du eine Verbindung zu einer VICE-Instanz herstellst und die Ghidra Debugger-Konsole auf den protokollierten Verlauf prüfst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Bereich
- devtools
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 65/100