You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A breakpoint is defined by a fully-qualified class name and a source line.
259
+
260
+
All breakpoints of a debug scenario are configured before the program starts.
261
+
262
+
When the program pauses on a breakpoint, we check the class name and source line of the current frame.
263
+
264
+
### Step in
265
+
266
+
Syntax:
267
+
```
268
+
step ${expected line number or method name}
269
+
```
270
+
271
+
Examples:
272
+
```
273
+
step 10
274
+
step println
275
+
```
276
+
277
+
A `step` request expects the program to enter into the called method or go to the next instruction.
278
+
After a step request, we check that the source line (or method name) of the current frame matches the expected one.
279
+
280
+
Typically we use a source line when we stay in the same source file and a method name when we step in a library or JDK class.
281
+
282
+
### Next
283
+
284
+
A `next` request behaves similarly to `step` but jumps over a method call and stops on the next instruction.
285
+
286
+
Syntax:
287
+
```
288
+
next ${expected line number or method name}
289
+
```
290
+
291
+
Examples:
292
+
```
293
+
next 10
294
+
next println
295
+
```
296
+
297
+
### Evaluation
298
+
299
+
Syntax:
300
+
```
301
+
eval ${expression}
302
+
result ${expected output}
303
+
304
+
// or in case an error is expected
305
+
eval ${expression}
306
+
error ${expected message}
307
+
```
308
+
309
+
It also supports multi-line expressions and multi-line error messages.
310
+
311
+
Examples:
312
+
```
313
+
eval finobacci(2)
314
+
result 55
315
+
316
+
eval
317
+
def square(x: Int): Int =
318
+
x * x
319
+
square(2)
320
+
result 4
321
+
322
+
eval foo
323
+
error
324
+
<expression>:1:0
325
+
1 |foo
326
+
|^^^
327
+
| Not found: foo
328
+
```
329
+
330
+
An `eval` request verifies that an expression can be evaluated by the `ExpressionCompiler` during a debugging session.
331
+
A `result` assertion checks the evaluation produced the expected output, while an `error` assertion checks the compilation failed with the expected error message.
332
+
333
+
When the evaluation throws an exception, the exception is returned as a result, not an error.
334
+
335
+
```
336
+
eval throw new Exception("foo")
337
+
result java.lang.Exception: foo
338
+
```
339
+
208
340
## Unit Tests
209
341
210
342
Unit tests cover the other areas of the compiler, such as interactions with the REPL, scripting tools and more.
0 commit comments