all repos — mgba @ 35906b51fd30b829fe3d53a31b0b488e7b570773

mGBA Game Boy Advance Emulator

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