all repos — mgba @ 886c045a11e7ebaff01bb159e5c99a48d0200e80

mGBA Game Boy Advance Emulator

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