Module: Debugger
- Defined in:
- lib/ruby-debug-ide.rb,
lib/ruby-debug/helper.rb,
lib/ruby-debug/command.rb,
lib/ruby-debug/interface.rb,
lib/ruby-debug/processor.rb,
lib/ruby-debug/xml_printer.rb,
lib/ruby-debug/commands/eval.rb,
lib/ruby-debug/commands/load.rb,
lib/ruby-debug/commands/frame.rb,
lib/ruby-debug/commands/enable.rb,
lib/ruby-debug/event_processor.rb,
lib/ruby-debug/commands/control.rb,
lib/ruby-debug/commands/inspect.rb,
lib/ruby-debug/commands/threads.rb,
lib/ruby-debug/commands/stepping.rb,
lib/ruby-debug/commands/condition.rb,
lib/ruby-debug/commands/variables.rb,
lib/ruby-debug/commands/catchpoint.rb,
lib/ruby-debug/commands/breakpoints.rb
Defined Under Namespace
Modules: EnableDisableFunctions, FrameFunctions, Kernel, ParseFunctions Classes: AddBreakpoint, BreakpointsCommand, CatchCommand, Command, ConditionCommand, Context, ContinueCommand, ControlCommandProcessor, ControlState, DeleteBreakpointCommand, DisableCommand, DownCommand, EnableCommand, EvalCommand, EventProcessor, Exception, FinishCommand, FrameCommand, InspectCommand, InterruptCommand, LoadCommand, NextCommand, PPCommand, QuitCommand, RemoteInterface, RestartCommand, StartCommand, State, StepCommand, ThreadCurrentCommand, ThreadListCommand, ThreadResumeCommand, ThreadStopCommand, ThreadSwitchCommand, UpCommand, VarConstantCommand, VarGlobalCommand, VarInstanceCommand, VarLocalCommand, WhereCommand, XmlPrinter
Class Attribute Summary collapse
-
.cli_debug ⇒ Object
Returns the value of attribute cli_debug.
-
.control_thread ⇒ Object
readonly
Returns the value of attribute control_thread.
-
.event_processor ⇒ Object
Returns the value of attribute event_processor.
-
.xml_debug ⇒ Object
Returns the value of attribute xml_debug.
Class Method Summary collapse
- .debug_program(options) ⇒ Object
-
.interrupt ⇒ Object
Interrupts the current thread.
-
.interrupt_last ⇒ Object
Interrupts the last debugged thread.
-
.print_debug(*args) ⇒ Object
Prints to the stderr using printf(*args) if debug logging flag (-d) is on.
- .run_prog_script ⇒ Object
- .start_control(host, port) ⇒ Object
- .start_server(host = nil, port = 1234) ⇒ Object
Class Attribute Details
.cli_debug ⇒ Object
Returns the value of attribute cli_debug.
67 68 69 |
# File 'lib/ruby-debug-ide.rb', line 67 def cli_debug @cli_debug end |
.control_thread ⇒ Object (readonly)
Returns the value of attribute control_thread.
68 69 70 |
# File 'lib/ruby-debug-ide.rb', line 68 def control_thread @control_thread end |
.event_processor ⇒ Object
Returns the value of attribute event_processor.
67 68 69 |
# File 'lib/ruby-debug-ide.rb', line 67 def event_processor @event_processor end |
.xml_debug ⇒ Object
Returns the value of attribute xml_debug.
67 68 69 |
# File 'lib/ruby-debug-ide.rb', line 67 def xml_debug @xml_debug end |
Class Method Details
.debug_program(options) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/ruby-debug-ide.rb', line 96 def debug_program() start_server(.host, .port) raise "Control thread did not start (#{@control_thread}}" unless @control_thread && @control_thread.alive? @mutex = Mutex.new @proceed = ConditionVariable.new # wait for 'start' command @mutex.synchronize do @proceed.wait(@mutex) end bt = debug_load(Debugger::PROG_SCRIPT, .stop, .load_mode) if bt $stderr.print bt.backtrace.map{|l| "\t#{l}"}.join("\n"), "\n" $stderr.print "Uncaught exception: #{bt}\n" end end |
.interrupt ⇒ Object
Interrupts the current thread
73 74 75 |
# File 'lib/ruby-debug-ide.rb', line 73 def interrupt current_context.interrupt end |
.interrupt_last ⇒ Object
Interrupts the last debugged thread
80 81 82 83 84 85 86 87 88 |
# File 'lib/ruby-debug-ide.rb', line 80 def interrupt_last skip do if context = last_context return nil unless context.thread.alive? context.interrupt end context end end |
.print_debug(*args) ⇒ Object
Prints to the stderr using printf(*args) if debug logging flag (-d) is on.
20 21 22 23 24 25 26 |
# File 'lib/ruby-debug-ide.rb', line 20 def print_debug(*args) if Debugger.cli_debug $stderr.printf(*args) $stderr.printf("\n") $stderr.flush end end |
.run_prog_script ⇒ Object
116 117 118 119 120 121 |
# File 'lib/ruby-debug-ide.rb', line 116 def run_prog_script return unless @mutex @mutex.synchronize do @proceed.signal end end |
.start_control(host, port) ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/ruby-debug-ide.rb', line 123 def start_control(host, port) raise "Debugger is not started" unless started? return if @control_thread @control_thread = DebugThread.new do begin $stderr.printf "Fast Debugger (ruby-debug-ide 0.4.9) listens on #{host}:#{port}\n" # 127.0.0.1 seemingly works with all systems and with IPv6 as well. # "localhost" and nil on have problems on some systems. host ||= '127.0.0.1' server = TCPServer.new(host, port) while (session = server.accept) begin interface = RemoteInterface.new(session) @event_processor = EventProcessor.new(interface) ControlCommandProcessor.new(interface).process_commands rescue StandardError, ScriptError => ex $stderr.printf "Exception in DebugThread loop: #{ex}\n" exit 1 end end rescue $stderr.printf "Exception in DebugThread: #$!\n" exit 2 end end end |
.start_server(host = nil, port = 1234) ⇒ Object
90 91 92 93 94 |
# File 'lib/ruby-debug-ide.rb', line 90 def start_server(host = nil, port = 1234) return if started? start start_control(host, port) end |