src/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#include "debugger/debugger.h"
7
8struct ARMDebugBreakpoint {
9 uint32_t address;
10 bool isSw;
11 struct {
12 uint32_t opcode;
13 enum ExecutionMode mode;
14 } sw;
15};
16
17struct ARMDebugWatchpoint {
18 uint32_t address;
19 enum mWatchpointType type;
20};
21
22DECLARE_VECTOR(ARMDebugBreakpointList, struct ARMDebugBreakpoint);
23DECLARE_VECTOR(ARMDebugWatchpointList, struct ARMDebugWatchpoint);
24
25struct ARMDebugger {
26 struct mDebuggerPlatform d;
27 struct ARMCore* cpu;
28
29 struct ARMDebugBreakpointList breakpoints;
30 struct ARMDebugBreakpointList swBreakpoints;
31 struct ARMDebugWatchpointList watchpoints;
32 struct ARMMemory originalMemory;
33
34 void (*entered)(struct mDebugger*, enum mDebuggerEntryReason, struct mDebuggerEntryInfo*);
35
36 bool (*setSoftwareBreakpoint)(struct ARMDebugger*, uint32_t address, enum ExecutionMode mode, uint32_t* opcode);
37 bool (*clearSoftwareBreakpoint)(struct ARMDebugger*, uint32_t address, enum ExecutionMode mode, uint32_t opcode);
38};
39
40struct mDebuggerPlatform* ARMDebuggerPlatformCreate(void);
41bool ARMDebuggerSetSoftwareBreakpoint(struct mDebuggerPlatform* debugger, uint32_t address, enum ExecutionMode mode);
42void ARMDebuggerClearSoftwareBreakpoint(struct mDebuggerPlatform* debugger, uint32_t address);