Project

General

Profile

Bug #15634

TracePoint seems to be skipping some methods.

Added by ioquatix (Samuel Williams) 15 days ago. Updated 14 days ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:91659]

Description

trace_point = TracePoint.new(:call, :return, :line, :c_call, :c_return, :b_call, :b_return) do |trace|
    puts [trace.path, trace.lineno].join(":")
end

trace_point.enable

values = {foo: 10}

def shell_escape(x)
    x
end

values.map{|key, value| [
    key.to_s.upcase,
    shell_escape(value) # TracePoint is never triggered for this line.
]}

History

Updated by ioquatix (Samuel Williams) 14 days ago

Here is more elaborate example:

#!/usr/bin/env ruby

trace_point = TracePoint.new(:call, :return, :line, :c_call, :c_return, :b_call, :b_return) do |trace|
    puts [trace.path, trace.lineno].join(":")
end

trace_point.enable

values = {foo: 10}

def shell_escape(x)
    x
end

values.map{|key, value| [
    key.to_s.upcase,
    shell_escape(value) # TracePoint is never triggered for this line.
]}

Here is output:

<internal:prelude>:137
<internal:prelude>:138
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:9
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:11
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:11
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:11
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:15
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:15
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:15
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:15
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:16
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:16
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:16
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:16
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:16
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:11
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:12
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:13
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:18
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:15
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/8efd0295-4252-4947-a870-2c636bf2e120:15

Line 17 (the one marked by comment) is never executed.

Also available in: Atom PDF