Skip to content

Instantly share code, notes, and snippets.

@jahfer
Last active Mar 2, 2017
Embed
What would you like to do?
# frozen_string_literal: true
class FixtureInner
def do_work
raise unless sum == 2
end
def sum
1 + 1
end
end
# frozen_string_literal: true
class FixtureOuter
def initialize
@inner = FixtureInner.new
end
def do_work
@inner.do_work
end
end
event entity method_name method_level line_event_filepath line_event_lineno tracepoint_filepath tracepoint_lineno caller_locations backtrace
c_call FixtureOuter new singleton rotoscope_test.rb 91 rotoscope_test.rb 91 /Users/jahfer/src/github.com/Shopify/rotoscope/lib/rotoscope.rb:7:in `block in trace'
call FixtureOuter initialize instance rotoscope_test.rb 91 fixture_outer.rb 3 rotoscope_test.rb:91:in `block in test_ignores_calls_if_blacklisted'
c_call FixtureInner new singleton fixture_outer.rb 4 fixture_outer.rb 4 rotoscope_test.rb:91:in `new'
c_call FixtureInner initialize instance fixture_outer.rb 4 fixture_outer.rb 4 fixture_outer.rb:4:in `initialize'
c_return FixtureInner initialize instance fixture_outer.rb 4 fixture_outer.rb 4 fixture_outer.rb:4:in `initialize'
c_return FixtureInner new singleton fixture_outer.rb 4 fixture_outer.rb 4 rotoscope_test.rb:91:in `new'
return FixtureOuter initialize instance fixture_outer.rb 4 fixture_outer.rb 5 rotoscope_test.rb:91:in `block in test_ignores_calls_if_blacklisted'
c_return FixtureOuter new singleton rotoscope_test.rb 91 rotoscope_test.rb 91 /Users/jahfer/src/github.com/Shopify/rotoscope/lib/rotoscope.rb:7:in `block in trace'
call FixtureOuter do_work instance rotoscope_test.rb 92 fixture_outer.rb 7 /Users/jahfer/src/github.com/Shopify/rotoscope/lib/rotoscope.rb:7:in `block in trace'
call FixtureInner do_work instance fixture_outer.rb 8 fixture_inner.rb 3 rotoscope_test.rb:92:in `block in test_ignores_calls_if_blacklisted'
call FixtureInner sum instance fixture_inner.rb 4 fixture_inner.rb 7 fixture_outer.rb:8:in `do_work'
return FixtureInner sum instance fixture_inner.rb 8 fixture_inner.rb 9 fixture_outer.rb:8:in `do_work'
return FixtureInner do_work instance fixture_inner.rb 8 fixture_inner.rb 5 rotoscope_test.rb:92:in `block in test_ignores_calls_if_blacklisted'
return FixtureOuter do_work instance fixture_inner.rb 8 fixture_outer.rb 9 /Users/jahfer/src/github.com/Shopify/rotoscope/lib/rotoscope.rb:7:in `block in trace'
def test_ignores_calls_if_blacklisted
contents = rotoscope_trace do
foo = FixtureOuter.new # line 91
foo.do_work # line 92
end
end
def rotoscope_trace(blacklist = [], &block)
Rotoscope.trace(@logfile, blacklist, &block)
unzip(@logfile)
end
@jahfer

This comment has been minimized.

Copy link
Owner Author

@jahfer jahfer commented Mar 2, 2017

screen shot 2017-02-14 at 4 28 33 pm

  • "Last :line event" refers to keeping the most recent :line tracepoint location around so it can be used on invocations of :call and :return tracepoints
  • "Tracepoint" refers to using rb_tracearg_path
  • "Backtrace(1,2)" indicates using caller_locations(0, 1) for c_call and caller_locations(1,1) for call. In the end, identical results are returned using caller_locations(1,1) for bothc_call and call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment