Qore VscDebugAdapter Module Reference 0.1
Loading...
Searching...
No Matches
VscDebugAdapter.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* VscDebugAdapter.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
63namespace VscDebugAdapter {
64
66class VscDebugLogger : public DebugLogger {
67
68public:
69private:
70 *string m_filename;
71 File m_file;
72 bool m_logging = True;
73
74public:
75 VscDebugAdapter debugAdapter;
76 constructor(*string filename, bool appendToLog);
77
78
79 destructor();
80
81
83
86 log2(int verbosity, string fmt, *list args);
87 };
88
89
91
95class VscDebugAdapter : public DebugCommandLine {
96
97public:
98private:
99 const START_LAUNCH = 1;
100 const START_ATTACH = 2;
101 const START_ATTACH_SUSPENDED = 3;
102
103 const DEBUGVAR_PREFIX = "$";
105 bool m_running = True;
106
109
112
114 Queue m_queue();
115
118
120 Sequence m_sequence(1);
121
123 Sequence m_source(1);
124
127
128
129public:
132
133 constructor();
134
135
137 *hash doCommand(hash data);
138
140 nothing pushEvent(any event);
141
143 printfImpl(string fmt);
144
147
149 execute(string cmd);
150
151private:
152 auto resolveValue(string name, *string val, hash strings, auto defVal);
153public:
154
155
157private:
158 processDebugEvent(hash event);
159public:
160
161
163private:
164 refuseInterrupt(hash event);
165public:
166
167
169private:
170 detach(hash event);
171public:
172
173
175private:
176 hash parseVscRequest(string msg);
177public:
178
179
181private:
182 sendVscMessage(hash msg);
183public:
184
185
187private:
188 sendVscEvent(string event, any payload);
189public:
190
191
192private:
193 string getLoadedSourceName(string file, *string source);
194public:
195
196
197private:
198 updateProgramCache(*hash response);
199public:
200
201
202private:
203 setThreadFrame(int threadId, int frameId);
204public:
205
206
207private:
208 auto getVariable(int threadId, int frameId, string name);
209public:
210
211
212private:
213 deleteBreakpoints(*hash bkpts);
214public:
215
216
217private:
218 list setBreakpoints(*list bkptRefs);
219public:
220
221
222private:
223 string printValue(auto value, *hash format);
224public:
225
226
227private:
228 auto vscParseValue(string val);
229public:
230
231
232private:
233 hash getModule(softint pgmId);
234public:
235
236
237private:
238 hash getSource(hash ls);
239public:
240
241
242 // get threads provided to vsc
243private:
244 list getThreads();
245public:
246
247
248protected:
249 hash<auto> getCommands();
250public:
251
252
253 // methods implementing commands "public" is needed bacause of hasCallableMethod()
254 hash vsc_initialize(hash args);
255
256 nothing vsc_launch(hash args);
257
258 nothing vsc_attach(hash args);
259
260 nothing vsc_configurationDone();
261
262 hash vsc_threads();
263
264 vsc_pause(hash args);
265
266 hash vsc_continue(hash args);
267
268 vsc_next(hash args);
269
270 vsc_stepIn(hash args);
271
272 vsc_stepOut(hash args);
273
274 hash vsc_stackTrace(hash args);
275
276 hash vsc_exceptionInfo(hash args);
277
278 hash vsc_scopes(hash args);
279
280 hash vsc_variables(hash args);
281
282 hash vsc_setVariable(hash args);
283
284 hash vsc_evaluate(hash args);
285
286 hash vsc_completions(hash args);
287
288 hash vsc_setBreakpoints(hash args);
289
290 hash vsc_setFunctionBreakpoints(hash args);
291
292 vsc_setExceptionBreakpoints(hash args);
293
294 hash vsc_modules(hash args);
295
296 hash vsc_loadedSources();
297
298 hash vsc_source(hash args);
299
300 vsc_disconnect(*hash args);
301
302private:
303 hash getCapabilities();
304public:
305
306
307 };
308
309};
*string defaultProgram
use program name unless not specified in launch/attach command
Definition: VscDebugAdapter.qm.dox.h:131
refuseInterrupt(hash event)
refuse interrupt and continue
run()
run processing loop till m_running is True
nothing pushEvent(any event)
push event from debug server in queue
detach(hash event)
detach interrupt
execute(string cmd)
execute command (and exit)
Sequence m_sequence(1)
Sequence for events passed to VSC frontend.
Queue m_queue()
queue if incomming events from debug server
*hash doCommand(hash data)
send command to debug server
sendVscEvent(string event, any payload)
send event for VSC frontend
hash parseVscRequest(string msg)
parse request from VSC frontend
printfImpl(string fmt)
implement printing to console
hash m_initializeArgs
initialize command arguments
Definition: VscDebugAdapter.qm.dox.h:108
processDebugEvent(hash event)
process event from debugger
int m_currentPgmId
vsc program
Definition: VscDebugAdapter.qm.dox.h:126
Sequence m_source(1)
Sequence for loaded source reference.
sendVscMessage(hash msg)
send message for VSC frontend
hash m_programState
program stat information
Definition: VscDebugAdapter.qm.dox.h:111
Queue m_outputQueue()
queue for VSC Output window
class that can be used for logging
Definition: VscDebugAdapter.qm.dox.h:66
log2(int verbosity, string fmt, *list args)
implements logging
the VscDebugAdapter namespace contains all the definitions in the VscDebugAdapter module
Definition: VscDebugAdapter.qm.dox.h:63