diff --git a/lib/diver_down/trace/session.rb b/lib/diver_down/trace/session.rb index c73c2a1..a3b1291 100644 --- a/lib/diver_down/trace/session.rb +++ b/lib/diver_down/trace/session.rb @@ -38,13 +38,15 @@ def stop private def build_trace_point - call_stack = DiverDown::Trace::CallStack.new + call_stacks = {} TracePoint.new(*DiverDown::Trace::Tracer.trace_events) do |tp| # Skip the trace of the library itself next if tp.path&.start_with?(DiverDown::LIB_DIR) next if TracePoint == tp.defined_class + call_stack = call_stacks[Thread.current] ||= DiverDown::Trace::CallStack.new + case tp.event when :b_call call_stack.push