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