Module: Debugger::ShowFunctions
- Defined in:
- lib/ruby-debug/commands/show.rb
Overview
Mix-in module to showing settings
Instance Method Summary collapse
-
#show_setting(setting_name) ⇒ Object
:nodoc:.
Instance Method Details
#show_setting(setting_name) ⇒ Object
:nodoc:
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/ruby-debug/commands/show.rb', line 4 def show_setting(setting_name) case setting_name when /^annotate$/ Debugger.annotate ||= 0 return ("Annotation level is #{Debugger.annotate}") when /^args$/ if Command.settings[:argv] and Command.settings[:argv].size > 0 if defined?(Debugger::RDEBUG_SCRIPT) # rdebug was called initially. 1st arg is script name. args = Command.settings[:argv][1..-1].join(' ') else # rdebug wasn't called initially. 1st arg is not script name. args = Command.settings[:argv].join(' ') end else args = '' end return "Argument list to give program being debugged when it is started is \"#{args}\"." when /^autolist$/ on_off = Command.settings[:autolist] > 0 return "autolist is #{show_onoff(on_off)}." when /^autoeval$/ on_off = Command.settings[:autoeval] return "autoeval is #{show_onoff(on_off)}." when /^autoreload$/ on_off = Command.settings[:reload_source_on_change] return "autoreload is #{show_onoff(on_off)}." when /^autoirb$/ on_off = Command.settings[:autoirb] > 0 return "autoirb is #{show_onoff(on_off)}." when /^basename$/ on_off = Command.settings[:basename] return "basename is #{show_onoff(on_off)}." when /^callstyle$/ style = Command.settings[:callstyle] return "Frame call-display style is #{style}." when /^commands(:?\s+(\d+))?$/ if @state.interface.readline_support? s = ''; args = @match[1].split if args[1] first_line = args[1].to_i - 4 last_line = first_line + 10 - 1 if first_line > Readline::HISTORY.length first_line = last_line = Readline::HISTORY.length elsif first_line <= 0 first_line = 1 end if last_line > Readline::HISTORY.length last_line = Readline::HISTORY.length end i = first_line commands = Readline::HISTORY.to_a[first_line..last_line] else if Readline::HISTORY.length > 10 commands = Readline::HISTORY.to_a[-10..-1] i = Readline::HISTORY.length - 10 else commands = Readline::HISTORY.to_a i = 1 end end commands.each do |cmd| s += ("%5d %s\n" % [i, cmd]) i += 1 end else s='No readline support' end return s when /^debuggertesting$/ on_off = Command.settings[:debuggertesting] return "Currently testing the debugger is #{show_onoff(on_off)}." when /^forcestep$/ on_off = self.class.settings[:force_stepping] return "force-stepping is #{show_onoff(on_off)}." when /^fullpath$/ on_off = Command.settings[:full_path] return "Displaying frame's full file names is #{show_onoff(on_off)}." when /^history(:?\s+(filename|save|size))?$/ args = @match[1].split interface = @state.interface if args[1] show_save = show_size = show_filename = false prefix = false if args[1] == "save" show_save = true elsif args[1] == "size" show_size = true elsif args[1] == "filename" show_filename = true end else show_save = show_size = show_filename = true prefix = true end s = [] if show_filename msg = (prefix ? "filename: " : "") + "The filename in which to record the command history is " + "#{interface.histfile.inspect}" s << msg end if show_save msg = (prefix ? "save: " : "") + "Saving of history save is #{show_onoff(interface.history_save)}." s << msg end if show_size msg = (prefix ? "size: " : "") + "Debugger history size is #{interface.history_length}" s << msg end return s.join("\n") when /^linetrace$/ on_off = Debugger.tracing return "line tracing is #{show_onoff(on_off)}." when /^linetrace\+$/ on_off = Command.settings[:tracing_plus] if on_off return "line tracing style is different consecutive lines." else return "line tracing style is every line." end when /^listsize$/ listlines = Command.settings[:listsize] return "Number of source lines to list by default is #{listlines}." when /^port$/ return "server port is #{Debugger::PORT}." when /^trace$/ on_off = Command.settings[:stack_trace_on_error] return "Displaying stack trace is #{show_onoff(on_off)}." when /^version$/ return "ruby-debug #{Debugger::VERSION}" when /^width$/ return "width is #{self.class.settings[:width]}." else return "Unknown show subcommand #{setting_name}." end end |