Repository navigation
Fire compiled :line events every time with a :line-only TracePoint - #10101
Open
sampokuokkanen wants to merge 2 commits into
Open
sampokuokkanen wants to merge 2 commits into
sampokuokkanen wants to merge 2 commits into
Conversation
With --debug, a TracePoint listening only to :line fired once per line in compiled code, such as the main script, which is compiled when it is loaded, and anything the JIT compiled. A loop body or a method that ran again fired no more :line events, so debuggers missed breakpoints. A compiled trace point runs through a call site of the trace event manager after its first run. :call, :class, :end and :line share one site, but the manager only enabled it for hooks that listen to :call or :return. The block sites had the same problem, enabled only by :b_call or :b_return together. Each site is now enabled for the events that use it, and all are disabled when the last hook goes away.
The spec was tagged as failing in a bulk tag run made without --debug, where TracePoint does not see line events. It was already tagged debug, which keeps it out of those runs, and it passes in spec:ruby:debug and spec:ruby:debug:jit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
--debug, a TracePoint that listens only to:linefires once per line in compiled code. That includes the main script, which is compiled when it is loaded even with the JIT disabled, and anything the JIT has compiled. A loop body, or a method that runs again, fires no more:lineevents. Debuggers built on TracePoint, like ruby/debug, miss breakpoints in loops because of this (ruby/debug#1120).After its first run, a compiled trace point goes through one of four call sites in
TraceEventManager.:call,:class,:endand:lineshare one, but it was only turned on for hooks that listen to:callor:return.:b_calland:b_returnturned on both block sites together. Each site is now turned on for the events that use it, followingJVMVisitor#TraceInstr, and all of them are turned off when the last hook is removed.:classand:endwere affected too. This isn't specced, because code loaded by mspec isn't compiled like a main script.A second commit removes a
fails:tag onTracePoint#lineno returns the line number of the event. A bulk tag run without--debughad added it, and the spec passes in both debug jobs.