trepanning 1.93.35 → 2.15.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. checksums.yaml +7 -0
  2. data/ChangeLog +491 -55
  3. data/LICENSE +1 -1
  4. data/NEWS +18 -14
  5. data/README.md +5 -22
  6. data/Rakefile +22 -1
  7. data/app/breakpoint.rb +5 -3
  8. data/app/core.rb +147 -179
  9. data/app/default.rb +47 -46
  10. data/app/file.rb +6 -7
  11. data/app/frame.rb +183 -176
  12. data/app/markdown.rb +2 -9
  13. data/app/options.rb +1 -1
  14. data/app/run.rb +71 -37
  15. data/interface/script.rb +8 -8
  16. data/io.rb +19 -20
  17. data/lib/trepanning.rb +292 -297
  18. data/processor.rb +332 -344
  19. data/processor/breakpoint.rb +98 -96
  20. data/processor/command/base/submgr.rb +9 -9
  21. data/processor/command/break.rb +40 -38
  22. data/processor/command/continue.rb +15 -10
  23. data/processor/command/debug.rb +6 -25
  24. data/processor/command/delete.rb +21 -12
  25. data/processor/command/directory.rb +15 -13
  26. data/processor/command/disable.rb +12 -9
  27. data/processor/command/disassemble.rb +80 -74
  28. data/processor/command/display.rb +15 -12
  29. data/processor/command/down.rb +8 -3
  30. data/processor/command/edit.rb +37 -23
  31. data/processor/command/enable.rb +11 -8
  32. data/processor/command/eval.rb +24 -22
  33. data/processor/command/finish.rb +50 -48
  34. data/processor/command/help.rb +1 -1
  35. data/processor/command/info_subcmd/breakpoints.rb +7 -7
  36. data/processor/command/info_subcmd/files.rb +195 -196
  37. data/processor/command/info_subcmd/frame.rb +7 -4
  38. data/processor/command/info_subcmd/locals.rb +29 -12
  39. data/processor/command/info_subcmd/program.rb +48 -39
  40. data/processor/command/info_subcmd/registers_subcmd/ep.rb +46 -0
  41. data/processor/command/info_subcmd/registers_subcmd/helper.rb +32 -35
  42. data/processor/command/info_subcmd/registers_subcmd/sp.rb +29 -23
  43. data/processor/command/info_subcmd/return.rb +28 -10
  44. data/processor/command/info_subcmd/variables_subcmd/class.rb +3 -3
  45. data/processor/command/info_subcmd/variables_subcmd/constants.rb +77 -0
  46. data/processor/command/info_subcmd/variables_subcmd/globals.rb +7 -7
  47. data/processor/command/info_subcmd/variables_subcmd/instance.rb +68 -22
  48. data/processor/command/info_subcmd/variables_subcmd/locals.rb +148 -67
  49. data/processor/command/list.rb +14 -8
  50. data/processor/command/macro.rb +1 -1
  51. data/processor/command/next.rb +1 -0
  52. data/processor/command/set_subcmd/auto.rb +3 -3
  53. data/processor/command/set_subcmd/different.rb +30 -29
  54. data/processor/command/set_subcmd/events.rb +74 -48
  55. data/processor/command/set_subcmd/max_subcmd/list.rb +12 -5
  56. data/processor/command/set_subcmd/max_subcmd/width.rb +28 -19
  57. data/processor/command/set_subcmd/register.rb +37 -0
  58. data/processor/command/set_subcmd/register_subcmd/pc.rb +67 -0
  59. data/processor/command/set_subcmd/register_subcmd/sp.rb +75 -0
  60. data/processor/command/set_subcmd/reload.rb +12 -10
  61. data/processor/command/set_subcmd/return.rb +68 -44
  62. data/processor/command/shell.rb +3 -2
  63. data/processor/command/show_subcmd/different.rb +17 -14
  64. data/processor/command/show_subcmd/events.rb +25 -25
  65. data/processor/default.rb +1 -1
  66. data/processor/eval.rb +14 -15
  67. data/processor/frame.rb +43 -36
  68. data/processor/help.rb +5 -5
  69. data/processor/hook.rb +26 -29
  70. data/processor/location.rb +54 -51
  71. data/processor/mock.rb +4 -3
  72. data/processor/running.rb +113 -103
  73. data/processor/validate.rb +401 -373
  74. data/test/data/debug.cmd +8 -0
  75. data/test/data/debug.right +13 -0
  76. data/test/data/debugger-stop.right +6 -4
  77. data/test/data/fname-with-blank.cmd +1 -1
  78. data/test/data/fname-with-blank.right +5 -0
  79. data/test/data/pc.cmd +8 -0
  80. data/test/data/pc.right +10 -0
  81. data/test/data/quit.right +3 -1
  82. data/test/data/trace.cmd +2 -2
  83. data/test/data/trace.right +41 -20
  84. data/test/example/assign.rb +6 -0
  85. data/test/functional/fn_helper.rb +11 -17
  86. data/test/functional/test-break-long.rb +15 -16
  87. data/test/functional/test-break.rb +6 -8
  88. data/test/functional/test-condition.rb +8 -10
  89. data/test/functional/test-debugger-call-bug.rb +21 -22
  90. data/test/functional/test-delete.rb +57 -59
  91. data/test/functional/test-eval.rb +101 -103
  92. data/test/functional/test-finish.rb +24 -33
  93. data/test/functional/test-immediate-step-bug.rb +6 -10
  94. data/test/functional/test-next.rb +64 -65
  95. data/test/functional/test-raise.rb +63 -64
  96. data/test/functional/test-recursive-bt.rb +81 -76
  97. data/test/functional/test-remap.rb +6 -7
  98. data/test/functional/test-return.rb +44 -38
  99. data/test/functional/test-step.rb +55 -53
  100. data/test/functional/test-stepbug.rb +6 -9
  101. data/test/functional/test-watchg.rb +40 -39
  102. data/test/integration/test-debug.rb +12 -0
  103. data/test/integration/test-debugger-stop.rb +7 -7
  104. data/test/integration/test-pc.rb +24 -0
  105. data/test/integration/test-trace.rb +1 -1
  106. data/test/unit/cmd-helper.rb +0 -1
  107. data/test/unit/test-app-brkpt.rb +21 -21
  108. data/test/unit/test-app-brkptmgr.rb +7 -8
  109. data/test/unit/test-app-display.rb +3 -4
  110. data/test/unit/test-app-frame.rb +4 -5
  111. data/test/unit/test-base-subsubcmd.rb +2 -2
  112. data/test/unit/test-cmd-break.rb +6 -6
  113. data/test/unit/test-cmd-endisable.rb +7 -6
  114. data/test/unit/test-cmd-parse_list_cmd.rb +24 -24
  115. data/test/unit/test-io-tcpserver.rb +39 -35
  116. data/test/unit/test-proc-default.rb +23 -22
  117. data/test/unit/test-proc-eval.rb +1 -2
  118. data/test/unit/test-proc-frame.rb +8 -9
  119. data/test/unit/test-proc-list.rb +1 -1
  120. data/test/unit/test-proc-location.rb +2 -2
  121. data/test/unit/test-proc-main.rb +10 -10
  122. data/test/unit/test-proc-validate.rb +11 -13
  123. data/test/unit/test-subcmd-help.rb +1 -2
  124. data/trepanning.gemspec +8 -13
  125. metadata +44 -95
  126. data/COPYING +0 -57
  127. data/data/custom_require.rb +0 -44
  128. data/data/perldb.bindings +0 -17
  129. data/data/prelude.rb +0 -38
  130. data/processor/command/info_subcmd/variables_subcmd/constant.rb +0 -41
  131. data/processor/command/raise.rb +0 -48
  132. data/processor/command/set_subcmd/pc.rb +0 -62
  133. data/processor/command/set_subcmd/sp.rb +0 -67
  134. data/processor/eventbuf.rb +0 -133
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
1
+ # Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
2
2
  require 'linecache'
3
3
  require_relative '../app/complete'
4
4
  require_relative '../app/frame'
@@ -21,7 +21,7 @@ class Trepan
21
21
  # don't need to store this for all threads, just those we want to
22
22
  # hide frame on. A value of 1 means to hide just the oldest
23
23
  # level. The default or showing all levels is 0.
24
- attr_accessor :hidelevels
24
+ attr_accessor :hidelevels
25
25
 
26
26
  # Hash[container] -> file container. This gives us a way to map non-file
27
27
  # container objects to a file container for display.
@@ -29,20 +29,20 @@ class Trepan
29
29
 
30
30
  # Hash[iseq] -> file container. This gives as a way to map instruction
31
31
  # sequences to a file container for display.
32
- attr_accessor :remap_iseq
32
+ attr_accessor :remap_iseq
33
33
 
34
34
  # top frame of current thread. Since right now the ThreadFrame
35
35
  # method has "prev" but no way to move in the other direction. So
36
36
  # we store the top frame.
37
- attr_accessor :top_frame
37
+ attr_accessor :top_frame
38
38
 
39
39
  # Hash[thread_id] -> top_frame
40
40
  attr_reader :threads2frames
41
-
41
+
42
42
 
43
43
  def adjust_frame(frame_num, absolute_pos)
44
44
  frame, frame_num = get_frame(frame_num, absolute_pos)
45
- if frame
45
+ if frame
46
46
  @frame = frame
47
47
  @frame_index = frame_num
48
48
  unless @settings[:traceprint]
@@ -52,7 +52,7 @@ class Trepan
52
52
  :maxwidth => settings[:maxwidth],
53
53
  }
54
54
  print_stack_trace_from_to(frame_num, frame_num, frame, opts)
55
- print_location
55
+ print_location
56
56
  end
57
57
  @line_no = frame_line() - 1
58
58
  @frame
@@ -64,7 +64,7 @@ class Trepan
64
64
  def frame_low_high(direction)
65
65
  stack_size = @top_frame.stack_size - @hide_level
66
66
  if direction
67
- low, high = [ @frame_index * -direction,
67
+ low, high = [ @frame_index * -direction,
68
68
  (stack_size - 1 - @frame_index) * direction ]
69
69
  low, high = [high, low] if direction < 0
70
70
  [low, high]
@@ -72,7 +72,7 @@ class Trepan
72
72
  [-stack_size, stack_size-1]
73
73
  end
74
74
  end
75
-
75
+
76
76
  def frame_complete(prefix, direction)
77
77
  low, high = frame_low_high(direction)
78
78
  ary = (low..high).map{|i| i.to_s}
@@ -80,11 +80,11 @@ class Trepan
80
80
  end
81
81
 
82
82
  def frame_container(frame, canonicalize=true)
83
- container =
83
+ container =
84
84
  if @remap_container.member?(frame.source_container)
85
85
  @remap_container[frame.source_container]
86
- elsif frame.iseq && @remap_iseq.member?(frame.iseq.sha1)
87
- @remap_iseq[frame.iseq.sha1]
86
+ # elsif frame.iseq && @remap_iseq.member?(frame.iseq.sha1)
87
+ # @remap_iseq[frame.iseq.sha1]
88
88
  else
89
89
  frame.source_container
90
90
  end
@@ -103,28 +103,35 @@ class Trepan
103
103
  end
104
104
  end
105
105
 
106
- # Initializes the thread and frame variables: @frame, @top_frame,
106
+ # Initializes the thread and frame variables: @frame, @top_frame,
107
107
  # @frame_index, @current_thread, and @threads2frames
108
- def frame_setup(frame_thread)
109
- @frame_index = 0
110
- @frame = @top_frame = frame_thread
111
- @current_thread = @frame.thread
112
- @stack_size = @frame.stack_size
113
-
114
- @threads2frames ||= {}
115
- @threads2frames[@current_thread] = @top_frame
116
- @hide_level =
117
- if @settings[:debugstack]
118
- 0
119
- else
120
- @hidelevels[@current_thread]
108
+ def frame_setup(frame_thread, top_skip=0)
109
+ @frame_index = 0
110
+ unless frame_thread
111
+ @stack_size = 0
112
+ @current_thread = nil
113
+ @top_frame = @frame = nil
114
+ return
121
115
  end
122
-
116
+
117
+ @frame = @top_frame = frame_thread.prev(top_skip)
118
+ @current_thread = @frame.thread
119
+ @stack_size = @frame.stack_size
120
+
121
+ @threads2frames ||= {}
122
+ @threads2frames[@current_thread] = @top_frame
123
+ @hide_level =
124
+ if @settings[:debugstack]
125
+ 0
126
+ else
127
+ @hidelevels[@current_thread]
128
+ end
129
+
123
130
  end
124
131
 
125
132
  # Remove access to thread and frame variables
126
133
  def frame_teardown
127
- @top_frame = @frame = @frame_index = @current_thread = nil
134
+ @top_frame = @frame = @frame_index = @current_thread = nil
128
135
  @threads2frames = {}
129
136
  end
130
137
 
@@ -164,7 +171,7 @@ class Trepan
164
171
  def get_nonsync_frame(tf)
165
172
  if (tf.stack_size > 10)
166
173
  check_frames = (0..5).map{|i| tf.prev(i).method}
167
- if check_frames ==
174
+ if check_frames ==
168
175
  %w(synchronize event_processor IFUNC call trace_hook IFUNC)
169
176
  return tf.prev(6)
170
177
  end
@@ -187,14 +194,14 @@ class Trepan
187
194
  # `frame', which is in the thread with id `thread_id'. We may
188
195
  # need to the hide initial debugger frames.
189
196
  def find_and_set_debugged_frame(th, position)
190
-
197
+
191
198
  thread = threading._active[thread_id]
192
199
  thread_name = thread.getName()
193
200
  if (!@settings['dbg_pydbgr'] &&
194
201
  thread_name == Mthread.current_thread_name())
195
202
  # The frame we came in on ('current_thread_name') is
196
203
  # the same as the one we want to switch to. In this case
197
- # we need to some debugger frames are in this stack so
204
+ # we need to some debugger frames are in this stack so
198
205
  # we need to remove them.
199
206
  newframe = Mthread.find_debugged_frame(frame)
200
207
  frame = newframe unless newframe
@@ -202,12 +209,12 @@ class Trepan
202
209
  ## FIXME: else: we might be blocked on other threads which are
203
210
  # about to go into the debugger it not for the fact this one got there
204
211
  # first. Possibly in the future we want
205
- # to hide the blocks into threading of that locking code as well.
206
-
212
+ # to hide the blocks into threading of that locking code as well.
213
+
207
214
  # Set stack to new frame
208
215
  @frame, @curindex = Mcmdproc.get_stack(frame, nil, self.proc)
209
216
  @proc.stack, @proc.curindex = self.stack, self.curindex
210
-
217
+
211
218
  # @frame_thread_name = thread_name
212
219
  end
213
220
  end
@@ -229,7 +236,7 @@ if __FILE__ == $0
229
236
  end
230
237
 
231
238
  proc = Trepan::CmdProcessor.new(Trepan::MockCore.new())
232
- proc.frame_setup(RubyVM::Frame.current)
239
+ proc.frame_setup(RubyVM::Frame.get)
233
240
  proc.frame_initialize
234
241
  puts "stack size: #{proc.top_frame.stack_size}"
235
242
  0.upto(proc.top_frame.stack_size) { |i| proc.adjust_frame(i, true) }
@@ -241,5 +248,5 @@ if __FILE__ == $0
241
248
  puts '*' * 10
242
249
  proc.adjust_frame(proc.top_frame.stack_size-1, true)
243
250
  proc.top_frame.stack_size.times { proc.adjust_frame(-1, false) }
244
-
251
+
245
252
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
1
+ # Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
2
2
 
3
3
  class Trepan
4
4
  # class SubHelp
@@ -9,7 +9,7 @@ class Trepan
9
9
  # end
10
10
 
11
11
  # def load_sub_help_files(dir)
12
- # Dir.glob(dir, '*.txt').each do |txt|
12
+ # Dir.glob(dir, '*.txt').each do |txt|
13
13
  # basename = File.basename(txt, '.txt')
14
14
  # @list << basename
15
15
  # end
@@ -38,9 +38,9 @@ class Trepan
38
38
  short_help = subcmd.class.const_get('HELP').split("\n")[0].chomp('.')
39
39
  subcmd.class.const_set(:SHORT_HELP, short_help)
40
40
  end
41
-
41
+
42
42
  ' %-12s -- %s' %
43
- [abbrev_stringify(obj_const(subcmd, :NAME),
43
+ [abbrev_stringify(obj_const(subcmd, :NAME),
44
44
  obj_const(subcmd, :MIN_ABBREV)),
45
45
  obj_const(subcmd, :SHORT_HELP)]
46
46
  end
@@ -77,7 +77,7 @@ Long description goes here.'
77
77
  MIN_ABBREV = 1
78
78
  NAME = File.basename(__FILE__)
79
79
  def obj_const(obj, name)
80
- obj.class.const_get(name)
80
+ obj.class.const_get(name)
81
81
  end
82
82
  def msg(mess)
83
83
  puts mess
@@ -13,63 +13,63 @@ class Trepan::CmdProcessor < Trepan::VirtualCmdProcessor
13
13
  attr_reader :unconditional_prehooks
14
14
  attr_reader :cmdloop_posthooks
15
15
  attr_reader :cmdloop_prehooks
16
-
16
+
17
17
  # Used to time how long a debugger action takes
18
18
  attr_accessor :time_last
19
-
19
+
20
20
  class Hook
21
21
  attr_accessor :list
22
-
22
+
23
23
  def initialize(list=[])
24
24
  @list = list
25
25
  end
26
-
26
+
27
27
  def delete_by_name(delete_name)
28
28
  @list.delete_if {|hook_name, priority, hook| hook_name == delete_name}
29
29
  end
30
-
30
+
31
31
  def empty?
32
32
  @list.empty?
33
33
  end
34
-
34
+
35
35
  def insert(priority, name, hook)
36
36
  insert_loc = @list.size # at end
37
37
  @list.each_with_index do |entry, index|
38
38
  n, p, h = entry
39
- if priority > p
39
+ if priority > p
40
40
  insert_loc = index
41
41
  break
42
42
  end
43
43
  end
44
44
  @list.insert(insert_loc, [name, priority, hook])
45
45
  end
46
-
46
+
47
47
  def insert_if_new(priority, name, hook)
48
48
  insert(priority, name, hook) unless
49
49
  @list.find {|try_name, try_priority, try_hook| try_name == name}
50
50
  end
51
-
51
+
52
52
  # Run each function in `hooks' with args
53
53
  def run(*args)
54
- @list.each do |name, priority, hook|
55
- hook.call(name, *args)
54
+ @list.each do |name, priority, hook|
55
+ hook.call(name, *args)
56
56
  end
57
57
  end
58
-
58
+
59
59
  # Could add delete_at and delete if necessary.
60
60
  end
61
-
61
+
62
62
  def hook_initialize(commands)
63
63
  @cmdloop_posthooks = Hook.new
64
64
  @cmdloop_prehooks = Hook.new
65
65
  @unconditional_prehooks = Hook.new
66
-
66
+
67
67
  irb_cmd = commands['shell']
68
- @autoirb_hook = ['autoirb',
68
+ @autoirb_hook = ['autoirb',
69
69
  Proc.new{|*args| irb_cmd.run(['shell']) if irb_cmd}]
70
-
70
+
71
71
  @debug_dbgr_hook = ['dbgdbgr',
72
- Proc.new{|*args|
72
+ Proc.new{|*args|
73
73
  if settings[:debugdbgr]
74
74
  $trepan_cmdproc = self
75
75
  $trepan_frame = @frame
@@ -77,29 +77,26 @@ class Trepan::CmdProcessor < Trepan::VirtualCmdProcessor
77
77
  $trepan_cmdproc = nil
78
78
  $trepan_frame = nil
79
79
  end}]
80
-
80
+
81
81
  display_cmd = commands['display']
82
- @display_hook = ['display',
83
- Proc.new{|*args| display_cmd.run(['display']) if
82
+ @display_hook = ['display',
83
+ Proc.new{|*args| display_cmd.run(['display']) if
84
84
  display_cmd}]
85
-
85
+
86
86
  list_cmd = commands['list']
87
- @autolist_hook = ['autolist',
87
+ @autolist_hook = ['autolist',
88
88
  Proc.new{|*args| list_cmd.run(['list']) if list_cmd}]
89
-
90
- @timer_hook = ['timer',
89
+
90
+ @timer_hook = ['timer',
91
91
  Proc.new{|*args|
92
92
  now = Time.now
93
- msg("%g seconds" %
93
+ msg("%g seconds" %
94
94
  (now - @time_last)) if @time_last
95
95
  @time_last = now
96
96
  }]
97
97
  @timer_posthook = ['timer', Proc.new{|*args| @time_last = Time.now}]
98
- @trace_hook = ['trace',
98
+ @trace_hook = ['trace',
99
99
  Proc.new{|*args| print_location}]
100
- @tracebuf_hook = ['tracebuffer',
101
- Proc.new{|*args| @eventbuf.append(@event, @frame,
102
- @core.hook_arg)}]
103
100
  end
104
101
  end
105
102
 
@@ -13,8 +13,8 @@ class Trepan::CmdProcessor < Trepan::VirtualCmdProcessor
13
13
  EVENT2ICON = {
14
14
  'brkpt' => 'xx',
15
15
  'tbrkpt' => 'x1',
16
- 'c-call' => 'C>',
17
- 'c-return' => '<C',
16
+ 'c_call' => 'C>',
17
+ 'c_return' => '<C',
18
18
  'call' => '->',
19
19
  'send' => '=>',
20
20
  'leave' => '<=',
@@ -35,9 +35,9 @@ class Trepan::CmdProcessor < Trepan::VirtualCmdProcessor
35
35
  }
36
36
  end
37
37
 
38
- def canonic_container(container)
39
- [container[0], canonic_file(container[1])]
40
- end
38
+ def canonic_container(container)
39
+ [container[0], canonic_file(container[1])]
40
+ end
41
41
 
42
42
  def canonic_file(filename, resolve=true)
43
43
  # For now we want resolved filenames
@@ -141,41 +141,39 @@ class Trepan::CmdProcessor < Trepan::VirtualCmdProcessor
141
141
  end
142
142
 
143
143
  def print_location
144
- if %w(c-call call).member?(@event)
145
- # FIXME: Fix Ruby so we don't need this workaround?
146
- # See also where.rb
147
- opts = {}
148
- opts[:class] = @core.hook_arg if
149
- 'CFUNC' == @frame.type && @core.hook_arg && 0 == @frame_index
150
- msg format_stack_call(@frame, opts)
151
- elsif 'raise' == @event
152
- msg @core.hook_arg.inspect if @core.hook_arg # Exception object
153
- end
154
-
155
144
  text = nil
156
- source_container = frame_container(@frame, false)
145
+
157
146
  ev = if @event.nil? || 0 != @frame_index
158
147
  ' '
159
148
  else
160
- (EVENT2ICON[@event] || @event)
149
+ @event
150
+ # (EVENT2ICON[@event] || @event)
161
151
  end
162
- @line_no = frame_line
163
-
164
- loc = source_location_info(source_container, @line_no, @frame)
165
- loc, @line_no, text, found_line =
166
- loc_and_text(loc, @frame, @line_no, source_container)
167
-
168
- ip_str = @frame.iseq ? " @#{frame.pc_offset}" : ''
169
- msg "#{ev} (#{loc}#{ip_str})"
170
-
171
- if %w(return c-return).member?(@event)
172
- retval = Trepan::Frame.value_returned(@frame, @event)
173
- msg 'R=> %s' % retval.inspect
174
- elsif @event == 'raise'
175
- # msg @proc.core.hook_arg.inspect if @proc.core.hook_arg
176
- if @frame.iseq and @frame.iseq.catch_table_size == 0
177
- msg "Warning: exception raised is non-local!"
178
- end
152
+ if @frame
153
+ source_container = frame_container(@frame, false)
154
+ @line_no = frame_line
155
+
156
+ loc = source_location_info(source_container, @line_no, @frame)
157
+ loc, @line_no, text, found_line =
158
+ loc_and_text(loc, @frame, @line_no, source_container)
159
+
160
+ ip_str = @frame.iseq ? " @#{frame.pc_offset}" : ''
161
+ msg "#{ev} (#{loc}#{ip_str})"
162
+ else
163
+ msg "#{ev}"
164
+ end
165
+
166
+ if @core.trace_point
167
+ if %w(return c_return b_return).member?(@event.to_s)
168
+ retval = @core.trace_point.return_value
169
+ msg 'R=> %s' % retval.inspect
170
+ elsif @event == :raise
171
+ exc = @core.trace_point.raised_exception
172
+ msg "#{exc.class}: #{exc}"
173
+ if @frame.iseq and @frame.iseq.catch_table_size == 0
174
+ msg "Warning: exception raised is non-local!"
175
+ end
176
+ end
179
177
  end
180
178
 
181
179
  if text && !text.strip.empty?
@@ -183,25 +181,30 @@ class Trepan::CmdProcessor < Trepan::VirtualCmdProcessor
183
181
  @line_no -= 1
184
182
  end
185
183
  unless found_line
186
- # Can't find source line, so give assembly as consolation.
187
- # This great idea comes from the Rubinius reference debugger.
188
- run_command('disassemble')
184
+ if @frame
185
+ # Can't find source line, so give assembly as consolation.
186
+ # This great idea comes from the Rubinius reference debugger.
187
+ run_command('disassemble') unless source_container[0] == 'binary'
188
+ end
189
189
  end
190
190
  end
191
191
 
192
192
  def source_location_info(source_container, line_no, frame)
193
- filename = source_container[1]
194
- ## FIXME: condition is too long.
195
- canonic_filename =
196
- if 'string' == source_container[0] && frame.iseq &&
197
- frame.iseq.eval_source
198
- eval_str = frame.iseq.eval_source
199
- 'eval "' + safe_repr(eval_str.gsub(/\n/,';'), 15) + '"'
200
- else
201
- canonic_file(filename, false)
193
+ filename = source_container[1]
194
+ ## FIXME: condition is too long.
195
+ if 'binary' == source_container[0]
196
+ return "address 0x%x" % line_no
202
197
  end
203
- loc = "#{canonic_filename}:#{line_no}"
204
- return loc
198
+ canonic_filename =
199
+ if 'string' == source_container[0] && frame.iseq &&
200
+ frame.iseq.eval_source
201
+ eval_str = frame.iseq.eval_source
202
+ 'eval "' + safe_repr(eval_str.gsub(/\n/,';'), 15) + '"'
203
+ else
204
+ canonic_file(filename, false)
205
+ end
206
+ loc = "#{canonic_filename}:#{line_no}"
207
+ return loc
205
208
  end # source_location_info
206
209
  end
207
210
 
@@ -222,7 +225,7 @@ if __FILE__ == $0 && caller.size == 0
222
225
  proc = Trepan::CmdProcessor.new(Trepan::MockCore.new())
223
226
  proc.instance_variable_set('@settings', {})
224
227
  proc.frame_initialize
225
- proc.frame_setup(RubyVM::Frame.current)
228
+ proc.frame_setup(RubyVM::Frame.get)
226
229
  proc.frame_initialize
227
230
 
228
231
  puts proc.canonic_file(__FILE__)
@@ -231,7 +234,7 @@ if __FILE__ == $0 && caller.size == 0
231
234
  puts proc.current_source_text
232
235
  xx = eval <<-END
233
236
  proc.frame_initialize
234
- proc.frame_setup(RubyVM::Frame.current)
237
+ proc.frame_setup(RubyVM::Frame.get)
235
238
  puts proc.current_source_text
236
239
  END
237
240
  end