JuliaLang/julia

Why do StackFrame comparisons and hash ignore linfo?

Open

#47.028 aperta il 3 ott 2022

Vedi su GitHub
 (0 commenti) (2 reazioni) (0 assegnatari)Julia (5773 fork)batch import
bugequalityhelp wanted

Metriche repository

Star
 (48.709 star)
Metriche merge PR
 (Merge medio 20g 6h) (157 PR mergiate in 30 g)

Descrizione

We were seeing bugs in PProf's conversion from stack traces (Vector{StackFrame}) to PProf protos, and we eventually tracked the issue down to this:

Aha! It turns out it's because comparing StackFrames apparently skips the linfo and pointer, even though apparently also sometimes a StackFrame can be empty other than the linfo and pointer!!! 😮 https://github.com/JuliaLang/julia/blob/00646634c6a73998eaae3785eb78fea881c39502/base/stacktraces.jl#L80-L96

And indeed, in this case:

julia> fr1.func, fr1.line, fr1.file, fr1.inlined
(Symbol(""), -1, Symbol(""), false)

julia> fr3.func, fr3.line, fr3.file, fr3.inlined
(Symbol(""), -1, Symbol(""), false)

(I'm not sure why that stuff is all missing!?)

Originally posted by @NHDaly in https://github.com/JuliaPerf/PProf.jl/issues/69#issuecomment-1264461763

So, two questions, I guess:

  1. Do you know why it's possible for all the other fields of a StackTrace to be not present, even when it's not inlined?
  2. Given that the above is possible, why do we ignore the linfo for the hash and == comparisons? Is it a perf optimization?
    • and follow-up: what about the .pointer field?

thanks!

Guida contributor