Skip to content

Conversation

@dalehamel
Copy link
Member

@dalehamel dalehamel commented Nov 3, 2025

Ruby's backtrace code gets the line number directly from the cfp->iseq reference:

https://github.com/ruby/ruby/blob/52a17bbe6d778d56cc600f73f107c1992350f877/vm_backtrace.c#L1763-L1767

This updates the logic to do the same, rather than use the same iseq we are getting the labels from (the "CME" iseq).

In order to do this though, we need BOTH the CME iseq (for labels), and the "plain" iseq from cfp->iseq (for the line number). Most of the code here pertains to ferrying an additional address through to userspace by putting it into the 6 bytes of padding on the Frame struct, which is probably more controversial than anything else.

@dalehamel dalehamel force-pushed the fix-leaf-lineno branch 4 times, most recently from 539b987 to 9c0f0f6 Compare November 3, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant