trepanning 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +214 -0
- data/NEWS +12 -0
- data/README.textile +1 -7
- data/Rakefile +13 -0
- data/app/default.rb +5 -4
- data/app/disassemble.rb +25 -3
- data/app/run.rb +0 -18
- data/bin/trepan +4 -6
- data/data/irbrc +3 -17
- data/io/base_io.rb +3 -1
- data/io/null_output.rb +41 -0
- data/lib/trepanning.rb +10 -13
- data/processor/command/backtrace.rb +7 -6
- data/processor/command/base/subcmd.rb +4 -0
- data/processor/command/base/submgr.rb +1 -1
- data/processor/command/base/subsubmgr.rb +1 -1
- data/processor/command/break.rb +12 -4
- data/processor/command/continue.rb +2 -2
- data/processor/command/delete.rb +1 -1
- data/processor/command/disable.rb +1 -1
- data/processor/command/disassemble.rb +1 -1
- data/processor/command/finish.rb +3 -3
- data/processor/command/info_subcmd/iseq.rb +9 -0
- data/processor/command/info_subcmd/registers_subcmd/dfp.rb +7 -16
- data/processor/command/info_subcmd/registers_subcmd/lfp.rb +5 -17
- data/processor/command/info_subcmd/registers_subcmd/pc.rb +6 -19
- data/processor/command/info_subcmd/registers_subcmd/sp.rb +14 -24
- data/processor/command/list.rb +34 -19
- data/processor/command/reload.rb +1 -1
- data/processor/command/restart.rb +8 -9
- data/processor/command/set_subcmd/auto.rb +1 -2
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +6 -19
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +7 -23
- data/processor/command/set_subcmd/auto_subcmd/list.rb +5 -22
- data/processor/command/set_subcmd/basename.rb +6 -20
- data/processor/command/set_subcmd/debug.rb +1 -1
- data/processor/command/set_subcmd/debug_subcmd/dbgr.rb +9 -22
- data/processor/command/set_subcmd/debug_subcmd/except.rb +8 -20
- data/processor/command/set_subcmd/debug_subcmd/macro.rb +7 -19
- data/processor/command/set_subcmd/debug_subcmd/skip.rb +5 -18
- data/processor/command/set_subcmd/debug_subcmd/stack.rb +5 -18
- data/processor/command/set_subcmd/hidelevel.rb +60 -0
- data/processor/command/set_subcmd/max.rb +1 -1
- data/processor/command/set_subcmd/max_subcmd/list.rb +12 -23
- data/processor/command/set_subcmd/max_subcmd/stack.rb +8 -31
- data/processor/command/set_subcmd/substitute.rb +1 -1
- data/processor/command/set_subcmd/substitute_subcmd/eval.rb +1 -1
- data/processor/command/set_subcmd/substitute_subcmd/path.rb +1 -1
- data/processor/command/set_subcmd/substitute_subcmd/string.rb +6 -18
- data/processor/command/set_subcmd/timer.rb +1 -1
- data/processor/command/set_subcmd/trace.rb +1 -1
- data/processor/command/set_subcmd/trace_subcmd/buffer.rb +1 -1
- data/processor/command/set_subcmd/trace_subcmd/print.rb +5 -21
- data/processor/command/set_subcmd/trace_subcmd/var.rb +1 -1
- data/processor/command/show_subcmd/args.rb +9 -27
- data/processor/command/show_subcmd/auto_subcmd/eval.rb +3 -15
- data/processor/command/show_subcmd/auto_subcmd/irb.rb +3 -15
- data/processor/command/show_subcmd/auto_subcmd/list.rb +3 -18
- data/processor/command/show_subcmd/basename.rb +3 -1
- data/processor/command/show_subcmd/hidelevel.rb +41 -0
- data/processor/command/show_subcmd/max.rb +1 -1
- data/processor/command/show_subcmd/trace_subcmd/buffer.rb +1 -1
- data/processor/command/show_subcmd/trace_subcmd/print.rb +1 -1
- data/processor/command/source.rb +6 -5
- data/processor/command/undisplay.rb +0 -1
- data/processor/default.rb +6 -2
- data/processor/frame.rb +2 -21
- data/processor/location.rb +44 -18
- data/processor/main.rb +0 -11
- data/processor/mock.rb +25 -0
- data/processor/validate.rb +34 -18
- data/test/functional/fn_helper.rb +14 -4
- data/test/functional/test-break.rb +35 -73
- data/test/functional/test-condition.rb +9 -10
- data/test/functional/test-delete.rb +5 -3
- data/test/unit/test-app-disassemble.rb +15 -3
- data/test/unit/test-app-run.rb +0 -4
- data/test/unit/test-cmd-break.rb +3 -0
- metadata +15 -11
data/ChangeLog
CHANGED
@@ -1,3 +1,217 @@
|
|
1
|
+
2010-12-10 rocky <rockyb@rubyforge.org>
|
2
|
+
|
3
|
+
* .gemspec, lib/trepanning.rb: Giant Madagascar Day release
|
4
|
+
|
5
|
+
2010-12-05 rocky <rockyb@rubyforge.org>
|
6
|
+
|
7
|
+
* processor/location.rb, test/functional/fn_helper.rb: Add IP in
|
8
|
+
source location line.
|
9
|
+
|
10
|
+
2010-12-05 rocky <rockyb@rubyforge.org>
|
11
|
+
|
12
|
+
* processor/command/show_subcmd/basename.rb: Add missing contstants
|
13
|
+
and DRY standalong code.
|
14
|
+
|
15
|
+
2010-12-05 rocky <rockyb@rubyforge.org>
|
16
|
+
|
17
|
+
* processor/command/base/subcmd.rb,
|
18
|
+
processor/command/set_subcmd/basename.rb,
|
19
|
+
processor/command/set_subcmd/hidelevel.rb,
|
20
|
+
processor/command/set_subcmd/max_subcmd/list.rb,
|
21
|
+
processor/command/set_subcmd/max_subcmd/stack.rb: DRY standalone
|
22
|
+
code a little more via subcmd#prefix.
|
23
|
+
|
24
|
+
2010-12-04 rocky <rockyb@rubyforge.org>
|
25
|
+
|
26
|
+
* app/disassemble.rb, processor/command/break.rb,
|
27
|
+
processor/location.rb, processor/main.rb, processor/validate.rb,
|
28
|
+
test/unit/test-cmd-break.rb: Can handle: break METHOD NUM now.
|
29
|
+
|
30
|
+
2010-12-04 rocky <rockyb@rubyforge.org>
|
31
|
+
|
32
|
+
* app/disassemble.rb, processor/command/backtrace.rb,
|
33
|
+
processor/command/break.rb, processor/command/disassemble.rb,
|
34
|
+
processor/location.rb, test/unit/test-app-disassemble.rb: If we
|
35
|
+
can't find source text, show disassembly output. Idea from rubinius.
|
36
|
+
Attempt to shorten disassembly output if larger than max width.
|
37
|
+
|
38
|
+
2010-12-01 rocky <rockyb@rubyforge.org>
|
39
|
+
|
40
|
+
* lib/trepanning.rb: block.call works if trace stops ignoring
|
41
|
+
blocks.
|
42
|
+
|
43
|
+
2010-11-30 rocky <rockyb@rubyforge.org>
|
44
|
+
|
45
|
+
* lib/trepanning.rb: Add Kernel.debugger to be compatible with
|
46
|
+
ruby-debug.
|
47
|
+
|
48
|
+
2010-11-28 rocky <rockyb@rubyforge.org>
|
49
|
+
|
50
|
+
* lib/trepanning.rb, processor/command/set_subcmd/basename.rb,
|
51
|
+
processor/command/set_subcmd/hidelevel.rb, processor/mock.rb:
|
52
|
+
Hidelevel default was wrong. Changing settings changes frame adjust
|
53
|
+
values immediately. Start to DRY some stand-alone subcommands.
|
54
|
+
|
55
|
+
2010-11-28 rocky <rockyb@rubyforge.org>
|
56
|
+
|
57
|
+
* lib/trepanning.rb, processor/command/base/submgr.rb,
|
58
|
+
processor/command/base/subsubmgr.rb, processor/command/delete.rb,
|
59
|
+
processor/command/disable.rb,
|
60
|
+
processor/command/info_subcmd/registers_subcmd/pc.rb,
|
61
|
+
processor/command/info_subcmd/registers_subcmd/sp.rb,
|
62
|
+
processor/command/reload.rb, processor/command/set_subcmd/auto.rb,
|
63
|
+
processor/command/set_subcmd/basename.rb,
|
64
|
+
processor/command/set_subcmd/debug.rb,
|
65
|
+
processor/command/set_subcmd/max.rb,
|
66
|
+
processor/command/set_subcmd/max_subcmd/list.rb,
|
67
|
+
processor/command/set_subcmd/max_subcmd/stack.rb,
|
68
|
+
processor/command/set_subcmd/substitute.rb,
|
69
|
+
processor/command/set_subcmd/substitute_subcmd/eval.rb,
|
70
|
+
processor/command/set_subcmd/substitute_subcmd/path.rb,
|
71
|
+
processor/command/set_subcmd/timer.rb,
|
72
|
+
processor/command/set_subcmd/trace.rb,
|
73
|
+
processor/command/set_subcmd/trace_subcmd/buffer.rb,
|
74
|
+
processor/command/set_subcmd/trace_subcmd/var.rb,
|
75
|
+
processor/command/show_subcmd/hidelevel.rb,
|
76
|
+
processor/command/show_subcmd/max.rb,
|
77
|
+
processor/command/show_subcmd/trace_subcmd/buffer.rb,
|
78
|
+
processor/command/show_subcmd/trace_subcmd/print.rb,
|
79
|
+
processor/command/undisplay.rb, processor/mock.rb,
|
80
|
+
processor/validate.rb: DRY code more. Remove set_restart => true
|
81
|
+
|
82
|
+
2010-11-28 rocky <rockyb@rubyforge.org>
|
83
|
+
|
84
|
+
* processor/command/info_subcmd/iseq.rb: Show instruction sequence
|
85
|
+
options and source string.
|
86
|
+
|
87
|
+
2010-11-28 rocky <rockyb@rubyforge.org>
|
88
|
+
|
89
|
+
Merge branch 'master' of github.com:rocky/rb-trepanning
|
90
|
+
|
91
|
+
2010-11-28 rocky <rockyb@rubyforge.org>
|
92
|
+
|
93
|
+
* Rakefile, processor/command/info_subcmd/registers_subcmd/dfp.rb,
|
94
|
+
processor/command/info_subcmd/registers_subcmd/lfp.rb,
|
95
|
+
processor/command/info_subcmd/registers_subcmd/sp.rb,
|
96
|
+
processor/command/list.rb,
|
97
|
+
processor/command/set_subcmd/auto_subcmd/eval.rb,
|
98
|
+
processor/command/set_subcmd/auto_subcmd/irb.rb,
|
99
|
+
processor/command/set_subcmd/auto_subcmd/list.rb,
|
100
|
+
processor/command/set_subcmd/debug_subcmd/dbgr.rb,
|
101
|
+
processor/command/set_subcmd/debug_subcmd/except.rb,
|
102
|
+
processor/command/set_subcmd/debug_subcmd/macro.rb,
|
103
|
+
processor/command/set_subcmd/debug_subcmd/skip.rb,
|
104
|
+
processor/command/set_subcmd/debug_subcmd/stack.rb,
|
105
|
+
processor/command/set_subcmd/substitute_subcmd/string.rb,
|
106
|
+
processor/command/set_subcmd/trace_subcmd/print.rb,
|
107
|
+
processor/command/show_subcmd/auto_subcmd/eval.rb,
|
108
|
+
processor/command/show_subcmd/auto_subcmd/irb.rb,
|
109
|
+
processor/command/show_subcmd/auto_subcmd/list.rb,
|
110
|
+
processor/mock.rb: Start to DRY standalone-code.
|
111
|
+
|
112
|
+
2010-11-26 rocky <rockyb@rubyforge.org>
|
113
|
+
|
114
|
+
* processor/frame.rb, processor/location.rb: Lean more on linecache
|
115
|
+
for eval string iseq remapping. Still more work is needed.
|
116
|
+
|
117
|
+
2010-11-25 rvm <rocky@gnu.org>
|
118
|
+
|
119
|
+
* .gemspec, lib/trepanning.rb: version name .git -> .dev. Allow Ruby
|
120
|
+
version 1.9.2frame
|
121
|
+
|
122
|
+
2010-11-13 rocky <rockyb@rubyforge.org>
|
123
|
+
|
124
|
+
Merge branch 'master' of github.com:rocky/rb-trepanning
|
125
|
+
|
126
|
+
2010-11-13 rocky <rockyb@rubyforge.org>
|
127
|
+
|
128
|
+
* io/base_io.rb, io/null_output.rb, processor/command/continue.rb,
|
129
|
+
processor/command/set_subcmd/auto.rb, processor/command/source.rb,
|
130
|
+
processor/default.rb, processor/frame.rb, processor/location.rb,
|
131
|
+
processor/validate.rb: "source -q" silences all prompt and debugger
|
132
|
+
messages now. Fix bugs in output.eof auto.rb: remove
|
133
|
+
no-longer-needed assignment
|
134
|
+
|
135
|
+
2010-11-12 rocky <rockyb@rubyforge.org>
|
136
|
+
|
137
|
+
* README.textile: Don't need set_restart any more.
|
138
|
+
|
139
|
+
2010-11-12 rocky <rockyb@rubyforge.org>
|
140
|
+
|
141
|
+
* .gemspec, app/default.rb, app/run.rb, bin/trepan,
|
142
|
+
processor/command/restart.rb,
|
143
|
+
processor/command/show_subcmd/args.rb, processor/location.rb,
|
144
|
+
test/unit/test-app-run.rb: Greatly simplify restart code and is more
|
145
|
+
reliable -- via new patch to 1.9.2. Thanks to Evan Phoenix for
|
146
|
+
suggesting and doing in Rubinius. .gemspec: need to make sure we
|
147
|
+
have a later Ruby 1.9.2 patch
|
148
|
+
|
149
|
+
2010-11-09 rocky <rockyb@rubyforge.org>
|
150
|
+
|
151
|
+
* data/irbrc: Monkey patch irb more properly.
|
152
|
+
|
153
|
+
2010-11-09 rocky <rockyb@rubyforge.org>
|
154
|
+
|
155
|
+
* processor/command/finish.rb, processor/command/list.rb,
|
156
|
+
processor/frame.rb: Fix "list . NUM". finish.rb: fix doc string
|
157
|
+
|
158
|
+
2010-11-08 rocky <rockyb@rubyforge.org>
|
159
|
+
|
160
|
+
Merge branch 'master' of github.com:rocky/rb-trepanning
|
161
|
+
|
162
|
+
2010-11-08 rocky <rockyb@rubyforge.org>
|
163
|
+
|
164
|
+
* test/functional/fn_helper.rb, test/functional/test-break.rb,
|
165
|
+
test/functional/test-condition.rb, test/functional/test-delete.rb:
|
166
|
+
list.rb: handle "list . count" and "list start end". Sync with
|
167
|
+
rbx-trepanning.
|
168
|
+
|
169
|
+
2010-11-04 rocky <rockyb@rubyforge.org>
|
170
|
+
|
171
|
+
* lib/trepanning.rb, processor/command/backtrace.rb,
|
172
|
+
processor/command/set_subcmd/hidelevel.rb,
|
173
|
+
processor/command/show_subcmd/hidelevel.rb, processor/default.rb:
|
174
|
+
Replace "set/show debugstack" with more general "set/show hidestack"
|
175
|
+
|
176
|
+
|
177
|
+
2010-10-27 rocky <rockyb@rubyforge.org>
|
178
|
+
|
179
|
+
* NEWS, lib/trepanning.rb: Some small omissions.
|
180
|
+
|
181
|
+
2010-10-27 rocky <rockyb@rubyforge.org>
|
182
|
+
|
183
|
+
* .gemspec, lib/trepanning.rb: Dependency on threadframe should be
|
184
|
+
0.33 or greater.
|
185
|
+
|
186
|
+
2010-10-27 rocky <rockyb@rubyforge.org>
|
187
|
+
|
188
|
+
* lib/trepanning.rb: Update version number for release.
|
189
|
+
|
190
|
+
2010-10-27 rocky <rockyb@rubyforge.org>
|
191
|
+
|
192
|
+
* .gemspec, NEWS, Rakefile: Get ready for release.
|
193
|
+
|
194
|
+
2010-10-21 rocky <rockyb@rubyforge.org>
|
195
|
+
|
196
|
+
Merge branch 'master' of github.com:rocky/rb-trepanning
|
197
|
+
|
198
|
+
2010-10-20 rocky <rockyb@rubyforge.org>
|
199
|
+
|
200
|
+
* processor/validate.rb: Comment typo.
|
201
|
+
|
202
|
+
2010-10-20 rocky <rockyb@rubyforge.org>
|
203
|
+
|
204
|
+
* app/util.rb, test/unit/test-app-util.rb: Elision of long strings
|
205
|
+
is now in middle of string rather than the end.
|
206
|
+
|
207
|
+
2010-10-19 rocky <rockyb@rubyforge.org>
|
208
|
+
|
209
|
+
* processor/frame.rb: Some more RDoc appeasement.
|
210
|
+
|
211
|
+
2010-10-19 rocky <rockyb@rubyforge.org>
|
212
|
+
|
213
|
+
* ChangeLog, NEWS, processor/command/finish.rb: What's up
|
214
|
+
|
1
215
|
2010-10-19 rocky <rockyb@rubyforge.org>
|
2
216
|
|
3
217
|
Merge branch 'master' of github.com:rocky/rb-trepanning
|
data/NEWS
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
Dec 10, 2010 (0.0.8) Phel. Mad release
|
2
|
+
* Show IP in source location
|
3
|
+
* Can handle: break *method" *pos* now
|
4
|
+
* Add Kernel#debugger to be compatible with ruby-debug
|
5
|
+
* debugger { code here } work better
|
6
|
+
* source -q silences all prompt and debugger messages
|
7
|
+
* Show instruction-sequence options on demand
|
8
|
+
* Nuke debugger set_restart => true. We now have a more reliable way to
|
9
|
+
do this. Rubinius showing the way here.
|
10
|
+
* Improvements to the "list" command.
|
11
|
+
* Get/show eval string using rb-threadframe patch
|
12
|
+
|
1
13
|
Oct 27, 2010 (0.0.6)
|
2
14
|
|
3
15
|
* Add gdb directory command - this time for sure!
|
data/README.textile
CHANGED
@@ -32,15 +32,9 @@ bc. require 'trepan'
|
|
32
32
|
Trepan.debug # Don't stop here...
|
33
33
|
work # but stop here.
|
34
34
|
|
35
|
-
or if you haven't mucked around with $0 and ARGV, you might try:
|
36
|
-
|
37
|
-
bc. Trepan.debug(:set_restart=>true)
|
38
|
-
|
39
|
-
which informs the debugger on how to restart the program (via the restart command) using the values of ARGV and $0 at the time Trepan.debug was called.
|
40
|
-
|
41
35
|
The above is really shorthand for something like:
|
42
36
|
|
43
|
-
bc. $trepan = Trepan.new
|
37
|
+
bc. $trepan = Trepan.new
|
44
38
|
$trepan.debugger
|
45
39
|
|
46
40
|
The global variable $trepan set holds debugger settings, such as "autolist" or "autoeval" settings and breakpoint information.
|
data/Rakefile
CHANGED
@@ -43,6 +43,13 @@ require 'rbconfig'
|
|
43
43
|
RUBY_PATH = File.join(RbConfig::CONFIG['bindir'],
|
44
44
|
RbConfig::CONFIG['RUBY_INSTALL_NAME'])
|
45
45
|
|
46
|
+
def run_standalone_ruby_files(list)
|
47
|
+
puts '*' * 40
|
48
|
+
list.each do |ruby_file|
|
49
|
+
system(RUBY_PATH, ruby_file)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
46
53
|
def run_standalone_ruby_file(directory)
|
47
54
|
puts ('*' * 10) + ' ' + directory + ' ' + ('*' * 10)
|
48
55
|
Dir.chdir(directory) do
|
@@ -102,6 +109,12 @@ task :'check:commands' do
|
|
102
109
|
run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} processor command)))
|
103
110
|
end
|
104
111
|
|
112
|
+
desc "Run each of the sub-sub commands in standalone mode."
|
113
|
+
task :'check:subsub:commands' do
|
114
|
+
subsub_files = FileList["#{ROOT_DIR}/processor/command/*_subcmd/*_subcmd/*.rb"]
|
115
|
+
run_standalone_ruby_files(subsub_files)
|
116
|
+
end
|
117
|
+
|
105
118
|
desc "Run each processor Ruby file in standalone mode."
|
106
119
|
task :'check:lib' do
|
107
120
|
run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} lib)))
|
data/app/default.rb
CHANGED
@@ -12,16 +12,17 @@ module Trepanning
|
|
12
12
|
:cmdproc_opts => {}, # Default Trepan::CmdProcessor settings
|
13
13
|
:core_opts => {}, # Default Trepan::Core settings
|
14
14
|
:delete_restore => true, # Delete restore profile after reading?
|
15
|
-
:initial_dir => nil, #
|
16
|
-
:nx => false, # Don't run user startup file (e.g. .
|
17
|
-
:restart_argv =>
|
15
|
+
:initial_dir => nil, # If --cd option was given, we save it here.
|
16
|
+
:nx => false, # Don't run user startup file (e.g. .trepanrc)
|
17
|
+
:restart_argv => RubyVM::OS_ARGV,
|
18
|
+
# Command run when "restart" is given.
|
18
19
|
:restore_profile => nil # Profile used to set/restore debugger state
|
19
20
|
} unless defined?(DEFAULT_SETTINGS)
|
20
21
|
|
21
22
|
# Default settings for Trepan run from the command line.
|
22
23
|
DEFAULT_CMDLINE_SETTINGS = {
|
23
24
|
:cmdfiles => [], # Initialization command files to run
|
24
|
-
:nx => false, # Don't run user startup file (e.g. .
|
25
|
+
:nx => false, # Don't run user startup file (e.g. .trepanrc)
|
25
26
|
:output => nil,
|
26
27
|
} unless defined?(DEFAULT_CMDLINE_SETTINGS)
|
27
28
|
|
data/app/disassemble.rb
CHANGED
@@ -7,9 +7,19 @@
|
|
7
7
|
class Trepan
|
8
8
|
module Disassemble
|
9
9
|
def mark_disassembly(disassembly_str, iseq_equal, pc_offset,
|
10
|
-
brkpt_offsets=[])
|
10
|
+
brkpt_offsets=[], max_width=80)
|
11
11
|
dis_array = disassembly_str.split(/\n/)
|
12
12
|
dis_array.map do |line|
|
13
|
+
if line =~ /^(.*?)(\s+)(\(\s+\d+\))?$/
|
14
|
+
line_begin = $1
|
15
|
+
line_padding = $2
|
16
|
+
line_end = $3 || ''
|
17
|
+
else
|
18
|
+
line_begin = line
|
19
|
+
line_padding = ''
|
20
|
+
line_end = ''
|
21
|
+
end
|
22
|
+
|
13
23
|
prefix =
|
14
24
|
if line =~ /^(\d{4}) /
|
15
25
|
offset = $1.to_i
|
@@ -22,7 +32,12 @@ class Trepan
|
|
22
32
|
else
|
23
33
|
''
|
24
34
|
end
|
25
|
-
prefix + line
|
35
|
+
line_size = prefix.size + line.size
|
36
|
+
shrink_amount = line_size - max_width
|
37
|
+
if (shrink_amount > 0) && line_padding.size > shrink_amount
|
38
|
+
line_padding = ' ' * (line_padding.size - shrink_amount)
|
39
|
+
end
|
40
|
+
prefix + line_begin + line_padding + line_end
|
26
41
|
end
|
27
42
|
end
|
28
43
|
module_function :mark_disassembly
|
@@ -55,7 +70,14 @@ local table (size: 6, argc: 1 [opts: 0, rest: -1, post: 0, block: -1] s1)
|
|
55
70
|
puts mark_disassembly(dis_string, true, pc_offset, brkpts).join("\n")
|
56
71
|
end
|
57
72
|
puts mark_disassembly(dis_string, false, 2).join("\n")
|
58
|
-
puts '
|
73
|
+
puts '=' * 40
|
74
|
+
# FIXME:
|
75
|
+
# require_relative '../lib/trepanning'
|
76
|
+
# debugger
|
77
|
+
# There is a bug in: "breakpoint mark_disassembly"
|
78
|
+
str = mark_disassembly(dis_string, false, 2, [], 70).join("\n")
|
79
|
+
puts str
|
80
|
+
puts '=' * 40
|
59
81
|
require 'pp'
|
60
82
|
PP.pp(disassemble_split(dis_string), $stdout)
|
61
83
|
end
|
data/app/run.rb
CHANGED
@@ -46,23 +46,6 @@ module Trepanning
|
|
46
46
|
untrace_var(:$0, dollar_0_tracker)
|
47
47
|
end
|
48
48
|
|
49
|
-
# Return an ARRAY which makes explicit what array is needed to pass
|
50
|
-
# to system() to reinvoke this debugger using the same Ruby
|
51
|
-
# interpreter. Therefore, We want to the full path of both the Ruby
|
52
|
-
# interpreter and the debugger file ($0). We do this so as not to
|
53
|
-
# rely on an OS search lookup and/or the current working directory
|
54
|
-
# not getting changed from the initial invocation.
|
55
|
-
#
|
56
|
-
# Hmmm, perhaps it is better to also save the initial working
|
57
|
-
# directory? Yes, but on the other hand we can't assume that it
|
58
|
-
# still exists so we might still need to have the full paths.
|
59
|
-
#
|
60
|
-
# It is the caller's responsibility to ensure that argv is the same
|
61
|
-
# as ARGV when the debugger was invokes.
|
62
|
-
def explicit_restart_argv(argv)
|
63
|
-
[ruby_path, File.expand_path($0)] + argv
|
64
|
-
end
|
65
|
-
|
66
49
|
# Path name of Ruby interpreter we were invoked with.
|
67
50
|
def ruby_path
|
68
51
|
File.join(%w(bindir RUBY_INSTALL_NAME).map{|k| RbConfig::CONFIG[k]})
|
@@ -91,5 +74,4 @@ if __FILE__ == $0
|
|
91
74
|
puts whence_file('irb')
|
92
75
|
puts whence_file('probably-does-not-exist')
|
93
76
|
puts ruby_path
|
94
|
-
p explicit_restart_argv(ARGV)
|
95
77
|
end
|
data/bin/trepan
CHANGED
@@ -51,12 +51,10 @@ if File.basename(__FILE__) == File.basename($0)
|
|
51
51
|
Trepan::PROG_SCRIPT = program_to_debug
|
52
52
|
|
53
53
|
# Set global so others may use this debugger.
|
54
|
-
$trepan = Trepan.new(:
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
:nx => options[:nx]
|
59
|
-
)
|
54
|
+
$trepan = Trepan.new(:cmdfiles => options[:cmdfiles],
|
55
|
+
:initial_dir => options[:chdir],
|
56
|
+
:nx => options[:nx]
|
57
|
+
)
|
60
58
|
debug_program($trepan, Trepan::RUBY_PATH,
|
61
59
|
File.expand_path(program_to_debug))
|
62
60
|
end
|
data/data/irbrc
CHANGED
@@ -30,26 +30,12 @@ if defined?($trepan_cmdproc) && $trepan_cmdproc
|
|
30
30
|
puts 'You should have access to the command processor via global variable $trepan_cmdproc'
|
31
31
|
end
|
32
32
|
|
33
|
-
# Monkeypatch to save the current IRB statement to be run
|
34
|
-
# "filename" unique. Possibly not needed.
|
33
|
+
# Monkeypatch to save the current IRB statement to be run.
|
35
34
|
class IRB::Context
|
35
|
+
alias_method :_trepan_original_evaluate, :evaluate
|
36
36
|
def evaluate(line, line_no)
|
37
37
|
$trepan_irb_statements = line
|
38
|
-
|
39
|
-
@eval_counter ||= 0
|
40
|
-
container =
|
41
|
-
if irb_path =~ /\((.+)\)/
|
42
|
-
# Note we originally had a colon below. This causes IRB to think
|
43
|
-
# tracebacks are IRB bugs since the regexp matching it uses here
|
44
|
-
# is now messed up. (irb:5): in ... vs (irb): in ...
|
45
|
-
"(#{$1}[#{@eval_counter}])"
|
46
|
-
else
|
47
|
-
irb_path
|
48
|
-
end
|
49
|
-
set_last_value(@workspace.evaluate(self, line, container, line_no))
|
50
|
-
# @workspace.evaluate("_ = IRB.conf[:MAIN_CONTEXT]._")
|
51
|
-
# @_ = @workspace.evaluate(line, irb_path, line_no)
|
52
|
-
@eval_counter += 1
|
38
|
+
_trepan_original_evaluate(line, line_no)
|
53
39
|
end
|
54
40
|
end
|
55
41
|
|
data/io/base_io.rb
CHANGED
@@ -60,15 +60,17 @@ class Trepan
|
|
60
60
|
attr_reader :output
|
61
61
|
def initialize(out, opts={})
|
62
62
|
@output = out
|
63
|
+
@eof = false
|
63
64
|
@flush_after_write = false
|
64
65
|
end
|
65
66
|
|
66
67
|
def close
|
67
68
|
@output.close if @output
|
69
|
+
@eof = true
|
68
70
|
end
|
69
71
|
|
70
72
|
def eof?
|
71
|
-
@
|
73
|
+
@eof
|
72
74
|
end
|
73
75
|
|
74
76
|
def flush
|