Module: RuntimeInspection
- Defined in:
- lib/rti/state.rb,
lib/rtinspect.rb,
lib/rti/thread.rb,
lib/rti/tracer.rb,
lib/rti/manager.rb,
lib/rti/redirect.rb
Defined Under Namespace
Classes: Portal, RTIManager, State, StopPoint, Thread, ThreadRedirect, Tracer
Constant Summary collapse
- OPTS =
This is the set of options managed by RTI. The output_marker is the value used to distinguish data sent to the client from within the command evaluation from the value returned from the evaluation.
{ :output_marker => '=>' }
- @@signal_rti =
The placeholder for an RTI thread started via on_signal.
nil
Class Method Summary collapse
-
.dbg_handler(&block) ⇒ Object
Optionally enable your own handling of debug output.
-
.exc_handler(&block) ⇒ Object
Optionally enable your own exception handler.
-
.on_signal(signal = 'USR1', *args) ⇒ Object
Used to have RTI register itself on or off when the given signal is trapped.
-
.show_trace=(val) ⇒ Object
Optionally enable display of any trace methods that are not seen as break or stop points.
Class Method Details
.dbg_handler(&block) ⇒ Object
Optionally enable your own handling of debug output. Default is to either suppress it or send it to $stdout if $DEBUG is enabled (only checked at class load time).
67 68 69 |
# File 'lib/rtinspect.rb', line 67 def self.dbg_handler( &block ) # :yields: msg OPTS[:dbg_handler] = block end |
.exc_handler(&block) ⇒ Object
Optionally enable your own exception handler. Default is to write the exception and backtrace out to $stderr.
82 83 84 |
# File 'lib/rtinspect.rb', line 82 def self.exc_handler( &block ) # :yields: msg, exc OPTS[:exc_handler] = block end |
.on_signal(signal = 'USR1', *args) ⇒ Object
Used to have RTI register itself on or off when the given signal is trapped. This way, the RTI thread is only running when needed during trouble-shooting or debugging. The remaining arguments are passed off to the #new method when the RTI thread is instantiated.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/rtinspect.rb', line 96 def self.on_signal( signal='USR1', *args ) unless OPTS[:signal_is_set] OPTS[:signal_is_set] = true Signal.trap( signal ) do if @@signal_rti @@signal_rti.kill @@signal_rti = nil OPTS[:dbg_handler].call "Stopped signal-based RTI thread" else @@signal_rti = Thread.new( *args ) OPTS[:dbg_handler].call "Started signal-based RTI thread" end end end end |
.show_trace=(val) ⇒ Object
Optionally enable display of any trace methods that are not seen as break or stop points. This will use the dbg_handler to output, so if that isn’t set, nothing will be shown.
75 76 77 |
# File 'lib/rtinspect.rb', line 75 def self.show_trace=( val ) OPTS[:show_trace] = val end |