-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCommand.h
136 lines (109 loc) · 2.66 KB
/
Command.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
Copyright (C) 2011 RVRS Industriis <http://rvrs.in>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COMMAND_20110828_H_
#define COMMAND_20110828_H_
#include <QString>
#include <QStringList>
#include <QList>
#include <QMap>
#include "Debugger.h"
class Command
{
public:
Command(const QString& command, const QStringList& arguments);
bool isValid() const { return valid_; }
bool execute();
QString error() const { return error_; }
QString name() const { return command_; }
QString description() const { return descriptions[command_]; }
QStringList arghelp() const { return help[command_]; }
static QStringList commands() { return functions.keys(); }
private:
void initFunctions();
void initDescriptions();
void initHelp();
bool argCheck(int min, int max);
DebuggerCoreInterface* getDebuggerCoreChecked(bool checkRunning = true);
/*
* TODO:
*
* BP+ (BPX?) instead of BP
* BP- (BPR?)(* for all)
* BPD disable
* BP(toggle)
* HWBP ...
*
* RUN [address]
* STEP(STEPI) [times]
* STEPO [times]
* BREAK
*
* KILL
* DETACH
* ATTACH pid
* OPEN path
* RESTART (target)
*
* QUIT (edb)
*
* G (go to)
*
* REG register [, value]
* PUSH val
* POP
*
* PROT address [, protection : rwx/---]
*
* DUMP address, file
* LOAD address, file
* COPY dest, src, size
* FILL dest, data, size
* FIND mem, data [, size]
* //ALLOC
**/
bool cmd_AN();
bool cmd_BP();
bool cmd_GOTO();
bool cmd_PAUSE();
bool cmd_RUN();
bool cmd_STEP();
bool cmd_STEPO();
bool cmd_REG();
bool cmd_PUSH();
bool cmd_POP();
bool cmd_PROT();
bool cmd_FIND();
bool cmd_COPY();
bool cmd_FILL();
bool cmd_DUMP();
bool cmd_LOAD();
bool cmd_KILL();
bool cmd_DETACH();
bool cmd_ATTACH();
bool cmd_OPEN();
bool cmd_RESTART();
bool cmd_QUIT();
private:
typedef bool (Command::*fCommand)();
// make sure static maps are initialized
static const Command dummy;
static QMap<QString, fCommand> functions;
static QMap<QString, QString> descriptions;
static QMap<QString, QStringList> help;
QString command_;
QStringList arguments_;
bool valid_;
QString error_;
};
#endif