Skip to content
  • Peter Zhu's avatar
    2fe6a4f8
    Fix assertion error when TracePoint has incompatible events · 2fe6a4f8
    Peter Zhu authored
    TracePoints with incompatible events (i.e. events not in ISEQ_TRACE_EVENTS)
    with a method target will fail an assertion error because it does not
    filter for the supported events. For example, the following lines will
    cause an assertion error:
    
        def foo; end
        # No arguments passed into TracePoint.new enables all ISEQ_TRACE_EVENTS
        TracePoint.new {}.enable(target: method(:foo))
        # Raise is not supported with a target
        TracePoint.new(:raise, :return) {}.enable(target: method(:foo))
        foo
    
    Crashes with:
    
        Assertion Failed: vm_insnhelper.c:7026:vm_trace:(iseq_local_events & ~(0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010| 0x0020| 0x0040 | 0x0100 | 0x0200 | 0x4000 | 0x010000| 0x020000)) == 0
    2fe6a4f8
    Fix assertion error when TracePoint has incompatible events
    Peter Zhu authored
    TracePoints with incompatible events (i.e. events not in ISEQ_TRACE_EVENTS)
    with a method target will fail an assertion error because it does not
    filter for the supported events. For example, the following lines will
    cause an assertion error:
    
        def foo; end
        # No arguments passed into TracePoint.new enables all ISEQ_TRACE_EVENTS
        TracePoint.new {}.enable(target: method(:foo))
        # Raise is not supported with a target
        TracePoint.new(:raise, :return) {}.enable(target: method(:foo))
        foo
    
    Crashes with:
    
        Assertion Failed: vm_insnhelper.c:7026:vm_trace:(iseq_local_events & ~(0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010| 0x0020| 0x0040 | 0x0100 | 0x0200 | 0x4000 | 0x010000| 0x020000)) == 0
Loading