tracer main class
- A
- O
- S
- T
stdout | = | STDOUT |
verbose | = | false |
display_process_id | = | false |
display_thread_id | = | true |
display_c_call | = | false |
EVENT_SYMBOL | = | { "line" => "-", "call" => ">", "return" => "<", "class" => "C", "end" => "E", "raise" => "^", "c-call" => "}", "c-return" => "{", "unknown" => "?" } |
Symbol table used for displaying trace information |
||
Single | = | new |
Reference to singleton instance of Tracer |
[RW] | display_c_call | display C-routine calls in trace output (defaults to false) |
[RW] | display_c_call? | display C-routine calls in trace output (defaults to false) |
[RW] | display_process_id | display process id in trace output (defaults to false) |
[RW] | display_process_id? | display process id in trace output (defaults to false) |
[RW] | display_thread_id | display thread id in trace output (defaults to true) |
[RW] | display_thread_id? | display thread id in trace output (defaults to true) |
[RW] | stdout | output stream used to output trace (defaults to STDOUT) |
[R] | stdout_mutex | mutex lock used by tracer for displaying trace output |
[RW] | verbose | display additional debug information (defaults to false) |
[RW] | verbose? | display additional debug information (defaults to false) |
Used to filter unwanted trace output
Example which only outputs lines of code executed within the Kernel class:
Tracer.add_filter do |event, file, line, id, binding, klass, *rest|
"Kernel" == klass.to_s
end
Disable tracing
Start tracing
Example
Tracer.on
# code to trace here
Tracer.off
You can also pass a block:
Tracer.on {
# trace everything in this block
}
Register an event handler p
which is called everytime a line
in file_name
is executed.
Example:
Tracer.set_get_line_procs("example.rb", lambda { |line|
puts "line number executed is #{line}"
})