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 struct mBreakpoint d;
21 struct {
22 uint32_t opcode;
23 enum ExecutionMode mode;
24 } sw;
25};
26
27DECLARE_VECTOR(ARMDebugBreakpointList, struct ARMDebugBreakpoint);
28
29struct ARMDebugger {
30 struct mDebuggerPlatform d;
31 struct ARMCore* cpu;
32
33 struct ARMDebugBreakpointList breakpoints;
34 struct ARMDebugBreakpointList swBreakpoints;
35 struct mWatchpointList watchpoints;
36 struct ARMMemory originalMemory;
37
38 ssize_t nextId;
39 uint32_t stackTraceMode;
40
41 void (*entered)(struct mDebugger*, enum mDebuggerEntryReason, struct mDebuggerEntryInfo*);
42
43 ssize_t (*setSoftwareBreakpoint)(struct ARMDebugger*, uint32_t address, enum ExecutionMode mode, uint32_t* opcode);
44 void (*clearSoftwareBreakpoint)(struct ARMDebugger*, const struct ARMDebugBreakpoint*);
45};
46
47struct mDebuggerPlatform* ARMDebuggerPlatformCreate(void);
48ssize_t ARMDebuggerSetSoftwareBreakpoint(struct mDebuggerPlatform* debugger, uint32_t address, enum ExecutionMode mode);
49
50CXX_GUARD_END
51
52#endif