byebug 1.1.0 → 1.1.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Rakefile +0 -1
- data/bin/byebug +51 -114
- data/byebug.gemspec +1 -1
- data/ext/byebug/byebug.c +23 -106
- data/ext/byebug/byebug.h +10 -30
- data/ext/byebug/context.c +16 -102
- data/ext/byebug/extconf.rb +0 -9
- data/lib/byebug.rb +8 -122
- data/lib/byebug/command.rb +35 -29
- data/lib/byebug/commands/breakpoints.rb +17 -12
- data/lib/byebug/commands/catchpoint.rb +5 -5
- data/lib/byebug/commands/condition.rb +9 -7
- data/lib/byebug/commands/continue.rb +7 -4
- data/lib/byebug/commands/control.rb +4 -32
- data/lib/byebug/commands/display.rb +15 -14
- data/lib/byebug/commands/edit.rb +14 -13
- data/lib/byebug/commands/enable.rb +33 -35
- data/lib/byebug/commands/eval.rb +22 -29
- data/lib/byebug/commands/finish.rb +11 -9
- data/lib/byebug/commands/frame.rb +24 -50
- data/lib/byebug/commands/help.rb +21 -27
- data/lib/byebug/commands/info.rb +29 -92
- data/lib/byebug/commands/irb.rb +9 -11
- data/lib/byebug/commands/jump.rb +4 -4
- data/lib/byebug/commands/kill.rb +8 -8
- data/lib/byebug/commands/list.rb +2 -2
- data/lib/byebug/commands/method.rb +6 -6
- data/lib/byebug/commands/quit.rb +8 -8
- data/lib/byebug/commands/reload.rb +3 -3
- data/lib/byebug/commands/save.rb +10 -9
- data/lib/byebug/commands/set.rb +29 -26
- data/lib/byebug/commands/show.rb +17 -18
- data/lib/byebug/commands/skip.rb +8 -8
- data/lib/byebug/commands/source.rb +15 -13
- data/lib/byebug/commands/stepping.rb +7 -7
- data/lib/byebug/commands/trace.rb +8 -13
- data/lib/byebug/commands/variables.rb +18 -18
- data/lib/byebug/context.rb +3 -3
- data/lib/byebug/interface.rb +2 -7
- data/lib/byebug/processor.rb +9 -22
- data/lib/byebug/version.rb +1 -1
- data/old_doc/byebug.1 +3 -35
- data/old_doc/byebug.texi +69 -201
- data/old_doc/test-tri2.rb +1 -1
- data/test/breakpoints_test.rb +8 -1
- data/test/frame_test.rb +0 -8
- data/test/help_test.rb +13 -19
- data/test/info_test.rb +8 -32
- data/test/irb_test.rb +3 -4
- data/test/jump_test.rb +4 -4
- data/test/save_test.rb +2 -2
- data/test/set_test.rb +16 -8
- data/test/source_test.rb +10 -1
- data/test/support/context.rb +1 -1
- data/test/support/mocha_extensions.rb +16 -15
- data/test/support/test_dsl.rb +2 -2
- data/test/trace_test.rb +0 -45
- metadata +4 -10
- data/ext/byebug/locker.c +0 -53
- data/lib/byebug/commands/threads.rb +0 -190
- data/test/examples/frame_threads.rb +0 -31
- data/test/examples/info_threads.rb +0 -48
- data/test/examples/thread.rb +0 -32
- data/test/examples/trace_threads.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c587e41bb9bea57e9e9cc27cec5d670fb7d66f81
|
4
|
+
data.tar.gz: b565d9e7848ef7772edfcc9521f4e11accc50ef6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8cc31ecfc37cfeac40245ef53ca93eb88f6902821fb698374dd48dbe21c1bb97a203e565c0021cc97aca5b3b67fdc1a18b424cefa945f2dd0dfd75dfb08f0f6
|
7
|
+
data.tar.gz: 8ec279d81317f14ac91289c7a11776b931fe6931069c5acfe39cd422f2cce994b3940abb5548dda6493a3a58fc8a7c2d7f52ad43cb971b7fcda4ad27192c2344
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
data/bin/byebug
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
#Command invocation:
|
8
8
|
#
|
9
9
|
# byebug [options] [--] [script-options] ruby-script-to-debug
|
10
|
-
# byebug [options] [script-options]
|
10
|
+
# byebug [options] [script-options]
|
11
11
|
# byebug [--version | --help]
|
12
12
|
#
|
13
13
|
#=== Options
|
@@ -18,20 +18,9 @@
|
|
18
18
|
# front-ends such as GNU Emacs to post this updated information without
|
19
19
|
# having to poll for it.
|
20
20
|
#
|
21
|
-
#<tt>--client</tt>::
|
22
|
-
# Connect to a remote byebug. Used with another byebug invocation using
|
23
|
-
# <tt>--server</tt>. See also <tt>--host</tt>, <tt>--port</tt> and
|
24
|
-
# <tt>--cport</tt> options.
|
25
|
-
#
|
26
|
-
#<tt>--cport=</tt><i>port</i>::
|
27
|
-
# Use port <i>port</i> for access to byebug control.
|
28
|
-
#
|
29
21
|
#<tt>-d | --debug</tt>::
|
30
22
|
# Set $DEBUG true.
|
31
23
|
#
|
32
|
-
#<tt>-h | --host=</tt><i>host</i>::
|
33
|
-
# Use host name <i>host</i> for remote debugging.
|
34
|
-
#
|
35
24
|
#<tt>--help</tt>::
|
36
25
|
# Show invocation help and exit.
|
37
26
|
#
|
@@ -44,9 +33,6 @@
|
|
44
33
|
#<tt>-m | --post-mortem</tt>::
|
45
34
|
# Activate post-mortem mode.
|
46
35
|
#
|
47
|
-
#<tt>--no-control</tt>::
|
48
|
-
# Do not automatically start control thread.
|
49
|
-
#
|
50
36
|
#<tt>--no-quit</tt>::
|
51
37
|
# Do not quit when script terminates. Instead rerun the program.
|
52
38
|
#
|
@@ -57,17 +43,9 @@
|
|
57
43
|
# Don’t execute commands found in any initialization files like
|
58
44
|
# <tt>.byebugrc</tt>.
|
59
45
|
#
|
60
|
-
#<tt>-p | --port=PORT</tt>::
|
61
|
-
# Use port <i>port</i> for remote debugging.
|
62
|
-
#
|
63
46
|
#<tt>-r | --require</tt><i>script</i>::
|
64
47
|
# Require the library, before executing your script.
|
65
48
|
#
|
66
|
-
#<tt>-s | --server</tt>::
|
67
|
-
# Listen for remote connections. Another byebug session accesses using the
|
68
|
-
# <tt>--client</tt> option. See also the <tt>--host</tt>, <tt>--port</tt>
|
69
|
-
# and <tt>--cport</tt> options
|
70
|
-
#
|
71
49
|
#<tt>--script</tt>=<i>file</i>::
|
72
50
|
# Run script file <i>file</i>
|
73
51
|
#
|
@@ -82,9 +60,6 @@
|
|
82
60
|
#<tt>--version</tt>::
|
83
61
|
# Show the version number and exit.
|
84
62
|
#
|
85
|
-
#<tt>-w | --wait</tt>::
|
86
|
-
# Wait for a client connection; implies <tt>-s</tt> option.
|
87
|
-
#
|
88
63
|
#<tt>-x | --trace</tt>::
|
89
64
|
# Show lines before executing them.
|
90
65
|
#
|
@@ -130,21 +105,14 @@ end
|
|
130
105
|
|
131
106
|
options = OpenStruct.new(
|
132
107
|
'annotate' => Byebug.annotate,
|
133
|
-
'client' => false,
|
134
|
-
'cport' => Byebug::PORT + 1,
|
135
|
-
'host' => nil,
|
136
|
-
'control' => true,
|
137
108
|
'quit' => true,
|
138
109
|
'no_rewrite_program' => false,
|
139
110
|
'stop' => true,
|
140
111
|
'nx' => false,
|
141
|
-
'port' => Byebug::PORT,
|
142
112
|
'restart_script' => nil,
|
143
113
|
'script' => nil,
|
144
|
-
'server' => false,
|
145
114
|
'tracing' => false,
|
146
115
|
'verbose_long' => false,
|
147
|
-
'wait' => false
|
148
116
|
)
|
149
117
|
|
150
118
|
def process_options(options)
|
@@ -158,18 +126,10 @@ EOB
|
|
158
126
|
opts.separator "Options:"
|
159
127
|
opts.on("-A", "--annotate LEVEL", Integer, "Set annotation level") {
|
160
128
|
|annotate| Byebug.annotate = annotate }
|
161
|
-
opts.on("-c", "--client", "Connect to remote byebug") {
|
162
|
-
options.client = true }
|
163
|
-
opts.on("--cport PORT", Integer, "Port used for control commands") {
|
164
|
-
|cport| options.cport = cport }
|
165
129
|
opts.on("-d", "--debug", "Set $DEBUG=true") {
|
166
130
|
$DEBUG = true }
|
167
|
-
opts.on('-h', '--host HOST', 'Host name used for remote debugging') {
|
168
|
-
|host| options.host = host }
|
169
131
|
opts.on('-I', '--include PATH', String, 'Add PATH to $LOAD_PATH') {
|
170
132
|
|path| $LOAD_PATH.unshift(path) }
|
171
|
-
opts.on('--no-control', 'Do not automatically start control thread') {
|
172
|
-
options.control = false }
|
173
133
|
opts.on('--no-quit', 'Do not quit when script finishes') {
|
174
134
|
options.quit = false }
|
175
135
|
opts.on('--no-rewrite-program', 'Don\'t set $0 to the program debugged') {
|
@@ -178,8 +138,6 @@ EOB
|
|
178
138
|
options.stop = false }
|
179
139
|
opts.on('-nx', 'Don\'t run any byebug initialization files') {
|
180
140
|
options.nx = true }
|
181
|
-
opts.on('-p', '--port PORT', Integer, 'Port used for remote debugging') {
|
182
|
-
|port| options.port = port }
|
183
141
|
opts.on('-r', '--require SCRIPT', String, 'Require library before script') {
|
184
142
|
|name| if name == 'debug'
|
185
143
|
puts 'byebug not compatible with Ruby\'s \'debug\' lib, option ignored'
|
@@ -202,10 +160,6 @@ EOB
|
|
202
160
|
exit
|
203
161
|
end
|
204
162
|
end
|
205
|
-
opts.on('-s', '--server', 'Listen for remote connections') {
|
206
|
-
options.server = true }
|
207
|
-
opts.on('-w', '--wait', 'Wait for a client connection, implies -s option') {
|
208
|
-
options.wait = true }
|
209
163
|
opts.on('-x', '--trace', 'Turn on line tracing') {
|
210
164
|
options.tracing = true }
|
211
165
|
opts.separator ''
|
@@ -256,80 +210,63 @@ rescue StandardError => e
|
|
256
210
|
exit(-1)
|
257
211
|
end
|
258
212
|
|
259
|
-
if
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
puts 'Must specify a script to run'
|
267
|
-
exit(-1)
|
268
|
-
end
|
269
|
-
|
270
|
-
# save script name
|
271
|
-
prog_script = ARGV.shift
|
272
|
-
prog_script = whence_file(prog_script) unless File.exist?(prog_script)
|
273
|
-
Byebug::PROG_SCRIPT = File.expand_path prog_script
|
274
|
-
|
275
|
-
# install interruption handler
|
276
|
-
trap('INT') { Byebug.interrupt_last }
|
213
|
+
if ARGV.empty?
|
214
|
+
exit if $VERBOSE and not options.verbose_long
|
215
|
+
puts opts
|
216
|
+
puts
|
217
|
+
puts 'Must specify a script to run'
|
218
|
+
exit(-1)
|
219
|
+
end
|
277
220
|
|
278
|
-
|
279
|
-
|
221
|
+
# save script name
|
222
|
+
prog_script = ARGV.shift
|
223
|
+
prog_script = whence_file(prog_script) unless File.exist?(prog_script)
|
224
|
+
Byebug::PROG_SCRIPT = File.expand_path prog_script
|
280
225
|
|
281
|
-
|
282
|
-
|
283
|
-
Byebug.run_init_script(StringIO.new) unless options.nx
|
284
|
-
end
|
285
|
-
debug_program(options)
|
286
|
-
else
|
287
|
-
# Set up trace hook for byebug
|
288
|
-
Byebug.start
|
226
|
+
# install interruption handler
|
227
|
+
trap('INT') { Byebug.interrupt_last }
|
289
228
|
|
290
|
-
|
291
|
-
|
229
|
+
# Set up trace hook for byebug
|
230
|
+
Byebug.start
|
292
231
|
|
293
|
-
|
294
|
-
|
232
|
+
# load initrc script (e.g. .byebugrc)
|
233
|
+
Byebug.run_init_script(StringIO.new) unless options.nx
|
295
234
|
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
235
|
+
# run restore-settings startup script if specified
|
236
|
+
if options.restart_script
|
237
|
+
require 'fileutils'
|
238
|
+
Byebug.run_script(options.restart_script)
|
239
|
+
FileUtils.rm(options.restart_script)
|
240
|
+
end
|
302
241
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
242
|
+
# run startup script if specified
|
243
|
+
if options.script
|
244
|
+
Byebug.run_script(options.script)
|
245
|
+
end
|
307
246
|
|
308
|
-
|
309
|
-
|
247
|
+
options.stop = false if options.tracing
|
248
|
+
Byebug.tracing = options.tracing
|
310
249
|
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
end
|
315
|
-
begin
|
316
|
-
debug_program(options)
|
317
|
-
rescue SyntaxError
|
318
|
-
puts $!.backtrace.map{|l| "\t#{l}"}.join("\n")
|
319
|
-
puts "Uncaught Syntax Error\n"
|
320
|
-
rescue
|
321
|
-
print $!.backtrace.map{|l| "\t#{l}"}.join("\n"), "\n"
|
322
|
-
print "Uncaught exception: #{$!}\n"
|
323
|
-
end
|
324
|
-
print "The program finished.\n" unless
|
325
|
-
Byebug.annotate.to_i > 1 # annotate has its own way
|
326
|
-
interface = Byebug::LocalInterface.new
|
327
|
-
# Not sure if ControlCommandProcessor is really the right
|
328
|
-
# thing to use. CommandProcessor requires a state.
|
329
|
-
processor = Byebug::ControlCommandProcessor.new(interface)
|
330
|
-
processor.process_commands
|
331
|
-
else
|
332
|
-
debug_program(options)
|
333
|
-
end
|
250
|
+
if !options.quit
|
251
|
+
if Byebug.started?
|
252
|
+
until Byebug.stop do end
|
334
253
|
end
|
254
|
+
begin
|
255
|
+
debug_program(options)
|
256
|
+
rescue SyntaxError
|
257
|
+
puts $!.backtrace.map{|l| "\t#{l}"}.join("\n")
|
258
|
+
puts "Uncaught Syntax Error\n"
|
259
|
+
rescue
|
260
|
+
print $!.backtrace.map{|l| "\t#{l}"}.join("\n"), "\n"
|
261
|
+
print "Uncaught exception: #{$!}\n"
|
262
|
+
end
|
263
|
+
print "The program finished.\n" unless
|
264
|
+
Byebug.annotate.to_i > 1 # annotate has its own way
|
265
|
+
interface = Byebug::LocalInterface.new
|
266
|
+
# Not sure if ControlCommandProcessor is really the right
|
267
|
+
# thing to use. CommandProcessor requires a state.
|
268
|
+
processor = Byebug::ControlCommandProcessor.new(interface)
|
269
|
+
processor.process_commands
|
270
|
+
else
|
271
|
+
debug_program(options)
|
335
272
|
end
|
data/byebug.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_development_dependency 'rake', '~> 10.0.4'
|
30
30
|
s.add_development_dependency 'rake-compiler', '~> 0.8.3'
|
31
31
|
s.add_development_dependency 'mocha', '~> 0.13.3'
|
32
|
-
s.add_development_dependency 'minitest', '~> 4.7.
|
32
|
+
s.add_development_dependency 'minitest', '~> 4.7.4'
|
33
33
|
|
34
34
|
s.license = "BSD"
|
35
35
|
end
|
data/ext/byebug/byebug.c
CHANGED
@@ -2,14 +2,12 @@
|
|
2
2
|
|
3
3
|
static VALUE mByebug; /* Ruby Byebug Module object */
|
4
4
|
static VALUE cContext;
|
5
|
-
static VALUE cDebugThread;
|
6
5
|
|
7
6
|
static VALUE tracing = Qfalse;
|
8
7
|
static VALUE post_mortem = Qfalse;
|
9
8
|
static VALUE debug = Qfalse;
|
10
|
-
static VALUE locker = Qnil;
|
11
9
|
|
12
|
-
static VALUE
|
10
|
+
static VALUE context;
|
13
11
|
static VALUE catchpoints;
|
14
12
|
static VALUE breakpoints;
|
15
13
|
|
@@ -29,8 +27,8 @@ tp_inspect(VALUE trace_point) {
|
|
29
27
|
ID2SYM(rb_intern("specified_line")) == event)
|
30
28
|
{
|
31
29
|
VALUE sym = rb_tracearg_method_id(trace_arg);
|
32
|
-
if (
|
33
|
-
|
30
|
+
if (NIL_P(sym)) sym = rb_str_new_cstr("<main>");
|
31
|
+
return rb_sprintf("%"PRIsVALUE"@%"PRIsVALUE":%d in `%"PRIsVALUE"'",
|
34
32
|
rb_tracearg_event(trace_arg),
|
35
33
|
rb_tracearg_path(trace_arg),
|
36
34
|
FIX2INT(rb_tracearg_lineno(trace_arg)),
|
@@ -54,78 +52,23 @@ tp_inspect(VALUE trace_point) {
|
|
54
52
|
}
|
55
53
|
|
56
54
|
static VALUE
|
57
|
-
|
55
|
+
Byebug_context(VALUE self)
|
58
56
|
{
|
59
|
-
VALUE context;
|
60
|
-
|
61
|
-
context = rb_hash_aref(contexts, thread);
|
62
57
|
if (context == Qnil) {
|
63
|
-
context = Context_create(
|
64
|
-
rb_hash_aset(contexts, thread, context);
|
58
|
+
context = Context_create();
|
65
59
|
}
|
66
60
|
return context;
|
67
61
|
}
|
68
62
|
|
69
|
-
static VALUE
|
70
|
-
Byebug_current_context(VALUE self)
|
71
|
-
{
|
72
|
-
return Byebug_thread_context(self, rb_thread_current());
|
73
|
-
}
|
74
|
-
|
75
|
-
/*
|
76
|
-
static int
|
77
|
-
remove_dead_threads(VALUE thread, VALUE context, VALUE ignored)
|
78
|
-
{
|
79
|
-
return (IS_THREAD_ALIVE(thread)) ? ST_CONTINUE : ST_DELETE;
|
80
|
-
}
|
81
|
-
*/
|
82
|
-
|
83
63
|
static void
|
84
64
|
cleanup(debug_context_t *context)
|
85
65
|
{
|
86
|
-
VALUE thread;
|
87
|
-
|
88
66
|
context->stop_reason = CTX_STOP_NONE;
|
89
|
-
|
90
|
-
/* release a lock */
|
91
|
-
locker = Qnil;
|
92
|
-
|
93
|
-
/* let the next thread run */
|
94
|
-
thread = remove_from_locked();
|
95
|
-
if(thread != Qnil)
|
96
|
-
rb_thread_run(thread);
|
97
67
|
}
|
98
68
|
|
99
69
|
static int
|
100
|
-
check_start_processing(debug_context_t *context
|
70
|
+
check_start_processing(debug_context_t *context)
|
101
71
|
{
|
102
|
-
/* return if thread is marked as 'ignored' */
|
103
|
-
if(CTX_FL_TEST(context, CTX_FL_IGNORE)) return 0;
|
104
|
-
|
105
|
-
while(1)
|
106
|
-
{
|
107
|
-
/* halt execution of the current thread if byebug is activated in another */
|
108
|
-
while(locker != Qnil && locker != thread)
|
109
|
-
{
|
110
|
-
add_to_locked(thread);
|
111
|
-
rb_thread_stop();
|
112
|
-
}
|
113
|
-
|
114
|
-
/* stop the current thread if it's marked as suspended */
|
115
|
-
if(CTX_FL_TEST(context, CTX_FL_SUSPEND) && locker != thread)
|
116
|
-
{
|
117
|
-
CTX_FL_SET(context, CTX_FL_WAS_RUNNING);
|
118
|
-
rb_thread_stop();
|
119
|
-
}
|
120
|
-
else break;
|
121
|
-
}
|
122
|
-
|
123
|
-
/* return if the current thread is the locker */
|
124
|
-
if(locker != Qnil) return 0;
|
125
|
-
|
126
|
-
/* only the current thread can proceed */
|
127
|
-
locker = thread;
|
128
|
-
|
129
72
|
/* ignore a skipped section of code */
|
130
73
|
if(CTX_FL_TEST(context, CTX_FL_SKIPPED)) {
|
131
74
|
cleanup(context);
|
@@ -166,9 +109,9 @@ call_at_line(debug_context_t *context, char *file, int line,
|
|
166
109
|
VALUE path, lineno, method_id, defined_class, binding, self; \
|
167
110
|
VALUE context_object; \
|
168
111
|
debug_context_t *context; \
|
169
|
-
context_object =
|
112
|
+
context_object = Byebug_context(mByebug); \
|
170
113
|
Data_Get_Struct(context_object, debug_context_t, context); \
|
171
|
-
if (!check_start_processing(context
|
114
|
+
if (!check_start_processing(context)) return; \
|
172
115
|
load_frame_info(trace_point, &path, &lineno, &method_id, &defined_class, \
|
173
116
|
&binding, &self); \
|
174
117
|
if (debug == Qtrue) \
|
@@ -201,17 +144,18 @@ process_line_event(VALUE trace_point, void *data)
|
|
201
144
|
|
202
145
|
if (context->dest_frame == -1 || context->stack_size == context->dest_frame)
|
203
146
|
{
|
204
|
-
if (moved || !CTX_FL_TEST(context, CTX_FL_FORCE_MOVE))
|
205
|
-
|
206
|
-
context->
|
147
|
+
if (moved || !CTX_FL_TEST(context, CTX_FL_FORCE_MOVE))
|
148
|
+
{
|
149
|
+
context->steps = context->steps <= 0 ? -1 : context->steps - 1;
|
150
|
+
context->lines = context->lines <= 0 ? -1 : context->lines - 1;
|
207
151
|
}
|
208
152
|
}
|
209
153
|
else if (context->stack_size < context->dest_frame)
|
210
154
|
{
|
211
|
-
context->
|
155
|
+
context->steps = 0;
|
212
156
|
}
|
213
157
|
|
214
|
-
if (context->
|
158
|
+
if (context->steps == 0 || context->lines == 0)
|
215
159
|
{
|
216
160
|
context->stop_reason = CTX_STOP_STEP;
|
217
161
|
reset_stepping_stop_points(context);
|
@@ -250,8 +194,8 @@ process_return_event(VALUE trace_point, void *data)
|
|
250
194
|
|
251
195
|
if (context->stack_size == context->stop_frame)
|
252
196
|
{
|
253
|
-
context->
|
254
|
-
context->stop_frame =
|
197
|
+
context->steps = 1;
|
198
|
+
context->stop_frame = -1;
|
255
199
|
}
|
256
200
|
pop_frame(context);
|
257
201
|
|
@@ -348,7 +292,6 @@ Byebug_setup_tracepoints(VALUE self)
|
|
348
292
|
{
|
349
293
|
if (catchpoints != Qnil) return Qnil;
|
350
294
|
|
351
|
-
contexts = rb_hash_new();
|
352
295
|
breakpoints = rb_ary_new();
|
353
296
|
catchpoints = rb_hash_new();
|
354
297
|
|
@@ -389,7 +332,7 @@ Byebug_setup_tracepoints(VALUE self)
|
|
389
332
|
static VALUE
|
390
333
|
Byebug_remove_tracepoints(VALUE self)
|
391
334
|
{
|
392
|
-
|
335
|
+
context = Qnil;
|
393
336
|
breakpoints = Qnil;
|
394
337
|
catchpoints = Qnil;
|
395
338
|
|
@@ -420,13 +363,6 @@ Byebug_remove_tracepoints(VALUE self)
|
|
420
363
|
return Qnil;
|
421
364
|
}
|
422
365
|
|
423
|
-
static int
|
424
|
-
values_i(VALUE key, VALUE value, VALUE ary)
|
425
|
-
{
|
426
|
-
rb_ary_push(ary, value);
|
427
|
-
return ST_CONTINUE;
|
428
|
-
}
|
429
|
-
|
430
366
|
#define BYEBUG_STARTED (catchpoints != Qnil)
|
431
367
|
static VALUE
|
432
368
|
Byebug_started(VALUE self)
|
@@ -470,7 +406,7 @@ set_current_skipped_status(VALUE status)
|
|
470
406
|
VALUE context_object;
|
471
407
|
debug_context_t *context;
|
472
408
|
|
473
|
-
context_object =
|
409
|
+
context_object = Byebug_context(mByebug);
|
474
410
|
Data_Get_Struct(context_object, debug_context_t, context);
|
475
411
|
if (status)
|
476
412
|
CTX_FL_SET(context, CTX_FL_SKIPPED);
|
@@ -493,10 +429,10 @@ Byebug_load(int argc, VALUE *argv, VALUE self)
|
|
493
429
|
|
494
430
|
Byebug_start(self);
|
495
431
|
|
496
|
-
context_object =
|
432
|
+
context_object = Byebug_context(self);
|
497
433
|
Data_Get_Struct(context_object, debug_context_t, context);
|
498
434
|
context->stack_size = 0;
|
499
|
-
if (RTEST(stop)) context->
|
435
|
+
if (RTEST(stop)) context->steps = 1;
|
500
436
|
|
501
437
|
/* Initializing $0 to the script's path */
|
502
438
|
ruby_script(RSTRING_PTR(file));
|
@@ -571,21 +507,6 @@ Byebug_set_post_mortem(VALUE self, VALUE value)
|
|
571
507
|
return value;
|
572
508
|
}
|
573
509
|
|
574
|
-
static VALUE
|
575
|
-
Byebug_contexts(VALUE self)
|
576
|
-
{
|
577
|
-
VALUE ary;
|
578
|
-
|
579
|
-
ary = rb_ary_new();
|
580
|
-
|
581
|
-
/* check that all contexts point to alive threads */
|
582
|
-
/*rb_hash_foreach(contexts, remove_dead_threads, self);*/
|
583
|
-
|
584
|
-
rb_hash_foreach(contexts, values_i, ary);
|
585
|
-
|
586
|
-
return ary;
|
587
|
-
}
|
588
|
-
|
589
510
|
static VALUE
|
590
511
|
Byebug_breakpoints(VALUE self)
|
591
512
|
{
|
@@ -626,9 +547,7 @@ Init_byebug()
|
|
626
547
|
Byebug_setup_tracepoints, 0);
|
627
548
|
rb_define_module_function(mByebug, "remove_tracepoints",
|
628
549
|
Byebug_remove_tracepoints, 0);
|
629
|
-
rb_define_module_function(mByebug, "
|
630
|
-
Byebug_current_context, 0);
|
631
|
-
rb_define_module_function(mByebug, "contexts", Byebug_contexts, 0);
|
550
|
+
rb_define_module_function(mByebug, "context", Byebug_context, 0);
|
632
551
|
rb_define_module_function(mByebug, "breakpoints", Byebug_breakpoints, 0);
|
633
552
|
rb_define_module_function(mByebug, "add_catchpoint",
|
634
553
|
Byebug_add_catchpoint, 1);
|
@@ -647,13 +566,11 @@ Init_byebug()
|
|
647
566
|
|
648
567
|
Init_breakpoint(mByebug);
|
649
568
|
|
650
|
-
|
651
|
-
contexts = Qnil;
|
569
|
+
context = Qnil;
|
652
570
|
catchpoints = Qnil;
|
653
571
|
breakpoints = Qnil;
|
654
572
|
|
655
|
-
rb_global_variable(&locker);
|
656
573
|
rb_global_variable(&breakpoints);
|
657
574
|
rb_global_variable(&catchpoints);
|
658
|
-
rb_global_variable(&
|
575
|
+
rb_global_variable(&context);
|
659
576
|
}
|