all repos — mgba @ f836a67863e66499c812c8d963d37ff56ad10638

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