byebug 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +1 -1
- data/bin/byebug +1 -2
- data/byebug.gemspec +1 -1
- data/ext/byebug/byebug.c +50 -35
- data/ext/byebug/context.c +99 -45
- data/lib/byebug.rb +5 -10
- data/lib/byebug/command.rb +20 -12
- data/lib/byebug/commands/breakpoints.rb +1 -1
- data/lib/byebug/commands/control.rb +14 -21
- data/lib/byebug/commands/display.rb +4 -4
- data/lib/byebug/commands/enable.rb +20 -19
- data/lib/byebug/commands/eval.rb +1 -1
- data/lib/byebug/commands/finish.rb +4 -5
- data/lib/byebug/commands/info.rb +118 -116
- data/lib/byebug/commands/list.rb +72 -48
- data/lib/byebug/commands/reload.rb +4 -3
- data/lib/byebug/commands/set.rb +7 -16
- data/lib/byebug/commands/show.rb +2 -2
- data/lib/byebug/commands/threads.rb +7 -6
- data/lib/byebug/context.rb +10 -2
- data/lib/byebug/helper.rb +3 -3
- data/lib/byebug/processor.rb +1 -1
- data/lib/byebug/version.rb +1 -1
- data/old_doc/byebug.texi +45 -51
- data/test/breakpoints_test.rb +180 -195
- data/test/display_test.rb +59 -53
- data/test/eval_test.rb +0 -2
- data/test/examples/info.rb +5 -5
- data/test/examples/info_threads.rb +1 -1
- data/test/finish_test.rb +16 -15
- data/test/info_test.rb +9 -10
- data/test/irb_test.rb +64 -65
- data/test/list_test.rb +76 -50
- data/test/method_test.rb +10 -5
- data/test/post_mortem_test.rb +27 -25
- data/test/reload_test.rb +31 -31
- data/test/restart_test.rb +106 -110
- data/test/show_test.rb +8 -16
- data/test/stepping_test.rb +4 -2
- data/test/support/test_dsl.rb +37 -76
- data/test/test_helper.rb +0 -1
- data/test/variables_test.rb +9 -12
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db82855de95f0558289aa633b2432e871bf4a3bb
|
4
|
+
data.tar.gz: 805e3ed4d731545dd2a7f5d9a60ecfe4925e4fdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5662e984cfcb5562c7afe0ccfcb79b926e19ff8fefbf2cb55fae3f18705650983a5385daf5b1545c9dea85bb6d783a46e9ddc0204f08c3116a66e9cc1522a8f6
|
7
|
+
data.tar.gz: 2fe8c9c5934687b8dfdfccdec322a227a0892662010bc08db4be14ac5af4b49b674868da94773517691e57f6b4f4d3b53794e3c819cd9ccd1979092ed816a21e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 1.0.3
|
2
|
+
|
3
|
+
* "autoreload" is set by default now
|
4
|
+
* "list" command: no negative line numbers shown, and line range behaves as
|
5
|
+
expected at the begining/end of file
|
6
|
+
* In some weird cases, "backtrace" command segfaults when trying to show info on
|
7
|
+
some frame args. Don't know the reason yet, but the exception is handled now and
|
8
|
+
and the command doesn't segfault anymore.
|
9
|
+
* Try some thread support (not even close to usable)
|
10
|
+
|
11
|
+
|
1
12
|
## 1.0.2
|
2
13
|
|
3
14
|
* "autolist" and "autoeval" are default settings now
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Byebug [![Build Status](https://secure.travis-ci.org/deivid-rodriguez/byebug.png)](http://travis-ci.org/deivid-rodriguez/byebug) [![Code Climate](https://codeclimate.com/github/deivid-rodriguez/byebug.png)](https://codeclimate.com/github/deivid-rodriguez/byebug) [![Dependency Status](https://gemnasium.com/deivid-rodriguez/byebug.png)](https://gemnasium.com/deivid-rodriguez/byebug)
|
1
|
+
# Byebug [![Gem Version](https://badge.fury.io/rb/byebug.png)](http://badge.fury.io/rb/byebug) [![Build Status](https://secure.travis-ci.org/deivid-rodriguez/byebug.png)](http://travis-ci.org/deivid-rodriguez/byebug) [![Code Climate](https://codeclimate.com/github/deivid-rodriguez/byebug.png)](https://codeclimate.com/github/deivid-rodriguez/byebug) [![Dependency Status](https://gemnasium.com/deivid-rodriguez/byebug.png)](https://gemnasium.com/deivid-rodriguez/byebug)
|
2
2
|
|
3
3
|
A Ruby 2.0 debugger.
|
4
4
|
|
data/bin/byebug
CHANGED
@@ -297,8 +297,7 @@ begin
|
|
297
297
|
if RUBY_PLATFORM =~ /mswin/
|
298
298
|
byebug_path += '.cmd' unless byebug_path =~ /\.cmd$/i
|
299
299
|
end
|
300
|
-
Byebug::
|
301
|
-
Byebug::BYEBUG_BIN = __FILE__
|
300
|
+
Byebug::BYEBUG_SCRIPT = byebug_path
|
302
301
|
Byebug::INITIAL_DIR = Dir.pwd
|
303
302
|
opts.parse! ARGV
|
304
303
|
rescue StandardError => e
|
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.3'
|
33
33
|
|
34
34
|
s.license = "BSD"
|
35
35
|
end
|
data/ext/byebug/byebug.c
CHANGED
@@ -19,19 +19,37 @@ static VALUE tpRaise;
|
|
19
19
|
|
20
20
|
static VALUE idAlive;
|
21
21
|
|
22
|
-
static
|
23
|
-
|
24
|
-
|
25
|
-
{
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
22
|
+
static VALUE
|
23
|
+
tp_inspect(VALUE trace_point) {
|
24
|
+
rb_trace_arg_t *trace_arg = rb_tracearg_from_tracepoint(trace_point);
|
25
|
+
if (trace_arg) {
|
26
|
+
VALUE event = rb_tracearg_event(trace_arg);
|
27
|
+
if (ID2SYM(rb_intern("line")) == event ||
|
28
|
+
ID2SYM(rb_intern("specified_line")) == event)
|
29
|
+
{
|
30
|
+
VALUE sym = rb_tracearg_method_id(trace_arg);
|
31
|
+
if (!NIL_P(sym))
|
32
|
+
return rb_sprintf("%"PRIsVALUE"@%"PRIsVALUE":%d in `%"PRIsVALUE"'",
|
33
|
+
rb_tracearg_event(trace_arg),
|
34
|
+
rb_tracearg_path(trace_arg),
|
35
|
+
FIX2INT(rb_tracearg_lineno(trace_arg)),
|
36
|
+
sym);
|
37
|
+
}
|
38
|
+
if (ID2SYM(rb_intern("call")) == event ||
|
39
|
+
ID2SYM(rb_intern("c_call")) == event ||
|
40
|
+
ID2SYM(rb_intern("return")) == event ||
|
41
|
+
ID2SYM(rb_intern("c_return")) == event)
|
42
|
+
return rb_sprintf("%"PRIsVALUE" `%"PRIsVALUE"'@%"PRIsVALUE":%d",
|
43
|
+
rb_tracearg_event(trace_arg),
|
44
|
+
rb_tracearg_method_id(trace_arg),
|
45
|
+
rb_tracearg_path(trace_arg),
|
46
|
+
FIX2INT(rb_tracearg_lineno(trace_arg)));
|
47
|
+
return rb_sprintf("%"PRIsVALUE"@%"PRIsVALUE":%d",
|
48
|
+
rb_tracearg_event(trace_arg),
|
49
|
+
rb_tracearg_path(trace_arg),
|
50
|
+
FIX2INT(rb_tracearg_lineno(trace_arg)));
|
51
|
+
}
|
52
|
+
return rb_sprintf("No info");
|
35
53
|
}
|
36
54
|
|
37
55
|
static VALUE
|
@@ -158,13 +176,12 @@ process_line_event(VALUE trace_point, void *data)
|
|
158
176
|
|
159
177
|
load_frame_info(
|
160
178
|
trace_point, &path, &lineno, &method_id, &defined_class, &binding, &self);
|
179
|
+
if (debug == Qtrue)
|
180
|
+
printf("%s (stack_size: %d)\n", RSTRING_PTR(tp_inspect(trace_point)),
|
181
|
+
context->stack_size);
|
161
182
|
update_frame(context_object, RSTRING_PTR(path), FIX2INT(lineno), method_id,
|
162
183
|
defined_class, binding, self);
|
163
184
|
|
164
|
-
if (debug == Qtrue)
|
165
|
-
print_debug_info(
|
166
|
-
"line", path, lineno, method_id, defined_class, context->stack_size);
|
167
|
-
|
168
185
|
if (context->last_line != FIX2INT(lineno) || context->last_file == NULL ||
|
169
186
|
strcmp(context->last_file, RSTRING_PTR(path)))
|
170
187
|
{
|
@@ -220,21 +237,20 @@ process_return_event(VALUE trace_point, void *data)
|
|
220
237
|
Data_Get_Struct(context_object, debug_context_t, context);
|
221
238
|
if (!check_start_processing(context, rb_thread_current())) return;
|
222
239
|
|
240
|
+
load_frame_info(
|
241
|
+
trace_point, &path, &lineno, &method_id, &defined_class, &binding, &self);
|
242
|
+
if (debug == Qtrue)
|
243
|
+
printf("%s (stack_size: %d)\n", RSTRING_PTR(tp_inspect(trace_point)),
|
244
|
+
context->stack_size);
|
245
|
+
|
223
246
|
if (context->stack_size == context->stop_frame)
|
224
247
|
{
|
225
248
|
context->stop_next = 1;
|
226
249
|
context->stop_frame = 0;
|
227
250
|
}
|
228
251
|
|
229
|
-
load_frame_info(trace_point, &path, &lineno, &method_id, &defined_class,
|
230
|
-
&binding, &self);
|
231
252
|
pop_frame(context_object);
|
232
253
|
|
233
|
-
if (debug == Qtrue)
|
234
|
-
print_debug_info("return", path, lineno, method_id, defined_class,
|
235
|
-
context->stack_size);
|
236
|
-
//rb_funcall(context_object, idAtReturn, 2, path, lineno);
|
237
|
-
|
238
254
|
cleanup(context);
|
239
255
|
}
|
240
256
|
|
@@ -250,15 +266,14 @@ process_call_event(VALUE trace_point, void *data)
|
|
250
266
|
Data_Get_Struct(context_object, debug_context_t, context);
|
251
267
|
if (!check_start_processing(context, rb_thread_current())) return;
|
252
268
|
|
253
|
-
load_frame_info(
|
254
|
-
|
269
|
+
load_frame_info(
|
270
|
+
trace_point, &path, &lineno, &method_id, &defined_class, &binding, &self);
|
271
|
+
if (debug == Qtrue)
|
272
|
+
printf("%s (stack_size: %d)\n", RSTRING_PTR(tp_inspect(trace_point)),
|
273
|
+
context->stack_size);
|
255
274
|
push_frame(context_object, RSTRING_PTR(path), FIX2INT(lineno), method_id,
|
256
275
|
defined_class, binding, self);
|
257
276
|
|
258
|
-
if (debug == Qtrue)
|
259
|
-
print_debug_info("call", path, lineno, method_id, defined_class,
|
260
|
-
context->stack_size);
|
261
|
-
|
262
277
|
breakpoint = find_breakpoint_by_method(breakpoints, defined_class,
|
263
278
|
SYM2ID(method_id),
|
264
279
|
binding, self);
|
@@ -287,14 +302,14 @@ process_raise_event(VALUE trace_point, void *data)
|
|
287
302
|
Data_Get_Struct(context_object, debug_context_t, context);
|
288
303
|
if (!check_start_processing(context, rb_thread_current())) return;
|
289
304
|
|
290
|
-
load_frame_info(
|
291
|
-
|
305
|
+
load_frame_info(
|
306
|
+
trace_point, &path, &lineno, &method_id, &defined_class, &binding, &self);
|
307
|
+
if (debug == Qtrue)
|
308
|
+
printf("%s (stack_size: %d)\n", RSTRING_PTR(tp_inspect(trace_point)),
|
309
|
+
context->stack_size);
|
292
310
|
update_frame(context_object, RSTRING_PTR(path), FIX2INT(lineno), method_id,
|
293
311
|
defined_class, binding, self);
|
294
312
|
|
295
|
-
if (debug == Qtrue)
|
296
|
-
print_debug_info("call", path, lineno, method_id, defined_class,
|
297
|
-
context->stack_size);
|
298
313
|
expn_class = rb_obj_class(err);
|
299
314
|
|
300
315
|
if (catchpoints == Qnil ||
|
data/ext/byebug/context.c
CHANGED
@@ -5,6 +5,18 @@ static int thnum_current = 0;
|
|
5
5
|
|
6
6
|
static VALUE idAlive;
|
7
7
|
|
8
|
+
static VALUE
|
9
|
+
id2ref(VALUE id)
|
10
|
+
{
|
11
|
+
return id;
|
12
|
+
}
|
13
|
+
|
14
|
+
static VALUE
|
15
|
+
context_thread_0(debug_context_t *context)
|
16
|
+
{
|
17
|
+
return id2ref(context->thread);
|
18
|
+
}
|
19
|
+
|
8
20
|
/* "Step", "Next" and "Finish" do their work by saving information about where
|
9
21
|
* to stop next. reset_stepping_stop_points removes/resets this information. */
|
10
22
|
extern void
|
@@ -251,25 +263,27 @@ Context_frame_self(int argc, VALUE *argv, VALUE self)
|
|
251
263
|
}
|
252
264
|
|
253
265
|
static VALUE
|
254
|
-
|
266
|
+
Context_frame_class(int argc, VALUE *argv, VALUE self)
|
255
267
|
{
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
268
|
+
debug_context_t *context;
|
269
|
+
debug_frame_t *frame;
|
270
|
+
VALUE frame_no;
|
271
|
+
int frame_n;
|
272
|
+
|
273
|
+
Data_Get_Struct(self, debug_context_t, context);
|
274
|
+
frame_n = rb_scan_args(argc, argv, "01", &frame_no) == 0 ? 0 : FIX2INT(frame_no);
|
275
|
+
frame = get_frame_no(context, frame_n);
|
276
|
+
return frame->defined_class;
|
262
277
|
}
|
263
278
|
|
264
279
|
static VALUE
|
265
|
-
|
280
|
+
Context_frame_locals(int argc, VALUE *argv, VALUE self)
|
266
281
|
{
|
267
282
|
VALUE binding = Context_frame_binding(argc, argv, self);
|
268
283
|
const char src[] =
|
269
|
-
|
270
|
-
"self.method(__method__).parameters.map{|(attr, mid)| mid} : []";
|
284
|
+
"local_variables.inject({}){|h, v| h[v] = eval(\"#{v}\"); h}";
|
271
285
|
return NIL_P(binding) ?
|
272
|
-
|
286
|
+
rb_hash_new() :
|
273
287
|
rb_funcall(binding, rb_intern("eval"), 1, rb_str_new2(src));
|
274
288
|
}
|
275
289
|
|
@@ -287,53 +301,91 @@ Context_frame_args_info(int argc, VALUE *argv, VALUE self)
|
|
287
301
|
static VALUE
|
288
302
|
Context_tracing(VALUE self)
|
289
303
|
{
|
290
|
-
|
304
|
+
debug_context_t *context;
|
291
305
|
|
292
|
-
|
293
|
-
|
306
|
+
Data_Get_Struct(self, debug_context_t, context);
|
307
|
+
return CTX_FL_TEST(context, CTX_FL_TRACING) ? Qtrue : Qfalse;
|
294
308
|
}
|
295
309
|
|
296
310
|
static VALUE
|
297
311
|
Context_set_tracing(VALUE self, VALUE value)
|
298
312
|
{
|
299
|
-
|
313
|
+
debug_context_t *context;
|
314
|
+
|
315
|
+
Data_Get_Struct(self, debug_context_t, context);
|
316
|
+
|
317
|
+
if (RTEST(value))
|
318
|
+
CTX_FL_SET(context, CTX_FL_TRACING);
|
319
|
+
else
|
320
|
+
CTX_FL_UNSET(context, CTX_FL_TRACING);
|
321
|
+
return value;
|
322
|
+
}
|
323
|
+
|
324
|
+
static VALUE
|
325
|
+
Context_stop_reason(VALUE self)
|
326
|
+
{
|
327
|
+
debug_context_t *context;
|
328
|
+
const char *symbol;
|
329
|
+
|
330
|
+
Data_Get_Struct(self, debug_context_t, context);
|
331
|
+
|
332
|
+
switch(context->stop_reason)
|
333
|
+
{
|
334
|
+
case CTX_STOP_STEP:
|
335
|
+
symbol = "step";
|
336
|
+
break;
|
337
|
+
case CTX_STOP_BREAKPOINT:
|
338
|
+
symbol = "breakpoint";
|
339
|
+
break;
|
340
|
+
case CTX_STOP_CATCHPOINT:
|
341
|
+
symbol = "catchpoint";
|
342
|
+
break;
|
343
|
+
case CTX_STOP_NONE:
|
344
|
+
default:
|
345
|
+
symbol = "none";
|
346
|
+
}
|
347
|
+
if(CTX_FL_TEST(context, CTX_FL_DEAD))
|
348
|
+
symbol = "post-mortem";
|
300
349
|
|
301
|
-
|
350
|
+
return ID2SYM(rb_intern(symbol));
|
351
|
+
}
|
302
352
|
|
303
|
-
|
304
|
-
|
353
|
+
static void
|
354
|
+
context_suspend_0(debug_context_t *context)
|
355
|
+
{
|
356
|
+
VALUE status;
|
357
|
+
|
358
|
+
status = rb_funcall(context_thread_0(context), rb_intern("status"), 0);
|
359
|
+
if (rb_str_cmp(status, rb_str_new2("run")) == 0)
|
360
|
+
CTX_FL_SET(context, CTX_FL_WAS_RUNNING);
|
361
|
+
else if(rb_str_cmp(status, rb_str_new2("sleep")) == 0)
|
362
|
+
CTX_FL_UNSET(context, CTX_FL_WAS_RUNNING);
|
305
363
|
else
|
306
|
-
|
307
|
-
|
364
|
+
return;
|
365
|
+
CTX_FL_SET(context, CTX_FL_SUSPEND);
|
308
366
|
}
|
309
367
|
|
310
368
|
static VALUE
|
311
|
-
|
369
|
+
Context_suspend(VALUE self)
|
312
370
|
{
|
313
|
-
|
314
|
-
const char *symbol;
|
315
|
-
|
316
|
-
Data_Get_Struct(self, debug_context_t, context);
|
317
|
-
|
318
|
-
switch(context->stop_reason)
|
319
|
-
{
|
320
|
-
case CTX_STOP_STEP:
|
321
|
-
symbol = "step";
|
322
|
-
break;
|
323
|
-
case CTX_STOP_BREAKPOINT:
|
324
|
-
symbol = "breakpoint";
|
325
|
-
break;
|
326
|
-
case CTX_STOP_CATCHPOINT:
|
327
|
-
symbol = "catchpoint";
|
328
|
-
break;
|
329
|
-
case CTX_STOP_NONE:
|
330
|
-
default:
|
331
|
-
symbol = "none";
|
332
|
-
}
|
333
|
-
if(CTX_FL_TEST(context, CTX_FL_DEAD))
|
334
|
-
symbol = "post-mortem";
|
371
|
+
debug_context_t *context;
|
335
372
|
|
336
|
-
|
373
|
+
Data_Get_Struct(self, debug_context_t, context);
|
374
|
+
|
375
|
+
if (CTX_FL_TEST(context, CTX_FL_SUSPEND))
|
376
|
+
rb_raise(rb_eRuntimeError, "Already suspended.");
|
377
|
+
context_suspend_0(context);
|
378
|
+
|
379
|
+
return Qnil;
|
380
|
+
}
|
381
|
+
|
382
|
+
static VALUE
|
383
|
+
Context_is_suspended(VALUE self)
|
384
|
+
{
|
385
|
+
debug_context_t *context;
|
386
|
+
|
387
|
+
Data_Get_Struct(self, debug_context_t, context);
|
388
|
+
return CTX_FL_TEST(context, CTX_FL_SUSPEND) ? Qtrue : Qfalse;
|
337
389
|
}
|
338
390
|
|
339
391
|
#if 0
|
@@ -436,6 +488,8 @@ Init_context(VALUE mByebug)
|
|
436
488
|
rb_define_method(cContext, "ignored?", Context_ignored, 0);
|
437
489
|
rb_define_method(cContext, "thnum", Context_thnum, 0);
|
438
490
|
rb_define_method(cContext, "stop_reason", Context_stop_reason, 0);
|
491
|
+
rb_define_method(cContext, "suspend", Context_suspend, 0);
|
492
|
+
rb_define_method(cContext, "suspended?", Context_is_suspended, 0);
|
439
493
|
rb_define_method(cContext, "tracing", Context_tracing, 0);
|
440
494
|
rb_define_method(cContext, "tracing=", Context_set_tracing, 1);
|
441
495
|
rb_define_method(cContext, "frame_file", Context_frame_file, -1);
|
@@ -443,7 +497,7 @@ Init_context(VALUE mByebug)
|
|
443
497
|
rb_define_method(cContext, "frame_method", Context_frame_method, -1);
|
444
498
|
rb_define_method(cContext, "frame_binding", Context_frame_binding, -1);
|
445
499
|
rb_define_method(cContext, "frame_self", Context_frame_self, -1);
|
446
|
-
rb_define_method(cContext, "
|
500
|
+
rb_define_method(cContext, "frame_class", Context_frame_class, -1);
|
447
501
|
rb_define_method(cContext, "frame_args_info", Context_frame_args_info, -1);
|
448
502
|
rb_define_method(cContext, "frame_locals", Context_frame_locals, -1);
|
449
503
|
rb_define_method(cContext, "stop_next=", Context_stop_next, -1);
|
data/lib/byebug.rb
CHANGED
@@ -10,8 +10,6 @@ require 'linecache19'
|
|
10
10
|
|
11
11
|
module Byebug
|
12
12
|
|
13
|
-
@reload_source_on_change = false
|
14
|
-
|
15
13
|
self.handler = CommandProcessor.new
|
16
14
|
|
17
15
|
# Default options to Byebug.start
|
@@ -29,10 +27,6 @@ module Byebug
|
|
29
27
|
|
30
28
|
class << self
|
31
29
|
|
32
|
-
# If true, checks the modification time of source files and reloads them if
|
33
|
-
# they were modified
|
34
|
-
attr_accessor :reload_source_on_change
|
35
|
-
|
36
30
|
attr_accessor :last_exception
|
37
31
|
Byebug.last_exception = nil
|
38
32
|
|
@@ -66,7 +60,8 @@ module Byebug
|
|
66
60
|
end
|
67
61
|
|
68
62
|
def source_reload
|
69
|
-
Object.send(:remove_const, "SCRIPT_LINES__") if
|
63
|
+
Object.send(:remove_const, "SCRIPT_LINES__") if
|
64
|
+
Object.const_defined?("SCRIPT_LINES__")
|
70
65
|
Object.const_set("SCRIPT_LINES__", {})
|
71
66
|
LineCache::clear_file_cache
|
72
67
|
end
|
@@ -74,8 +69,8 @@ module Byebug
|
|
74
69
|
# Get line +line_number+ from file named +filename+.
|
75
70
|
# @return "\n" if there was a problem. Leaking blanks are stripped off.
|
76
71
|
def line_at(filename, line_number)
|
77
|
-
|
78
|
-
line = LineCache::getline(filename, line_number,
|
72
|
+
@@reload_source_on_change = nil unless defined?(@@reload_source_on_change)
|
73
|
+
line = LineCache::getline(filename, line_number, @@reload_source_on_change)
|
79
74
|
return "\n" unless line
|
80
75
|
return "#{line.gsub(/^\s+/, '').chomp}"
|
81
76
|
end
|
@@ -390,7 +385,7 @@ module Kernel
|
|
390
385
|
end
|
391
386
|
alias breakpoint byebug unless respond_to?(:breakpoint)
|
392
387
|
|
393
|
-
|
388
|
+
##
|
394
389
|
# Returns a binding of n-th call frame
|
395
390
|
#
|
396
391
|
def binding_n(n = 0)
|
data/lib/byebug/command.rb
CHANGED
@@ -210,6 +210,14 @@ module Byebug
|
|
210
210
|
end
|
211
211
|
end
|
212
212
|
|
213
|
+
def debug_warning_eval(str, b = get_binding)
|
214
|
+
begin
|
215
|
+
debug_eval(str, b)
|
216
|
+
rescue :debug_error => e
|
217
|
+
print "#{e.class} Exception: #{e.message}\n"
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
213
221
|
def get_binding
|
214
222
|
@state.context.frame_binding(@state.frame_pos)
|
215
223
|
end
|
@@ -226,18 +234,18 @@ module Byebug
|
|
226
234
|
# Use Byebug.settings[] and Byebug.settings[]= methods to query and set
|
227
235
|
# byebug settings. These settings are available:
|
228
236
|
#
|
229
|
-
#
|
230
|
-
#
|
231
|
-
#
|
232
|
-
#
|
233
|
-
#
|
234
|
-
#
|
235
|
-
#
|
236
|
-
#
|
237
|
-
#
|
238
|
-
#
|
239
|
-
#
|
240
|
-
#
|
237
|
+
# :autolist - automatically calls 'list' command on breakpoint
|
238
|
+
# :autoeval - evaluates input in the current binding if it's
|
239
|
+
# not recognized as a byebug command
|
240
|
+
# :autoirb - automatically calls 'irb' command on breakpoint
|
241
|
+
# :stack_trace_on_error - shows full stack trace if eval command results
|
242
|
+
# in an exception
|
243
|
+
# :frame_full_path - displays full paths when showing frame stack
|
244
|
+
# :frame_class_names - displays method's class name when showing frame
|
245
|
+
# stack
|
246
|
+
# :reload_source_on_change - makes 'list' command always display up-to-date
|
247
|
+
# source code
|
248
|
+
# :force_stepping - stepping command always move to the new line
|
241
249
|
#
|
242
250
|
def self.settings
|
243
251
|
Command.settings
|