all repos — mgba @ 6616ca9111785abada65142442c51a84dc0c804d

mGBA Game Boy Advance Emulator

src/debugger/debugger.h (view raw)

 1#ifndef DEBUGGER_H
 2#define DEBUGGER_H
 3
 4#include "arm.h"
 5
 6enum DebuggerState {
 7	DEBUGGER_PAUSED,
 8	DEBUGGER_RUNNING,
 9	DEBUGGER_EXITING,
10	DEBUGGER_SHUTDOWN
11};
12
13struct DebugBreakpoint {
14	struct DebugBreakpoint* next;
15	int32_t address;
16};
17
18struct DebugMemoryShim {
19	struct ARMMemory d;
20	struct ARMMemory* original;
21
22	struct ARMDebugger* p;
23	struct DebugBreakpoint* watchpoints;
24};
25
26enum DebuggerEntryReason {
27	DEBUGGER_ENTER_MANUAL,
28	DEBUGGER_ENTER_BREAKPOINT,
29	DEBUGGER_ENTER_WATCHPOINT,
30	DEBUGGER_ENTER_ILLEGAL_OP
31};
32
33struct ARMDebugger {
34	enum DebuggerState state;
35	struct ARMCore* cpu;
36
37	struct DebugBreakpoint* breakpoints;
38	struct DebugMemoryShim memoryShim;
39
40	void (*init)(struct ARMDebugger*);
41	void (*deinit)(struct ARMDebugger*);
42	void (*paused)(struct ARMDebugger*);
43	void (*entered)(struct ARMDebugger*, enum DebuggerEntryReason);
44};
45
46void ARMDebuggerInit(struct ARMDebugger*, struct ARMCore*);
47void ARMDebuggerDeinit(struct ARMDebugger*);
48void ARMDebuggerRun(struct ARMDebugger*);
49void ARMDebuggerEnter(struct ARMDebugger*, enum DebuggerEntryReason);
50void ARMDebuggerSetBreakpoint(struct ARMDebugger* debugger, uint32_t address);
51void ARMDebuggerSetWatchpoint(struct ARMDebugger* debugger, uint32_t address);
52
53#endif