Open yxhuvud opened 2 years ago
Right... the reason is that blocks are inlined, so there isn't a call at all.
If there's a way to tell LLVM to fake a stack trace element, then I think we might be able to do it. Otherwise, I don't think so.
Well, that explains why row 2 from the ruby output (block in wat
) isn't there, but does it also explain why foo and bar doesn't show up at all?
Ah, right... yeah, I think the bug is that bar
doesn't show up. Backtraces have been working wrong since the beginning and they were never fixed. It's probably related to that.
foo
doesn't show up because the call is inlined.
If you change it to this, bar
appears 🤷
def wat
foo { huh }
end
def foo
yield
end
def bar
a = 1
raise "the bar"
end
def huh
bar
end
# wat
bar
But that is unrelated to this issue (it reads "Back traces involving blocks are missing information" but this bar
thing isn't related to blocks)
foo doesn't show up because the call is inlined.
Oh, it inlines the whole of foo
into wat
?, not just the block into foo. Well, that makes it harder I suppose.
but this bar thing isn't related to blocks
Ah. Perhaps I should submit a separate issue for just that?
Possibly related discussion on inlined methods: https://github.com/crystal-lang/crystal/issues/10661
Bug Report
Consider the following code:
This outputs:
Here we can note that neither
foo
norbar
are present in the stack trace.Compare to ruby output, which is more complete and helpful:
crystal -v
) and OS. If possible, try to see if the bug still reproduces on master. Crystal 1.3.2 [932f193ae] (2022-01-18)