JuliaLang/julia

Why do StackFrame comparisons and hash ignore linfo?

Open

#47.028 geöffnet am 3. Okt. 2022

Auf GitHub ansehen
 (0 Kommentare) (2 Reaktionen) (0 zugewiesene Personen)Julia (5.773 Forks)batch import
bugequalityhelp wanted

Repository-Metriken

Stars
 (48.709 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 20T 6h) (157 gemergte PRs in 30 T)

Beschreibung

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!

Contributor Guide