JuliaDebug / JuliaInterpreter.jl

Interpreter for Julia code
Other
158 stars 33 forks source link

changes to adapt to compressed line table format #606

Closed vtjnash closed 3 months ago

vtjnash commented 6 months ago

This contains some of the updates needed to keep working with the optimized debuginfo format (https://github.com/JuliaLang/julia/pull/52415). This is a draft, since someone needs integrate this to maintain support for old versions, where the old code is mostly marked here with my initials (jwn) and my initials should be removed entirely and instead the implementation in those places fixed.

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 33.92857% with 37 lines in your changes are missing coverage. Please review.

Project coverage is 84.11%. Comparing base (31253a0) to head (ebc743a).

Files Patch % Lines
src/utils.jl 42.22% 26 Missing :warning:
src/interpret.jl 0.00% 10 Missing :warning:
src/types.jl 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #606 +/- ## ========================================== - Coverage 85.13% 84.11% -1.02% ========================================== Files 12 12 Lines 2610 2644 +34 ========================================== + Hits 2222 2224 +2 - Misses 388 420 +32 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

aviatesk commented 3 months ago

It looks like this "optimization" introduces a very bad interaction with the new lineinfo format: https://github.com/JuliaDebug/JuliaInterpreter.jl/blob/28dd37ce0f7bcb357bfb820b1d6b53b98aa3796c/src/optimize.jl#L76-L92

julia> using JuliaInterpreter

julia> fnone1() = nothing;

julia> let m = only(methods(fnone1))
           JuliaInterpreter.FrameCode(m, JuliaInterpreter.get_source(m); optimize=true).src.debuginfo
       end
Core.DebugInfo(Symbol("REPL[2]"), nothing, svec(), "\x01\0\0\0\0\0\0\0\0\0\0\0\x01\x01\0")

julia> fnone2() = nothing;

julia> let m = only(methods(fnone2))
           JuliaInterpreter.FrameCode(m, JuliaInterpreter.get_source(m); optimize=true).src.debuginfo
       end
Core.DebugInfo(Symbol("REPL[4]"), nothing, svec(), "")
aviatesk commented 3 months ago

This PR is obviously not finished yet, but I want to push ahead with it as is to avoid holding up progress on other packages in the ecosystem. We can tackle the specific issues that I've identified so far later on (likely when Jameson returns).