Of course MS Windows has to be different
the port number used for remote debugging
gdb-style annotation mode. Used in GNU Emacs interface
If set, a string to look for in caller() and is used to see if the call stack is truncated.
in remote mode, wait for the remote connection
Runs normal debugger initialization scripts Reads and executes the commands from init file (if any) in the current working directory. This is only done if the current directory is different from your home directory. Thus, you can have more than one init file, one generic in your home directory,
and another, specific to the program you are debugging, in the
directory where you invoke ruby-debug.
# File cli/ruby-debug.rb, line 135 def run_init_script(out = handler.interface) cwd_script_file = File.expand_path(File.join(".", INITFILE)) run_script(cwd_script_file, out) if File.exists?(cwd_script_file) home_script_file = File.expand_path(File.join(HOME_DIR, INITFILE)) run_script(home_script_file, out) if File.exists?(home_script_file) and cwd_script_file != home_script_file end
Runs a script file
# File cli/ruby-debug.rb, line 147 def run_script(file, out = handler.interface, verbose=false) interface = ScriptInterface.new(File.expand_path(file), out) processor = ControlCommandProcessor.new(interface) processor.process_commands(verbose) end
Returns setting object. Use ::settings[] and ::settings[]= methods to query and set debugger settings. These settings are available:
:autolist - automatically calls 'list' command on breakpoint
:autoeval - evaluates input in the current binding if it's not recognized as a debugger command
:autoirb - automatically calls 'irb' command on breakpoint
:stack_trace_on_error - shows full stack trace if eval command results with an exception
:frame_full_path - displays full paths when showing frame stack
:frame_class_names - displays method's class name when showing frame stack
:reload_source_on_change - makes 'list' command to always display up-to-date source code
:force_stepping - stepping command asways move to the new line
# File cli/ruby-debug/command.rb, line 225 def self.settings Command.settings end
Connects to the remote debugger
# File cli/ruby-debug.rb, line 103 def start_client(host = 'localhost', port = PORT) require "socket" interface = Debugger::LocalInterface.new socket = TCPSocket.new(host, port) puts "Connected." catch(:exit) do while (line = socket.gets) case line when /^PROMPT (.*)$/ input = interface.read_command($1) throw :exit unless input socket.puts input when /^CONFIRM (.*)$/ input = interface.confirm($1) throw :exit unless input socket.puts input else print line end end end socket.close end
Starts a remote debugger.
# File cli/ruby-debug.rb, line 47 def start_remote(host = nil, port = PORT, post_mortem = false) return if @thread return if started? self.interface = nil start self.post_mortem if post_mortem if port.kind_of?(Array) cmd_port, ctrl_port = port else cmd_port, ctrl_port = port, port + 1 end start_control(host, ctrl_port) yield if block_given? mutex = Mutex.new proceed = ConditionVariable.new @thread = DebugThread.new do server = TCPServer.new(host, cmd_port) while (session = server.accept) self.interface = RemoteInterface.new(session) if wait_connection mutex.synchronize do proceed.signal end end end end if wait_connection mutex.synchronize do proceed.wait(mutex) end end end