Set_trace_func


(Larry D'Anna) #1

Where can I find documentation on this function? It doesn’t appear to
be in the reference. Thanks

--larry

(Dave Thomas) #2

“Larry D’Anna” smoof-ra@elder-gods.org writes:

Where can I find documentation on this function? It doesn’t appear to
be in the reference. Thanks

http://www.rubycentral.com/book/ref_m_kernel.html#Kernel.set_trace_func


(Lyle Johnson) #3

Larry D’Anna wrote:

Where can I find documentation on this function? It doesn’t appear to
be in the reference. Thanks

–larry

http://www.rubycentral.com/book/ref_m_kernel.html#Kernel.set_trace_func


(Larry D'Anna) #4

Larry D’Anna wrote:

Where can I find documentation on this function? It doesn’t appear to
be in the reference. Thanks

–larry

http://www.rubycentral.com/book/ref_m_kernel.html#Kernel.set_trace_func

Thanks.

An excerpt from debug.rb, inside a trace_func, switching on the event:

when ‘call’
@frames.unshift [binding, file, line, id]
if check_break_points(file, id.id2name, binding, id) or
check_break_points(klass.to_s, id.id2name, binding, id)
suspend_all
debug_command(file, line, id, binding)
end

when 'c-call’
frame_set_pos(file, line)

So when your program executes a normal method call the debugger makes a
record of a new stack frame, but if it executes a method call to a c
function then it resets it’s idea of where you are in the current
frame. This results in you not being able to skip over a require
unless the require loads a .so instead of a .rb.

For some reason setting a breakpoint later in the program isn’t
working for me either.

--larry