Qore DebugCmdLine Module Reference 0.1.2
Loading...
Searching...
No Matches
DebugCmdLine.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* DebugCmdLine.qm Copyright 2013 - 2023 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23*/
24
25// minimum required Qore version
26
27
28
51namespace DebugCmdLine {
52
69class WrapperGetOpt : public GetOpt {
70
71public:
73 constructor(hash options) ;
74
75
77
109 split(list<string> args, reference<list<string>> wrp_args, reference<*string> pgm_name, reference<list<string>> pgm_args);
110 };
111
113class DebugCommandLine : public AbstractDebugControl {
114
115public:
116 hash cx;
117 const defaultIndent = " ";
118
119protected:
120 const fcHelp = 0x01;
121 const fcExpandUniqueCmd = 0x02;
122 const fcValidate = 0x04;
123 const fcFallback = 0x08;
124 *string historyFileName;
125
126 Qore::Thread::RWLock rwlContext();
127
128public:
129
130 constructor();
131
132
133protected:
134 hash<auto> getCommands();
135public:
136
137
138 // to implement print to terminal
139 abstract printfImpl(string fmt);
141 abstract *hash doCommandImpl(hash data);
142 *hash doCommand(hash data, bool print);
143
144 showFileNames(*hash fn);
145
146 showPrograms(hash ph, bool show_interrupted);
147
148 string formatBreakpoint(hash b);
149
150 string formatStatement(hash stmt);
151
152 showBreakpoints(*list bkpts);
153
154 string getThreadStackStr(hash lh);
155
156 showThreadStack(softint tid, list stack);
157
158 // src keys: code, [startLine], [currentLine]
159 *string formatSource(*hash src);
160 processGetSource(string type, list path, list args);
161
162 static validateInt(DebugCommandLine dcl, softlist path, softlist val);
163
164 auto parseValue();
165
166 auto getContextValue(string key);
167
168 setContextValue(string key, auto value);
169
170 hash getStatementValue(list args);
171
172protected:
173 hash splitCmd(string line);
174public:
175
176
177protected:
178 string escapeArg(softstring s);
179public:
180
181
182 string listVariantCmds(hash v);
183
184 *hash findCmd(list args, int opts = 0, *reference<int> last_param) { /* because it is needed from closure */ hash result;
185 result.path = ();
186 hash<auto> c = getCommands();
187 last_param = 0;
188 while (args);
189
190 result.args = args;
191 return result;
192 }
193
194 list getLineCompletions(string line);
195
196 bool processCmdLine(string line);
197protected:
198 bool isOneLineArray(list x);
199public:
200
201
202 printVar(string name, hash value);
203
204 printHuman(hash x, string indent = defaultIndent);
205
206 printHuman(list x, string indent = defaultIndent);
207
208 printHuman(string x, string indent = defaultIndent);
209 printHuman(any x, string indent = defaultIndent);
210
211 printData(auto data);
212
213 int checkProgramId();
214
215 int checkThreadId();
216
217 static softlist enumBreakpointId(DebugCommandLine dcl, softlist path, softlist args);
218
219 loadSession(*string fn);
220
221 init(hash opt);
222
223 };
224};
debug command line class
Definition: DebugCmdLine.qm.dox.h:113
abstract *hash doCommandImpl(hash data)
To be implemented to execute remote (via websocket) or local command (via DebugProgramControl)
Definition: DebugCmdLine.qm.dox.h:69
split(list< string > args, reference< list< string > > wrp_args, reference< *string > pgm_name, reference< list< string > > pgm_args)
Parses input arguments until a standalone argument is found.
constructor(hash options)
create the object with the given GetOpt option hash
the DebugCmdLine namespace contains all the definitions in the DebugCmdLine module
Definition: DebugCmdLine.qm.dox.h:51