include/mgba/internal/arm/debugger/debugger.h (view raw)
1/* Copyright (c) 2013-2014 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef ARM_DEBUGGER_H
7#define ARM_DEBUGGER_H
8
9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba/internal/debugger/debugger.h>
14
15#include <mgba/internal/arm/arm.h>
16
17struct ARMDebugBreakpoint {
18 uint32_t address;
19 bool isSw;
20 struct {
21 uint32_t opcode;
22 enum ExecutionMode mode;
23 } sw;
24};
25
26struct ARMDebugWatchpoint {
27 uint32_t address;
28 enum mWatchpointType type;
29};
30
31DECLARE_VECTOR(ARMDebugBreakpointList, struct ARMDebugBreakpoint);
32DECLARE_VECTOR(ARMDebugWatchpointList, struct ARMDebugWatchpoint);
33
34struct ARMDebugger {
35 struct mDebuggerPlatform d;
36 struct ARMCore* cpu;
37
38 struct ARMDebugBreakpointList breakpoints;
39 struct ARMDebugBreakpointList swBreakpoints;
40 struct ARMDebugWatchpointList watchpoints;
41 struct ARMMemory originalMemory;
42
43 void (*entered)(struct mDebugger*, enum mDebuggerEntryReason, struct mDebuggerEntryInfo*);
44
45 bool (*setSoftwareBreakpoint)(struct ARMDebugger*, uint32_t address, enum ExecutionMode mode, uint32_t* opcode);
46 bool (*clearSoftwareBreakpoint)(struct ARMDebugger*, uint32_t address, enum ExecutionMode mode, uint32_t opcode);
47};
48
49struct mDebuggerPlatform* ARMDebuggerPlatformCreate(void);
50bool ARMDebuggerSetSoftwareBreakpoint(struct mDebuggerPlatform* debugger, uint32_t address, enum ExecutionMode mode);
51void ARMDebuggerClearSoftwareBreakpoint(struct mDebuggerPlatform* debugger, uint32_t address);
52
53CXX_GUARD_END
54
55#endif