all repos — mgba @ 75d9085eefa51c7d5a6a5436e4692e6daf0cc4e4

mGBA Game Boy Advance Emulator

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