-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebugger.h
73 lines (59 loc) · 1.79 KB
/
debugger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// debugger.h
// PegasusEar
//
// Created by Kevin Colley on 10/31/20.
//
#ifndef EAR_DEBUGGER_H
#define EAR_DEBUGGER_H
#include "ear.h"
#include <stdbool.h>
typedef struct Debugger Debugger;
typedef EAR_Byte BreakpointID;
/*!
* @brief Initializes a debugger that will control the provided EAR processor.
*
* @param cpu EAR processor to debug
* @return Newly initialized debugger object
*/
Debugger* Debugger_init(EAR* cpu);
/*! Destroys a debugger object that was previously created using `Debugger_init`. */
void Debugger_destroy(Debugger* dbg);
/*!
* @brief Registers a hardware breakpoint.
*
* @param addr Virtual address to place a breakpoint
* @param prot Mask of memory access modes to break on
* @return Registered breakpoint ID
*/
BreakpointID Debugger_addBreakpoint(Debugger* dbg, EAR_Size addr, EAR_Protection prot);
/*!
* @brief Temporarily disables a registered breakpoint.
*
* @param bpid Breakpoint ID to disable
*/
void Debugger_disableBreakpoint(Debugger* dbg, BreakpointID bpid);
/*!
* @brief Enables a previously disabled breakpoint.
*
* @param bpid Breakpoint ID to enable
*/
void Debugger_enableBreakpoint(Debugger* dbg, BreakpointID bpid);
/*!
* @brief Toggles whether the target breakpoint is enabled or disabled.
*
* @param bpid Breakpoint ID to toggle
* @return Whether the breakpoint is now enabled or disabled
*/
bool Debugger_toggleBreakpoint(Debugger* dbg, BreakpointID bpid);
/*!
* @brief Removes a breakpoint so that its ID may be reused.
*
* @param bpid Breakpoint ID to remove
*/
void Debugger_removeBreakpoint(Debugger* dbg, BreakpointID bpid);
/*! Clear all registered breakpoints. */
void Debugger_clearBreakpoints(Debugger* dbg);
/*! Interactively runs the debugger. */
EAR_HaltReason Debugger_run(Debugger* dbg);
#endif /* EAR_DEBUGGER_H */