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
@@ -0,0 +1,67 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2012, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require_relative '../../base/subsubcmd'
4
+
5
+ # Note: The class name has to end in Pc, not PC since it is
6
+ # auto-instantiated.
7
+ class Trepan::Subcommand::SetRegisterPc < Trepan::SubSubcommand
8
+ unless defined?(HELP)
9
+ NAME = File.basename(__FILE__, '.rb')
10
+ SHORT_HELP = 'Set VM program counter (PC)'
11
+ IN_LIST = true
12
+ MIN_ABBREV = 'pc'.size
13
+ PREFIX = %w(set register #{name})
14
+ HELP = <<-EOH
15
+ **#{PREFIX.join(' ')}** *integer-expression*
16
+
17
+ Set VM program-counter register (PC) to *integer-expression*
18
+
19
+ Warning: this is potentially dangerous.
20
+
21
+ See also:
22
+ ---------
23
+ `set register sp`, `info register sp`, `set return`
24
+ EOH
25
+ end
26
+
27
+ def run(args)
28
+ if args.size < 2
29
+ errmsg "Too few arguments - the 'pc' command requires a value"
30
+ return
31
+ end
32
+ new_val_str = args[1..-1].join(' ')
33
+ begin
34
+ new_val = @proc.debug_eval(new_val_str)
35
+ rescue StandardError, ScriptError => e
36
+ return
37
+ end
38
+ msg("Old value was: %s" % @proc.frame.pc_offset.inspect)
39
+ @proc.frame.pc_offset = new_val
40
+ msg("New value is: %s" % new_val.inspect)
41
+ end
42
+ end
43
+
44
+ if __FILE__ == $0
45
+ # Demo it.
46
+ require_relative '../../../mock'
47
+ require_relative '../../../subcmd'
48
+ name = File.basename(__FILE__, '.rb')
49
+
50
+ # # FIXME: DRY the below code
51
+ # dbgr, cmd = MockDebugger::setup('set')
52
+ # subcommand = Debugger::Subcommand::SetPC.new(cmd)
53
+ # testcmdMgr = Debugger::Subcmd.new(subcommand)
54
+
55
+ # def subcommand.msg(message)
56
+ # puts message
57
+ # end
58
+ # def subcommand.msg_nocr(message)
59
+ # print message
60
+ # end
61
+ # def subcommand.errmsg(message)
62
+ # puts message
63
+ # end
64
+ # subcommand.run(%w(20))
65
+ # name = File.basename(__FILE__, '.rb')
66
+ # subcommand.summary_help(name)
67
+ end
@@ -0,0 +1,75 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2010-2012, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
+ require_relative '../../base/subsubcmd'
4
+
5
+ # Note: The class name has to end in Sp, not SP since it is
6
+ # auto-instantiated.
7
+ class Trepan::Subcommand::SetRegisterSp < Trepan::SubSubcommand
8
+ unless defined?(HELP)
9
+ NAME = File.basename(__FILE__, '.rb')
10
+ SHORT_HELP = 'Set a stack pointer register'
11
+ IN_LIST = true
12
+ MIN_ABBREV = 'sp'.size
13
+ PREFIX = %w(set register #{name})
14
+ HELP = <<-EOH
15
+ **#{PREFIX.join(' ')}** *integer-expression*
16
+
17
+ Set VM stack-pointer register (SP) to *integer-expression*
18
+
19
+ Warning: this is potentially dangerous.
20
+
21
+ See also:
22
+ ---------
23
+
24
+ `info register sp`, `set return`
25
+ EOH
26
+ end
27
+
28
+ def run(args)
29
+ # FIXME handle c-return
30
+ # unless %w(return c-return).member?(@proc.event)
31
+ if args.size < 3
32
+ errmsg "Too few arguments - the 'sp' command requires number and a value"
33
+ return
34
+ end
35
+ msg_on_error = "set SP requires an integer index"
36
+ index = @proc.get_an_int(args[1],
37
+ :msg_on_error => msg_on_error
38
+ )
39
+ return unless index
40
+ new_val_str = args[2..-1].join(' ')
41
+ begin
42
+ new_val = @proc.debug_eval(new_val_str)
43
+ rescue StandardError, ScriptError => e
44
+ return
45
+ end
46
+ msg("Old value was: %s" % @proc.frame.sp(index).inspect)
47
+ @proc.frame.sp_set(index, new_val)
48
+ msg("New value is: %s" % new_val.inspect)
49
+ end
50
+ end
51
+
52
+ if __FILE__ == $0
53
+ # Demo it.
54
+ require_relative '../../../mock'
55
+ require_relative '../../../subcmd'
56
+ name = File.basename(__FILE__, '.rb')
57
+
58
+ # # FIXME: DRY the below code
59
+ # dbgr, cmd = MockTrepan::setup('set')
60
+ # subcommand = Trepan::Subcommand::SetSp.new(cmd)
61
+ # testcmdMgr = Trepan::Subcmd.new(subcommand)
62
+
63
+ # def subcommand.msg(message)
64
+ # puts message
65
+ # end
66
+ # def subcommand.msg_nocr(message)
67
+ # print message
68
+ # end
69
+ # def subcommand.errmsg(message)
70
+ # puts message
71
+ # end
72
+ # subcommand.run(%w(20))
73
+ # name = File.basename(__FILE__, '.rb')
74
+ # subcommand.summary_help(name)
75
+ end
@@ -1,15 +1,15 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
+ # Copyright (C) 2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  require_relative '../base/subcmd'
4
4
 
5
5
  class Trepan::Subcommand::SetReload < Trepan::SetBoolSubcommand
6
- unless defined?(HELP)
7
- Trepanning::Subcommand.set_name_prefix(__FILE__, self)
8
- SHORT_HELP = "Set whether to reread source text when it changes."
9
- IN_LIST = true
10
- MIN_ABBREV = 're'.size
11
- HELP = <<-EOH
12
- #{CMD} {on|off}
6
+ unless defined?(HELP)
7
+ Trepanning::Subcommand.set_name_prefix(__FILE__, self)
8
+ SHORT_HELP = "Set whether to reread source text when it changes."
9
+ IN_LIST = true
10
+ MIN_ABBREV = 'rel'.size
11
+ HELP = <<-EOH
12
+ **#{CMD}** {**on**|**off**}
13
13
 
14
14
  Source text is cached on the first read. This ensures that if you
15
15
  change the source text after the debugged program is runnning you will
@@ -23,10 +23,12 @@ will reload the source code. So here the debugger will be out of sync.
23
23
  Set this to true, and the debugger will notice such changes and reread
24
24
  the source text when it discovers it has changed.
25
25
 
26
- See also "info source" and "info files" and note the SHA1
26
+ See also:
27
+ --------
28
+ `info source` and `info files` and note the SHA1
27
29
  and file modification time.
28
30
  EOH
29
- end
31
+ end
30
32
  end
31
33
 
32
34
  if __FILE__ == $0
@@ -1,12 +1,27 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
+ # Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  require_relative '../base/subcmd'
4
4
  require_relative '../../../app/frame'
5
5
 
6
6
  class Trepan::Subcommand::SetReturn < Trepan::Subcommand
7
7
  unless defined?(HELP)
8
8
  Trepanning::Subcommand.set_name_prefix(__FILE__, self)
9
- HELP = 'Set the value that will be returned in the current method'
9
+ HELP = <<-EOH
10
+ **#{PREFIX.join(' ')}** *expression*
11
+
12
+ Set return value to *expression*
13
+
14
+ There are currently a number of restrictions here. First, you have to
15
+ be at some sort of return event. Second, the opcode you are stopped at
16
+ has to be a `leave` instruction.
17
+
18
+ Warning: this is potentially dangerous.
19
+
20
+ See also:
21
+ ---------
22
+
23
+ `set register sp`, `info register sp`
24
+ EOH
10
25
  IN_LIST = true
11
26
  MIN_ABBREV = 'ret'.size
12
27
  end
@@ -14,52 +29,61 @@ class Trepan::Subcommand::SetReturn < Trepan::Subcommand
14
29
  include Trepan::Frame
15
30
 
16
31
  def run(args)
17
- event = @proc.event
18
- unless %w(return c-return).member?(event)
19
- errmsg('You need to be in a return event to do this. Event is %s' %
20
- event)
21
- return
22
- end
23
- if args.size < 3
24
- errmsg "Too few arguments - the 'return' command requires a return value"
25
- return
26
- end
27
- new_val_str = args[2..-1].join(' ')
28
- begin
29
- new_val = @proc.debug_eval(new_val_str)
30
- rescue StandardError, ScriptError => e
31
- p $!
32
- return
33
- end
34
- ret_val = Trepan::Frame.value_returned(@proc.frame, event)
35
- msg('Return value was: %s' % ret_val.inspect)
36
- Trepan::Frame.set_return_value(@proc.frame, event, new_val)
37
- msg('New value is: %s' % new_val.inspect)
32
+ event = @proc.event.to_s
33
+ unless %w(return c_return b_return).member?(event)
34
+ errmsg('You need to be in a return event to do this. Event is %s' %
35
+ event)
36
+ return
37
+ end
38
+ unless @proc.core.trace_point
39
+ msg('We need a trace-point to get this information')
40
+ return
41
+ end
42
+ if args.size < 3
43
+ errmsg "Too few arguments - the 'return' command requires a return value"
44
+ return
45
+ end
46
+ frame = @proc.frame
47
+ if %w(return b_return).member?(event)
48
+ index = 1
49
+ opname = frame.iseq.op_at(frame.pc_offset)
50
+ if opname != 'leave'
51
+ msg("Need to be at a 'leave' instruction; at %s instruction" %
52
+ opname)
53
+ return
54
+ end
55
+ else
56
+ # FIXME: Probably not quite right. Doesn't handle receiver methods
57
+ # would like to do via end of stack-1.
58
+ index = frame.argc + 3
59
+ msg("C functions not handled yet")
60
+ return
61
+ end
62
+ @proc.commands['set'].run(['set', 'register', 'sp', index.to_s, *args[2..-1]])
38
63
  end
39
-
40
64
  end
41
65
 
42
66
  if __FILE__ == $0
43
- # Demo it.
44
- require_relative '../../mock'
45
- require_relative '../../subcmd'
46
- name = File.basename(__FILE__, '.rb')
67
+ # Demo it.
68
+ require_relative '../../mock'
69
+ require_relative '../../subcmd'
70
+ name = File.basename(__FILE__, '.rb')
47
71
 
48
- # FIXME: DRY the below code
49
- dbgr, cmd = MockTrepan::setup('set')
50
- subcommand = Trepan::Subcommand::SetReturn.new(cmd)
51
- testcmdMgr = Trepan::Subcmd.new(subcommand)
72
+ # FIXME: DRY the below code
73
+ dbgr, cmd = MockDebugger::setup('set')
74
+ subcommand = Trepan::Subcommand::SetReturn.new(cmd)
75
+ testcmdMgr = Trepan::Subcmd.new(subcommand)
52
76
 
53
- def subcommand.msg(message)
54
- puts message
55
- end
56
- def subcommand.msg_nocr(message)
57
- print message
58
- end
59
- def subcommand.errmsg(message)
60
- puts message
61
- end
62
- subcommand.run(%w(20))
63
- name = File.basename(__FILE__, '.rb')
64
- subcommand.summary_help(name)
77
+ def subcommand.msg(message)
78
+ puts message
79
+ end
80
+ def subcommand.msg_nocr(message)
81
+ print message
82
+ end
83
+ def subcommand.errmsg(message)
84
+ puts message
85
+ end
86
+ subcommand.run(%w(20))
87
+ name = File.basename(__FILE__, '.rb')
88
+ subcommand.summary_help(name)
65
89
  end
@@ -87,7 +87,8 @@ Here then is a loop to query VM stack values:
87
87
 
88
88
  # And just when you thought, we'd never get around to
89
89
  # actually running irb...
90
- cont = IRB.start_session(@proc.frame.binding, @proc, conf)
90
+ bind = @proc.frame ? @proc.frame.binding : binding
91
+ cont = IRB.start_session(bind, @proc, conf)
91
92
  trap('SIGINT', save_trap) # Restore our old interrupt function.
92
93
 
93
94
  # Restore the debuggers' Readline history and the Readline completion
@@ -117,7 +118,7 @@ Here then is a loop to query VM stack values:
117
118
  when :step
118
119
  @proc.step # (1, {})
119
120
  else
120
- @proc.print_location
121
+ @proc.print_location if @proc.frame
121
122
  end
122
123
  ensure
123
124
  $trepan_in_irb = false
@@ -1,23 +1,26 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
+ # Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  require_relative '../base/subcmd'
4
4
 
5
5
  class Trepan::Subcommand::ShowDifferent < Trepan::ShowBoolSubcommand
6
- unless defined?(HELP)
7
- Trepanning::Subcommand.set_name_prefix(__FILE__, self)
8
- HELP = "Show status of 'set different'"
9
- MIN_ABBREV = 'dif'.size
10
- end
11
-
12
- def run(args)
13
- if 'nostack' == @proc.settings[:different]
14
- msg("different is nostack.")
15
- else
16
- super
6
+ unless defined?(HELP)
7
+ Trepanning::Subcommand.set_name_prefix(__FILE__, self)
8
+ HELP = "Show status of 'set different'"
9
+ MIN_ABBREV = 'dif'.size
17
10
  end
18
- end
19
-
20
11
 
12
+ def run(args)
13
+ case @proc.settings[:different]
14
+ when 'nostack'
15
+ msg("different is nostack.")
16
+ when 'off'
17
+ msg("different is off.")
18
+ when 'on'
19
+ msg("different is on.")
20
+ else
21
+ msg("Unknown value of different %s" % @proc.settings[:different].inspect)
22
+ end
23
+ end
21
24
  end
22
25
 
23
26
  if __FILE__ == $0
@@ -1,38 +1,38 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
2
+ # Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
3
  require_relative '../base/subcmd'
4
4
 
5
5
  class Trepan::Subcommand::ShowEvents < Trepan::Subcommand
6
- unless defined?(HELP)
7
- Trepanning::Subcommand.set_name_prefix(__FILE__, self)
8
- HELP = 'Show trace events we may stop on.'
9
- MIN_ABBREV = 'ev'.size
10
- end
6
+ unless defined?(HELP)
7
+ Trepanning::Subcommand.set_name_prefix(__FILE__, self)
8
+ HELP = 'Show trace events we may stop on.'
9
+ MIN_ABBREV = 'ev'.size
10
+ end
11
11
 
12
- # FIXME: this really should be a subcommand of "set trace"
13
- def run(args)
14
- step_events_list = @proc.core.step_events_list
15
- if step_events_list
16
- msg 'Trace events we may stop on:'
17
- msg "\t" + step_events_list
18
- else
19
- msg 'No events trapped.'
12
+ # FIXME: this really should be a subcommand of "set trace"
13
+ def run(args)
14
+ step_events_list = @proc.core.step_events_list
15
+ if step_events_list
16
+ section 'Trace events we may stop on:'
17
+ msg columnize_commands(step_events_list.sort)
18
+ else
19
+ msg 'No events trapped.'
20
+ end
20
21
  end
21
- end
22
22
 
23
23
  end
24
24
 
25
25
  if __FILE__ == $0
26
- # Demo it.
27
- require_relative '../../mock'
26
+ # Demo it.
27
+ require_relative '../../mock'
28
28
 
29
- # FIXME: DRY the below code
30
- dbgr, cmd = MockDebugger::setup('exit')
31
- subcommand = Trepan::Subcommand::ShowEvents.new(cmd)
32
- testcmdMgr = Trepan::Subcmd.new(subcommand)
29
+ # FIXME: DRY the below code
30
+ dbgr, cmd = MockDebugger::setup('exit')
31
+ subcommand = Trepan::Subcommand::ShowEvents.new(cmd)
32
+ testcmdMgr = Trepan::Subcmd.new(subcommand)
33
33
 
34
- name = File.basename(__FILE__, '.rb')
35
- subcommand.summary_help(name)
36
- puts
37
- subcommand.run([name])
34
+ name = File.basename(__FILE__, '.rb')
35
+ subcommand.summary_help(name)
36
+ puts
37
+ subcommand.run([name])
38
38
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2010-2011, 2013 Rocky Bernstein <rockyb@rubyforge.net>
1
+ # Copyright (C) 2010-2011, 2013, 2015 Rocky Bernstein <rockyb@rubyforge.net>
2
2
  require_relative '../app/default'
3
3
  require_relative 'virtual'
4
4
  class Trepan::CmdProcessor < Trepan::VirtualCmdProcessor
@@ -4,22 +4,21 @@ require_relative 'virtual'
4
4
  class Trepan
5
5
  class CmdProcessor < VirtualCmdProcessor
6
6
 
7
- def debug_eval(str, max_fake_filename=15,
8
- ruby_193_hack=false) #FIXME: remove ruby_193_hack
7
+ def debug_eval(str, max_fake_filename=15)
9
8
  begin
10
- debug_eval_with_exception(str, max_fake_filename, ruby_193_hack)
9
+ debug_eval_with_exception(str, max_fake_filename)
11
10
  rescue SyntaxError, StandardError, ScriptError => e
12
11
  exception_dump(e, @settings[:stack_trace_on_error], $!.backtrace)
13
12
  nil
14
13
  end
15
14
  end
16
15
 
17
- def debug_eval_with_exception(str, max_fake_filename=15,
18
- ruby_193_hack=false) # FIXME: remove ruby_193_hack
19
- RubyVM::Frame.current.trace_off = true if ruby_193_hack
20
- filename, b = get_binding_and_filename(str, max_fake_filename)
21
- RubyVM::Frame.current.trace_off = false if ruby_193_hack
22
- eval(str, b, filename)
16
+ def debug_eval_with_exception(str, max_fake_filename=15)
17
+ # FIXME: Do we need to set trace_off?
18
+ RubyVM::Frame.get.trace_off = true
19
+ filename, b = get_binding_and_filename(str, max_fake_filename)
20
+ RubyVM::Frame.get.trace_off = false
21
+ eval(str, b, filename)
23
22
  end
24
23
 
25
24
  def debug_eval_no_errmsg(str, max_fake_filename=15)
@@ -32,10 +31,10 @@ class Trepan
32
31
 
33
32
  def eval_code(str, max_fake_filename)
34
33
  obj = debug_eval(str, max_fake_filename)
35
-
34
+
36
35
  # idx = @user_variables
37
36
  # @user_variables += 1
38
-
37
+
39
38
  # str = "$d#{idx}"
40
39
  # Rubinius::Globals[str.to_sym] = obj
41
40
  # msg "#{str} = #{obj.inspect}"
@@ -53,7 +52,7 @@ class Trepan
53
52
  end
54
53
 
55
54
  def fake_eval_filename(str, maxlen = 15)
56
- fake_filename =
55
+ fake_filename =
57
56
  if maxlen < str.size
58
57
  # FIXME: Guard against \" in positions 13..15?
59
58
  str.inspect[0..maxlen-1] + '"...'
@@ -62,9 +61,9 @@ class Trepan
62
61
  end
63
62
  "(eval #{fake_filename})"
64
63
  end
65
-
64
+
66
65
  def get_binding_and_filename(str, maxlen)
67
- b =
66
+ b =
68
67
  begin
69
68
  @frame.binding
70
69
  rescue
@@ -89,7 +88,7 @@ if __FILE__ == $0
89
88
  def cmdp.msg(msg)
90
89
  puts "** #{msg}"
91
90
  end
92
- begin
91
+ begin
93
92
  1/0
94
93
  rescue Exception => exc
95
94
  cmdp.exception_dump(exc, true, $!.backtrace)