src/debugger/cli-debugger.h (view raw)
1#ifndef CLI_DEBUGGER_H
2#define CLI_DEBUGGER_H
3
4#include "util/common.h"
5
6#include "debugger.h"
7
8#include <histedit.h>
9
10struct CLIDebugger;
11
12struct CLIDebugVector {
13 struct CLIDebugVector* next;
14 enum CLIDVType {
15 CLIDV_ERROR_TYPE,
16 CLIDV_INT_TYPE,
17 CLIDV_CHAR_TYPE
18 } type;
19 union {
20 int32_t intValue;
21 char* charValue;
22 };
23};
24
25typedef void (*CLIDebuggerCommand)(struct CLIDebugger*, struct CLIDebugVector*);
26typedef struct CLIDebugVector* (*CLIDVParser)(struct CLIDebugger* debugger, const char* string, size_t length);
27
28struct CLIDebuggerCommandSummary {
29 const char* name;
30 CLIDebuggerCommand command;
31 CLIDVParser parser;
32 const char* summary;
33};
34
35struct CLIDebuggerSystem {
36 struct CLIDebugger* p;
37
38 void (*init)(struct CLIDebuggerSystem*);
39 void (*deinit)(struct CLIDebuggerSystem*);
40
41 uint32_t (*lookupIdentifier)(struct CLIDebuggerSystem*, const char* name, struct CLIDebugVector* dv);
42
43 struct CLIDebuggerCommandSummary* commands;
44 const char* name;
45};
46
47struct CLIDebugger {
48 struct ARMDebugger d;
49
50 struct CLIDebuggerSystem* system;
51
52 EditLine* elstate;
53 History* histate;
54};
55
56struct CLIDebugVector* CLIDVParse(struct CLIDebugger* debugger, const char* string, size_t length);
57struct CLIDebugVector* CLIDVStringParse(struct CLIDebugger* debugger, const char* string, size_t length);
58
59void CLIDebuggerCreate(struct CLIDebugger*);
60void CLIDebuggerAttachSystem(struct CLIDebugger*, struct CLIDebuggerSystem*);
61
62#endif