Module: Debugger::FrameFunctions
- Defined in:
- lib/ruby-debug/commands/frame.rb
Overview
Mix-in module to assist in command parsing.
Instance Method Summary collapse
-
#adjust_frame(frame_pos, absolute, context = @state.context) ⇒ Object
:nodoc:.
- #get_frame_call(prefix_size, pos, context) ⇒ Object
- #print_frame(mark, pos, adjust = false, context = @state.context) ⇒ Object
Instance Method Details
#adjust_frame(frame_pos, absolute, context = @state.context) ⇒ 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 |
# File 'lib/ruby-debug/commands/frame.rb', line 4 def adjust_frame(frame_pos, absolute, context=@state.context) @state.frame_pos = 0 if context != @state.context if absolute if frame_pos < 0 abs_frame_pos = context.stack_size + frame_pos else abs_frame_pos = frame_pos end else abs_frame_pos = @state.frame_pos + frame_pos end if abs_frame_pos >= context.stack_size then errmsg pr("frame.errors.too_low") return elsif abs_frame_pos < 0 then errmsg pr("frame.errors.too_high") return end if @state.frame_pos != abs_frame_pos then @state.previous_line = nil @state.frame_pos = abs_frame_pos end @state.file = context.frame_file(@state.frame_pos) @state.line = context.frame_line(@state.frame_pos) print_frame(nil, @state.frame_pos, true) end |
#get_frame_call(prefix_size, pos, context) ⇒ Object
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 |
# File 'lib/ruby-debug/commands/frame.rb', line 33 def get_frame_call(prefix_size, pos, context) id = context.frame_method(pos) klass = context.frame_class(pos) call_str = "" if id args = context.frame_args(pos) locals = context.frame_locals(pos) if Command.settings[:callstyle] != :short && klass if Command.settings[:callstyle] == :tracked arg_info = context.frame_args_info(pos) end call_str << "#{klass}." end call_str << id.id2name if args.any? call_str << "(" args.each_with_index do |name, i| case Command.settings[:callstyle] when :short call_str += "%s, " % [name] when :last klass = locals[name].class if klass.inspect.size > 20+3 klass = klass.inspect[0..20]+"..." end call_str += "%s#%s, " % [name, klass] when :tracked if arg_info && arg_info.size > i call_str += "#{name}: #{arg_info[i].inspect}, " else call_str += "%s, " % name end end if call_str.size > self.class.settings[:width] - prefix_size # Strip off trailing ', ' if any but add stuff for later trunc call_str[-2..-1] = ",...XX" break end end call_str[-2..-1] = ")" # Strip off trailing ', ' if any end end return call_str end |
#print_frame(mark, pos, adjust = false, context = @state.context) ⇒ Object
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/ruby-debug/commands/frame.rb', line 78 def print_frame(mark, pos, adjust = false, context = @state.context) if print_frame?(context, pos) print pr("frame.line", get_pr_arguments(mark, pos, context)) if ENV['EMACS'] && adjust fmt = (Debugger.annotate.to_i > 1 ? "\032\032source %s:%d\n" : "\032\032%s:%d\n") print fmt % [file, line] end end end |