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
143 abstract *hash doCommandImpl(hash data);
144 *hash doCommand(hash data, bool print);
145
146 showFileNames(*hash<auto> fn);
147
148 showPrograms(hash ph, bool show_interrupted);
149
150 string formatBreakpoint(hash b);
151
152 string formatStatement(hash stmt);
153
154 showBreakpoints(*list bkpts);
155
156 string getThreadStackStr(hash lh);
157
158 showThreadStack(softint tid, list stack);
159
160 // src keys: code, [startLine], [currentLine]
161 *string formatSource(*hash src);
162 processGetSource(string type, list path, list args);
163
164 static validateInt(DebugCommandLine dcl, softlist path, softlist val);
165
166 auto parseValue();
167
168 auto getContextValue(string key);
169
170 setContextValue(string key, auto value);
171
172 hash getStatementValue(list args);
173
174protected:
175 hash splitCmd(string line);
176public:
177
178
179protected:
180 string escapeArg(softstring s);
181public:
182
183
184 string listVariantCmds(hash v);
185
186 *hash findCmd(list args, int opts = 0, *reference<int> last_param) { /* because it is needed from closure */ hash result;
187 result.path = ();
188 hash<auto> c = getCommands();
189 last_param = 0;
190 while (args);
191
192 result.args = args;
193 return result;
194 }
195
196 list getLineCompletions(string line);
197
198 bool processCmdLine(string line);
199protected:
200 bool isOneLineArray(list x);
201public:
202
203
204 printVar(string name, hash value);
205
206 printHuman(hash x, string indent = defaultIndent);
207
208 printHuman(list x, string indent = defaultIndent);
209
210 printHuman(string x, string indent = defaultIndent);
211 printHuman(any x, string indent = defaultIndent);
212
213 printData(auto data);
214
215 int checkProgramId();
216
217 int checkThreadId();
218
219 static softlist enumBreakpointId(DebugCommandLine dcl, softlist path, softlist args);
220
221 loadSession(*string fn);
222
223 init(hash opt);
224
225 };
226};
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.
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