`Core.DebugInfo`: expand C API, mostly to handle byte-precise information (#61817)
This change adds a basic C API for reading `jl_debuginfo_t`, both in its current form and with byte-precise provenance to be generated by JuliaLowering. ``` (debuginfo, pc) -> (firstbyte, lastbyte) (debuginfo, byte) -> (line, column) (debuginfo, pc) -> (firstline, firstcolumn) debuginfo -> first_line_of_entire_codeinfo ``` Note that the byte-precise provenance is not yet produced (and I've marked those branches unreachable). I'm making this change first so I can use them to try and resolve issues in #61699 and #53925. (Namely, I'm going to try and compute inlined frames from julia debuginfo rather than DWARF.) ## Implementation of byte-precise info storage The API shouldn't depend on how we do this, but I'll describe it here for reference. The simplicity of our current `Core.DebugInfo` (ref. #52415) is thanks to simple line numbers looking the same as indices into the next debuginfo, so they can be stored in the same way. Unfortunately, byte-precise information breaks this: from an index, we want to be able to know two byte positions, what lines they fall on, and how far from the beginning of those lines they are. I intend to store this info by putting a string in `linetable` like we do for `di.codelocs`. The compression format is described in julia.h, but only a couple points are relevant here: - Like `di.codelocs` today, I made a reasonable attempt to compress it (so we don't blow up the sysimg) without trying to be too clever. - Position lookup for a single IR statement can still be done without decompressing everything. I've already implemented the compression/decompression code (in JuliaLowering), but it's not part of this PR. This format might be torn out when we start trying to store AST provenance. --------- Co-authored-by: Cody Tapscott <topolarity@tapscott.me>
E
Em Chu committed
70059dde5a0a0fd95e4c8c611398d932e461a375
Parent: afd703e
Committed by GitHub <noreply@github.com>
on 5/21/2026, 5:23:43 PM