-
Notifications
You must be signed in to change notification settings - Fork 447
Description
gnovm debugger: a breakpoint may be ignored on a multiple statements line
Description
Gnovm debugger breakpoints are not always working correctly for single line
blocks containing multiple statements.
Steps to reproduce
Consider a target program with a line containing mutiple statements, such as:
9: x := 0
10: for { x++; println(x) }
11:
Under gnovm debugger, a command break 10 should make the program stop at
each iteration of the for loop. It will stop only once instead. The second
time we continue, the program will run forever.
Workaround
Transform the single line block in a multi-line block:
10: for { x++; println(i) }
rewritten to:
10: for {
11: x++
12: println(i)
13: }
Then breakpoints line 11 or 12 will work correctly and stop at each iteration.
Proposed solution
The cause of the issue is the lack of accuracy of code location in the state of the GnoVM. Only the file name and line number are considered. There is no way to distinguish multiple statements on the same line.
The solution is make the code location more precise, by using for example also the column number, which can be obtained from the token.Position.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status