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/debugger/debugger.h>
14
15#include <mgba/internal/arm/arm.h>
16#include <mgba-util/vector.h>
17
18struct ParseTree;
19struct ARMDebugBreakpoint {
20 uint32_t address;
21 struct ParseTree* condition;
22 bool isSw;
23 struct {
24 uint32_t opcode;
25 enum ExecutionMode mode;
26 } sw;
27};
28
29struct ARMDebugWatchpoint {
30 uint32_t address;
31 enum mWatchpointType type;
32 struct ParseTree* condition;
33};
34
35DECLARE_VECTOR(ARMDebugBreakpointList, struct ARMDebugBreakpoint);
36DECLARE_VECTOR(ARMDebugWatchpointList, struct ARMDebugWatchpoint);
37
38struct ARMDebugger {
39 struct mDebuggerPlatform d;
40 struct ARMCore* cpu;
41
42 struct ARMDebugBreakpointList breakpoints;
43 struct ARMDebugBreakpointList swBreakpoints;
44 struct ARMDebugWatchpointList watchpoints;
45 struct ARMMemory originalMemory;
46
47 void (*entered)(struct mDebugger*, enum mDebuggerEntryReason, struct mDebuggerEntryInfo*);
48
49 bool (*setSoftwareBreakpoint)(struct ARMDebugger*, uint32_t address, enum ExecutionMode mode, uint32_t* opcode);
50 bool (*clearSoftwareBreakpoint)(struct ARMDebugger*, uint32_t address, enum ExecutionMode mode, uint32_t opcode);
51};
52
53struct mDebuggerPlatform* ARMDebuggerPlatformCreate(void);
54bool ARMDebuggerSetSoftwareBreakpoint(struct mDebuggerPlatform* debugger, uint32_t address, enum ExecutionMode mode);
55void ARMDebuggerClearSoftwareBreakpoint(struct mDebuggerPlatform* debugger, uint32_t address);
56
57CXX_GUARD_END
58
59#endif