trepanning 1.93.35 → 2.15.33

Sign up to get free protection for your applications and to get access to all the features.
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,113 +1,115 @@
1
- # Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
1
+ # Copyright (C) 2010-2011, 2015 Rocky Bernstein <rockyb@rubyforge.net>
2
+ require 'rubyvm-frame'
2
3
  require_relative 'virtual'
3
4
  class Trepan
4
5
 
5
- class CmdProcessor < VirtualCmdProcessor
6
+ class CmdProcessor < VirtualCmdProcessor
6
7
 
7
- attr_reader :brkpts # BreakpointManager.
8
+ attr_reader :brkpts # BreakpointManager.
8
9
 
9
- attr_reader :brkpt # Breakpoint. If we are stopped at a
10
- # breakpoint this is the one we
11
- # found. (There may be other
12
- # breakpoints that would have caused a stop
13
- # as well; this is just one of them).
14
- # If no breakpoint stop this is nil.
10
+ attr_reader :brkpt # Breakpoint. If we are stopped at a
11
+ # breakpoint this is the one we
12
+ # found. (There may be other
13
+ # breakpoints that would have caused a stop
14
+ # as well; this is just one of them).
15
+ # If no breakpoint stop this is nil.
15
16
 
16
- def breakpoint_initialize
17
- @brkpts = BreakpointMgr.new
18
- @brkpt = nil
19
- end
17
+ def breakpoint_initialize
18
+ @brkpts = BreakpointMgr.new
19
+ @brkpt = nil
20
+ end
20
21
 
21
- def breakpoint_finalize
22
- @brkpts.finalize
23
- end
22
+ def breakpoint_finalize
23
+ @brkpts.finalize
24
+ end
24
25
 
25
- def breakpoint?
26
- @brkpt = @brkpts.find(@frame.iseq, @frame.pc_offset, @frame.binding)
27
- @brkpts.delete_by_brkpt(@brkpt) if @brkpt && @brkpt.temp?
28
- return !!@brkpt
29
- end
26
+ def breakpoint?
27
+ return nil unless @frame && @frame.iseq
28
+ @brkpt = @brkpts.find(@frame.iseq, @frame.pc_offset, @frame.binding)
29
+ @brkpts.delete_by_brkpt(@brkpt) if @brkpt && @brkpt.temp?
30
+ return !!@brkpt
31
+ end
30
32
 
31
- def breakpoint_find(bpnum, show_errmsg = true)
32
- if 0 == @brkpts.size
33
- errmsg('No breakpoints set.') if show_errmsg
34
- return nil
35
- elsif bpnum > @brkpts.max || bpnum < 1
36
- errmsg('Breakpoint number %d is out of range 1..%d' %
37
- [bpnum, @brkpts.max]) if show_errmsg
38
- return nil
39
- end
40
- bp = @brkpts[bpnum]
41
- if bp
42
- return bp
43
- else
44
- errmsg('Breakpoint number %d previously deleted.' %
45
- bpnum) if show_errmsg
46
- return nil
47
- end
48
- end
33
+ def breakpoint_find(bpnum, show_errmsg = true)
34
+ if 0 == @brkpts.size
35
+ errmsg('No breakpoints set.') if show_errmsg
36
+ return nil
37
+ elsif bpnum > @brkpts.max || bpnum < 1
38
+ errmsg('Breakpoint number %d is out of range 1..%d' %
39
+ [bpnum, @brkpts.max]) if show_errmsg
40
+ return nil
41
+ end
42
+ bp = @brkpts[bpnum]
43
+ if bp
44
+ return bp
45
+ else
46
+ errmsg('Breakpoint number %d previously deleted.' %
47
+ bpnum) if show_errmsg
48
+ return nil
49
+ end
50
+ end
49
51
 
50
- # Does whatever needs to be done to set a breakpoint
51
- def breakpoint_line(line_number, initial_iseq, temp=false)
52
- # FIXME: handle breakpoint conditions.
53
- found_iseq = initial_iseq.child_iseqs.detect do |iseq|
54
- iseq.lineoffsets.keys.member?(line_number)
55
- end
56
- unless found_iseq
57
- found_iseq = initial_iseq.parent
58
- while found_iseq do
59
- break if found_iseq.lineoffsets.keys.member?(line_number)
60
- found_iseq = found_iseq.parent
52
+ # Does whatever needs to be done to set a breakpoint
53
+ def breakpoint_line(line_number, initial_iseq, temp=false)
54
+ # FIXME: handle breakpoint conditions.
55
+ found_iseq = initial_iseq.child_iseqs.detect do |iseq|
56
+ iseq.lineoffsets.keys.member?(line_number)
57
+ end
58
+ unless found_iseq
59
+ found_iseq = initial_iseq.parent
60
+ while found_iseq do
61
+ break if found_iseq.lineoffsets.keys.member?(line_number)
62
+ found_iseq = found_iseq.parent
63
+ end
64
+ end
65
+ offset =
66
+ if found_iseq
67
+ # FIXME
68
+ found_iseq.line2offsets(line_number)[1] ||
69
+ found_iseq.line2offsets(line_number)[0]
70
+ else
71
+ nil
72
+ end
73
+ unless offset
74
+ place = "in #{iseq.source_container.join(' ')} " if found_iseq
75
+ errmsg("No line #{line_number} found #{place}for breakpoint.")
76
+ return nil
77
+ end
78
+ @brkpts.add(found_iseq, offset, :temp => temp)
61
79
  end
62
- end
63
- offset =
64
- if found_iseq
65
- # FIXME
66
- found_iseq.line2offsets(line_number)[1] ||
67
- found_iseq.line2offsets(line_number)[0]
68
- else
69
- nil
80
+
81
+ def breakpoint_offset(offset, iseq, condition, negate, temp=false)
82
+ # FIXME: handle breakpoint conditions.
83
+ unless iseq.offsetlines.keys.member?(offset)
84
+ errmsg("Offset #{offset} not found in #{iseq.label} for breakpoint.")
85
+ return nil
86
+ end
87
+ @brkpts.add(iseq, offset, :temp => temp, :condition => condition,
88
+ :negate => negate, :type => 'offset')
70
89
  end
71
- unless offset
72
- place = "in #{iseq.source_container.join(' ')} " if found_iseq
73
- errmsg("No line #{line_number} found #{place}for breakpoint.")
74
- return nil
75
- end
76
- @brkpts.add(found_iseq, offset, :temp => temp)
77
- end
78
90
 
79
- def breakpoint_offset(offset, iseq, condition, negate, temp=false)
80
- # FIXME: handle breakpoint conditions.
81
- unless iseq.offsetlines.keys.member?(offset)
82
- errmsg("Offset #{offset} not found in #{iseq.name} for breakpoint.")
83
- return nil
84
- end
85
- @brkpts.add(iseq, offset, :temp => temp, :condition => condition,
86
- :negate => negate, :type => 'offset')
87
- end
91
+ # Delete a breakpoint given its breakpoint number.
92
+ def delete_breakpoint_by_number(bpnum, do_enable=true)
93
+ bp = breakpoint_find(bpnum)
94
+ return false unless bp
88
95
 
89
- # Delete a breakpoint given its breakpoint number.
90
- def delete_breakpoint_by_number(bpnum, do_enable=true)
91
- bp = breakpoint_find(bpnum)
92
- return false unless bp
93
-
94
- @brkpts.delete_by_brkpt(bp)
95
- return true
96
- end
96
+ @brkpts.delete_by_brkpt(bp)
97
+ return true
98
+ end
99
+
100
+ # Enable or disable a breakpoint given its breakpoint number.
101
+ def en_disable_breakpoint_by_number(bpnum, do_enable=true)
102
+ bp = breakpoint_find(bpnum)
103
+ return false unless bp
97
104
 
98
- # Enable or disable a breakpoint given its breakpoint number.
99
- def en_disable_breakpoint_by_number(bpnum, do_enable=true)
100
- bp = breakpoint_find(bpnum)
101
- return false unless bp
102
-
103
- enable_disable = do_enable ? 'en' : 'dis'
104
- if bp.enabled? == do_enable
105
- errmsg('Breakpoint %d previously %sabled.' %
106
- [bpnum, enable_disable])
107
- return false
108
- end
109
- bp.enabled = do_enable
110
- return true
105
+ enable_disable = do_enable ? 'en' : 'dis'
106
+ if bp.enabled? == do_enable
107
+ errmsg('Breakpoint %d previously %sabled.' %
108
+ [bpnum, enable_disable])
109
+ return false
110
+ end
111
+ bp.enabled = do_enable
112
+ return true
113
+ end
111
114
  end
112
- end
113
115
  end
@@ -13,7 +13,7 @@ class Trepan::SubcommandMgr < Trepan::Command
13
13
  CATEGORY = 'status'
14
14
  MIN_ARGS = 0
15
15
  MAX_ARGS = nil
16
- NAME = '?' # FIXME: Need to define this, but should
16
+ NAME = '?' # FIXME: Need to define this, but should
17
17
  # pick this up from class/file name.
18
18
  NEED_STACK = false
19
19
  end
@@ -48,7 +48,7 @@ class Trepan::SubcommandMgr < Trepan::Command
48
48
  cmd_dir = File.dirname(__FILE__)
49
49
  subcmd_dir = File.join(cmd_dir, '..', name + '_subcmd')
50
50
  files = Dir.glob(File.join(subcmd_dir, '*.rb'))
51
- files.each do |rb|
51
+ files.each do |rb|
52
52
  basename = File.basename(rb, '.rb')
53
53
  if File.directory?(File.join(File.dirname(rb), basename + '_subcmd'))
54
54
  subcmd_names << name.capitalize + basename.capitalize
@@ -92,7 +92,7 @@ class Trepan::SubcommandMgr < Trepan::Command
92
92
  # help cmd subcmd
93
93
  # help cmd commands
94
94
  #
95
- # Our shtick is to give help for the overall command only if
95
+ # Our shtick is to give help for the overall command only if
96
96
  # subcommand or 'commands' is not given. If a subcommand is given and
97
97
  # found, then specific help for that is given. If 'commands' is given
98
98
  # we will list the all the subcommands.
@@ -103,8 +103,8 @@ class Trepan::SubcommandMgr < Trepan::Command
103
103
  if doc
104
104
  return doc
105
105
  else
106
- errmsg('Sorry - author mess up. ' +
107
- 'No help registered for command' +
106
+ errmsg('Sorry - author mess up. ' +
107
+ 'No help registered for command' +
108
108
  @name)
109
109
  return nil
110
110
  end
@@ -128,9 +128,9 @@ class Trepan::SubcommandMgr < Trepan::Command
128
128
  if doc
129
129
  return doc
130
130
  else
131
- errmsg('Sorry - author mess up. ' +
132
- 'No help registered for subcommand: ' +
133
- subcmd_name + ', of command: ' +
131
+ errmsg('Sorry - author mess up. ' +
132
+ 'No help registered for subcommand: ' +
133
+ subcmd_name + ', of command: ' +
134
134
  @name)
135
135
  return nil
136
136
  end
@@ -153,7 +153,7 @@ class Trepan::SubcommandMgr < Trepan::Command
153
153
 
154
154
  # Return an Array of subcommands that can start with +arg+. If none
155
155
  # found we just return +arg+.
156
- # FIXME: Not used any more?
156
+ # FIXME: Not used any more?
157
157
  def complete(prefix)
158
158
  Trepan::Complete.complete_token(@subcmds.subcmds.keys, prefix)
159
159
  end
@@ -30,51 +30,53 @@ See also:
30
30
  `condition`, `continue`, `help syntax location`, and `tbreak`
31
31
  HELP
32
32
 
33
- ALIASES = %w(b)
34
- CATEGORY = 'breakpoints'
35
- SHORT_HELP = 'Set a breakpoint'
33
+ ALIASES = %w(b)
34
+ CATEGORY = 'breakpoints'
35
+ SHORT_HELP = 'Set a breakpoint'
36
36
  end
37
37
 
38
- # This method runs the command
39
- def run(args, temp=false)
40
- # FIXME: handle more conditions
41
- # a line number
42
- if args.size == 1
43
- # usage is "break" which means break right here
44
- # FIXME: should handle condition
45
- bp = @proc.breakpoint_offset(@proc.frame.pc_offset,
46
- @proc.frame.iseq, 'true', false)
47
- else
48
- iseq, line_number, vm_offset, condition, negate =
49
- @proc.breakpoint_position(@proc.cmd_argstr, true)
50
- return false unless iseq && vm_offset
51
- bp = @proc.breakpoint_offset(vm_offset, iseq, condition, negate, temp)
52
- end
53
- if bp
54
- bp.condition = condition
38
+ # This method runs the command
39
+ def run(args, temp=false)
40
+ # FIXME: handle more conditions
41
+ # a line number
42
+ if args.size == 1
43
+ # usage is "break" which means break right here
44
+ # FIXME: should handle condition
45
+ frame = @proc.frame
46
+ iseq = frame.iseq
47
+ start_insn = iseq.start_insn(frame.pc_offset)
48
+ bp = @proc.breakpoint_offset(start_insn, iseq, 'true', false)
49
+ else
50
+ iseq, line_number, vm_offset, condition, negate =
51
+ @proc.breakpoint_position(@proc.cmd_argstr, true)
52
+ return false unless iseq && vm_offset
53
+ bp = @proc.breakpoint_offset(vm_offset, iseq, condition, negate, temp)
54
+ end
55
+ if bp
56
+ bp.condition = condition
55
57
 
56
- if temp
57
- mess = "Temporary breakpoint %d set at " % bp.id
58
- else
59
- mess = "Breakpoint %d set at " % bp.id
60
- end
58
+ if temp
59
+ mess = "Temporary breakpoint %d set at " % bp.id
60
+ else
61
+ mess = "Breakpoint %d set at " % bp.id
62
+ end
61
63
 
62
- line_loc = "line %s in %s" %
63
- [bp.source_location.join(', '),
64
- @proc.canonic_container(bp.iseq.source_container).join(' ')]
64
+ line_loc = "line %s in %s" %
65
+ [bp.source_location.join(', '),
66
+ @proc.canonic_container(bp.iseq.source_container).join(' ')]
65
67
 
66
- vm_loc = "VM offset %d of instruction sequence \"%s\"" %
67
- [bp.offset, bp.iseq.name]
68
+ vm_loc = "VM offset %d of instruction sequence \"%s\"" %
69
+ [bp.offset, bp.iseq.label]
68
70
 
69
- loc, other_loc =
70
- if 'line' == bp.type
71
- [line_loc, vm_loc]
72
- else # 'offset' == bp.type
73
- [vm_loc, line_loc]
71
+ loc, other_loc =
72
+ if 'line' == bp.type
73
+ [line_loc, vm_loc]
74
+ else # 'offset' == bp.type
75
+ [vm_loc, line_loc]
76
+ end
77
+ msg(mess + loc + ",\n\t" + other_loc + ".")
74
78
  end
75
- msg(mess + loc + ",\n\t" + other_loc + ".")
76
79
  end
77
- end
78
80
  end
79
81
 
80
82
  if __FILE__ == $0
@@ -89,7 +91,7 @@ if __FILE__ == $0
89
91
  run_cmd(cmd, [cmd.name])
90
92
  run_cmd(cmd, [cmd.name, __LINE__.to_s])
91
93
  require 'thread_frame'
92
- tf = RubyVM::Frame.current
94
+ tf = RubyVM::Frame.get
93
95
  pc_offset = tf.pc_offset
94
96
  run_cmd(cmd, [cmd.name, "@#{pc_offset}"])
95
97
  def foo
@@ -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_relative '../command'
3
3
  require_relative '../running'
4
4
  require_relative '../../app/breakpoint' # FIXME: possibly temporary
@@ -7,24 +7,29 @@ class Trepan::Command::ContinueCommand < Trepan::Command
7
7
  unless defined?(HELP)
8
8
  NAME = File.basename(__FILE__, '.rb')
9
9
  HELP = <<-HELP
10
- #{NAME} [LOCATION]
10
+ **#{NAME}** [*location*]
11
11
 
12
12
  Leave the debugger loop and continue execution. Subsequent entry to
13
13
  the debugger however may occur via breakpoints or explicit calls, or
14
14
  exceptions.
15
15
 
16
16
  If a parameter is given, a temporary breakpoint is set at that position
17
- before continuing. Offset are numbers prefixed with an "O" otherwise
17
+ before continuing. Offset are numbers prefixed with an "O"; otherwise
18
18
  the parameter is taken as a line number.
19
19
 
20
20
  Examples:
21
- #{NAME}
22
- #{NAME} 10 # continue to line 10
23
- #{NAME} o20 # continue to VM Instruction Sequence offset 20
24
- #{NAME} gcd # continue to first instruction of method gcd
25
- #{NAME} IRB.start o7 # continue to IRB.start offset 7
21
+ ---------
26
22
 
27
- See also 'step', 'next', 'finish', 'nexti' commands and "help location".
23
+ #{NAME}
24
+ #{NAME} 10 # continue to line 10
25
+ #{NAME} o20 # continue to VM Instruction Sequence offset 20
26
+ #{NAME} gcd # continue to first instruction of method gcd
27
+ #{NAME} IRB.start o7 # continue to IRB.start offset 7
28
+
29
+ See also:
30
+ ---------
31
+
32
+ `step`, `next`, `finish`, `nexti` `help syntax location`.
28
33
  HELP
29
34
 
30
35
  ALIASES = %w(c cont)
@@ -40,7 +45,7 @@ See also 'step', 'next', 'finish', 'nexti' commands and "help location".
40
45
  # Form is: "continue"
41
46
  @proc.continue
42
47
  else
43
- iseq, line_number, vm_offset, condition, negate =
48
+ iseq, line_number, vm_offset, condition, negate =
44
49
  @proc.breakpoint_position(@proc.cmd_argstr, false)
45
50
  return false unless iseq && vm_offset
46
51
  bp = @proc.breakpoint_offset(vm_offset, iseq, condition, negate, true)
@@ -1,6 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Copyright (C) 2010, 2012, 2015 Rocky Bernstein <rockyb@rubyforge.net>
3
- require 'thread_frame'
4
3
  require_relative '../command'
5
4
 
6
5
  class Trepan::Command::DebugCommand < Trepan::Command
@@ -27,46 +26,28 @@ Enter the debugger recursively on *ruby-code*.
27
26
  arg_str = args[1..-1].join(' ')
28
27
  hidelevels = @proc.hidelevels[th]
29
28
 
30
- stack_diff = RubyVM::Frame.current.stack_size - frame.stack_size
31
-
32
- # Ignore tracing in support routines:
33
- # FIXME remvoe 1.9.3 hack
34
- if '1.9.3' != RUBY_VERSION
35
- tf = @proc.dbgr.trace_filter
36
- [self.method(:run), @proc.method(:debug_eval),
37
- @proc.method(:debug_eval_with_exception),
38
- @proc.method(:get_binding_and_filename),
39
- @proc.method(:fake_eval_filename)].each do |m|
40
- tf << m unless tf.member?(m)
41
- end
42
- end
29
+ stack_diff = RubyVM::Frame.stack_size - frame.stack_size
43
30
 
44
31
  @proc.hidelevels[th] += stack_diff + EXTRA_DEBUG_SETUP_CALLS
45
32
 
46
33
  # Values we need to save before munging them
47
- old_tracing = th.tracing?
48
- old_exec_event_tracing = th.exec_event_tracing?
49
34
  old_mutex = @proc.core.mutex
50
35
  old_next_level = @proc.next_level
51
36
  old_step_count = @proc.core.step_count
52
37
 
53
- section 'ENTERING NESTED DEBUGGER'
54
38
 
55
39
  # Things we need to do to allow entering the debugger again
56
40
  @proc.debug_nest += 1
57
41
  @proc.core.mutex = Mutex.new
58
- th.tracing = false
59
- th.exec_event_tracing = false
60
42
  @proc.next_level = 32000
61
43
 
62
- RubyVM::Frame.current.trace_off = false
63
44
  @proc.core.step_count = 0
64
- retval = @proc.debug_eval(arg_str, 15,
65
- RUBY_VERSION == '1.9.3') # FIXME
45
+ section 'ENTERING NESTED DEBUGGER'
46
+ old_trace_arg = RubyVM::TraceArg.save
47
+ retval = @proc.debug_eval(arg_str, 15)
66
48
 
67
49
  # Restore munged values
68
- th.exec_event_tracing = old_exec_event_tracing
69
- th.tracing = old_tracing
50
+ RubyVM::TraceArg.restore(old_trace_arg)
70
51
  @proc.core.mutex = old_mutex
71
52
  @proc.frame_setup(frame)
72
53
  @proc.hidelevels[th] = hidelevels
@@ -83,6 +64,6 @@ if __FILE__ == $0
83
64
  require_relative '../mock'
84
65
  dbgr, cmd = MockDebugger::setup
85
66
  cmd.proc.hidelevels[Thread.current] = 0
86
- cmd.proc.frame_setup(RubyVM::Frame::current)
67
+ cmd.proc.frame_setup(RubyVM::Frame.get)
87
68
  cmd.run([cmd.name, 'x = 1; y = 2'])
88
69
  end