MCPcopy Index your code
hub / github.com/processing/processing / startDebug

Method startDebug

java/src/processing/mode/java/Debugger.java:163–222  ·  view source on GitHub ↗

Start a debugging session. Builds the sketch and launches a VM to run it. VM starts suspended. Should produce a VMStartEvent.

()

Source from the content-addressed store, hash-verified

161 * VM starts suspended. Should produce a VMStartEvent.
162 */
163 public synchronized void startDebug() {
164 //stopDebug(); // stop any running sessions
165 if (isStarted()) {
166 return; // do nothing
167 }
168
169 // we are busy now
170 editor.statusBusy();
171
172 // clear console
173 editor.clearConsole();
174
175 // clear variable inspector (also resets expanded states)
176 editor.variableInspector().reset();
177
178 // load edits into sketch obj, etc...
179 editor.prepareRun();
180
181 // after prepareRun, since this removes highlights
182 editor.activateDebug();
183
184 try {
185 Sketch sketch = editor.getSketch();
186 JavaBuild build = new JavaBuild(sketch);
187
188 log("building sketch: " + sketch.getName());
189 //LineMapping.addLineNumbers(sketch); // annotate
190// mainClassName = build.build(false);
191 mainClassName = build.build(true);
192 //LineMapping.removeLineNumbers(sketch); // annotate
193 log("class: " + mainClassName);
194
195 // folder with assembled/preprocessed src
196 srcPath = build.getSrcFolder().getPath();
197 log("build src: " + srcPath);
198 // folder with compiled code (.class files)
199 log("build bin: " + build.getBinFolder().getPath());
200
201 if (mainClassName != null) {
202 // generate the source line mapping
203 //lineMap = LineMapping.generateMapping(srcPath + File.separator + mainClassName + ".java");
204
205 log("launching debuggee runtime");
206 runtime = new Runner(build, new RunnerListenerEdtAdapter(editor));
207 VirtualMachine vm = runtime.debug(null); // non-blocking
208 if (vm == null) {
209 loge("error 37: launch failed", null);
210 }
211
212 // start receiving vm events
213 VMEventReader eventThread = new VMEventReader(vm.eventQueue(), vmEventListener);
214 eventThread.start();
215
216 startTrackingLineChanges();
217 editor.statusBusy();
218 }
219 } catch (Exception e) {
220 editor.statusError(e);

Callers 2

continueDebugMethod · 0.95
stepMethod · 0.95

Calls 15

isStartedMethod · 0.95
logMethod · 0.95
getNameMethod · 0.95
buildMethod · 0.95
getSrcFolderMethod · 0.95
getBinFolderMethod · 0.95
logeMethod · 0.95
statusBusyMethod · 0.80
clearConsoleMethod · 0.80
variableInspectorMethod · 0.80
activateDebugMethod · 0.80

Tested by

no test coverage detected