stacktrace: Enable method signature printing for inlined frames (#53925)
This is an attempt to revive #41099 using the newly added invert
linetable format (#52415).
It's a work in progress, but I've opened this PR to spark a discussion
on whether I'm moving in the right direction with this approach.
Currently, I've tweaked `jl_lookup_code_address` to give back a
`CodeInstance` containing `debuginfo` rather than the `MethodInstance`
for the outermost frame. This info is then used to find the
`MethodInstance` for inlined inner frames from the Julia side.
```julia
julia> function f1(a)
x = a
return begin
@inline f2(x)
end
end;
julia> function f2(a)
x = a
return @inline sin(x)
end;
julia> f1(Inf)
ERROR: DomainError with Inf:
sin(x) is only defined for finite x.
Stacktrace:
```
```diff
diff --git a/old b/new
index f913ab20c3..215037aa56 100644
--- a/old
+++ b/new
@@ -1,10 +1,10 @@
[1] sin_domain_error(x::Float64)
@ Base.Math ./special/trig.jl:28
- [2] sin
- @ ./special/trig.jl:39 [inlined]
- [3] f2
- @ ./REPL[2]:3 [inlined]
+ [2] sin(x::Float64)
+ @ Base.Math ./special/trig.jl:39 [inlined]
+ [3] f2(a::Float64)
+ @ Main ./REPL[2]:3 [inlined]
[4] f1(a::Float64)
@ Main ./REPL[1]:4
[5] top-level scope
@ REPL[3]:1
```
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> S
Shuhei Kadowaki committed
3979856261387b8a4a4db4ba5447dcda3c45413a
Parent: fd447be
Committed by GitHub <noreply@github.com>
on 4/17/2026, 7:15:34 PM