Skip to content

Commit

Permalink
debuginfo: store location of loop boundary (JuliaLang#41857)
Browse files Browse the repository at this point in the history
Since lowering always inserts gotos and other instructions after loop
bodies, this allows debuggers to give a more useful location for these
instructions.

fixes JuliaDebug/JuliaInterpreter.jl#485
  • Loading branch information
simeonschaub authored Aug 25, 2021
1 parent 6b5bc3b commit a11de31
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/julia-parser.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1376,14 +1376,14 @@
(if (eq? word 'quote)
(list 'quote blk)
blk))))
((while) (begin0 (list 'while (parse-cond s) (parse-block s))
((while) (begin0 (list 'while (parse-cond s) (append (parse-block s) (list (line-number-node s))))
(expect-end s word)))
((for)
(let* ((ranges (parse-comma-separated-iters s))
(body (parse-block s)))
(expect-end s word)
`(for ,(if (length= ranges 1) (car ranges) (cons 'block ranges))
,body)))
,(append body (list (line-number-node s))))))

((let)
(let ((binds (if (memv (peek-token s) '(#\newline #\;))
Expand Down
3 changes: 3 additions & 0 deletions stdlib/Distributed/src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ macro distributed(args...)
var = loop.args[1].args[1]
r = loop.args[1].args[2]
body = loop.args[2]
if Meta.isexpr(body, :block) && body.args[end] isa LineNumberNode
resize!(body.args, length(body.args) - 1)
end
if na==1
syncvar = esc(Base.sync_varname)
return quote
Expand Down
3 changes: 2 additions & 1 deletion test/testhelpers/coverage_file.info
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ DA:4,1
DA:5,0
DA:7,1
DA:8,1
DA:9,5
DA:9,3
DA:10,5
DA:11,1
DA:12,1
DA:14,0
Expand Down
7 changes: 4 additions & 3 deletions test/testhelpers/coverage_file.info.bad
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ DA:4,1
DA:5,0
DA:7,1
DA:8,1
DA:9,5
DA:9,3
DA:10,5
DA:11,1
DA:12,1
DA:14,0
Expand All @@ -14,6 +15,6 @@ DA:19,1
DA:20,1
DA:22,1
DA:1234,0
LH:11
LF:15
LH:12
LF:16
end_of_record

0 comments on commit a11de31

Please sign in to comment.