From: liran.last@... Date: 2020-11-02T07:58:28+00:00 Subject: [ruby-core:100688] [Ruby master Bug#17302] The TracePoint API does not allow setting multiple line traces within the same method (ISEQ) Issue #17302 has been updated by liran.last@gmail.com (Liran Haimovitch). liran.last@gmail.com (Liran Haimovitch) wrote in #note-1: > liran.last@gmail.com (Liran Haimovitch) wrote: > > When setting a second line tracepoint within a method the first one will be turned off. > > > > I believe this is due to the fact that the encoded_iseq_trace_instrument function resets the trace value of an instruction rather then just turn it on if needed - https://github.com/ruby/ruby/blob/799253dc46e96518687dcd4fdca42582251ccffe/iseq.c#L3178 > > > > And it is unconditionally called, not limited to the correct line: https://github.com/ruby/ruby/blob/799253dc46e96518687dcd4fdca42582251ccffe/iseq.c#L3219 > > Attaching a short file to reproduce the bug, based on the existing `enable_spec.rb` in the Ruby repo. After some additional investigation, it seems that when adding multiple breakpoints to the same method (ISEQ) only the last one will apply. BUT, if I disable even one of them, all the breakpoints that are left enabled will work simultaneously. ---------------------------------------- Bug #17302: The TracePoint API does not allow setting multiple line traces within the same method (ISEQ) https://bugs.ruby-lang.org/issues/17302#change-88329 * Author: liran.last@gmail.com (Liran Haimovitch) * Status: Open * Priority: Normal * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- When setting a second line tracepoint within a method the first one will be turned off. I believe this is due to the fact that the encoded_iseq_trace_instrument function resets the trace value of an instruction rather then just turn it on if needed - https://github.com/ruby/ruby/blob/799253dc46e96518687dcd4fdca42582251ccffe/iseq.c#L3178 And it is unconditionally called, not limited to the correct line: https://github.com/ruby/ruby/blob/799253dc46e96518687dcd4fdca42582251ccffe/iseq.c#L3219 ---Files-------------------------------- my_test.rb (790 Bytes) -- https://bugs.ruby-lang.org/ Unsubscribe: