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
data/ext/byebug/byebug.h
CHANGED
@@ -1,23 +1,19 @@
|
|
1
|
-
#ifndef
|
2
|
-
#define
|
1
|
+
#ifndef BYEBUG
|
2
|
+
#define BYEBUG
|
3
3
|
|
4
4
|
#include <ruby.h>
|
5
5
|
#include <ruby/debug.h>
|
6
6
|
|
7
7
|
typedef struct rb_trace_arg_struct rb_trace_point_t;
|
8
8
|
|
9
|
-
/* Byebug::Context */
|
10
|
-
|
11
9
|
/* flags */
|
12
10
|
#define CTX_FL_SUSPEND (1<<1)
|
13
11
|
#define CTX_FL_TRACING (1<<2)
|
14
12
|
#define CTX_FL_SKIPPED (1<<3)
|
15
|
-
#define
|
16
|
-
#define
|
17
|
-
#define
|
18
|
-
#define
|
19
|
-
#define CTX_FL_FORCE_MOVE (1<<8)
|
20
|
-
#define CTX_FL_CATCHING (1<<9)
|
13
|
+
#define CTX_FL_DEAD (1<<4)
|
14
|
+
#define CTX_FL_ENABLE_BKPT (1<<5)
|
15
|
+
#define CTX_FL_FORCE_MOVE (1<<6)
|
16
|
+
#define CTX_FL_CATCHING (1<<7)
|
21
17
|
|
22
18
|
/* macro functions */
|
23
19
|
#define CTX_FL_TEST(c,f) ((c)->flags & (f))
|
@@ -45,27 +41,21 @@ typedef struct debug_frame_t {
|
|
45
41
|
typedef struct {
|
46
42
|
debug_frame_t *stack;
|
47
43
|
int stack_size;
|
48
|
-
|
49
|
-
VALUE thread;
|
50
|
-
int thnum;
|
51
44
|
int flags;
|
52
|
-
|
53
45
|
ctx_stop_reason stop_reason;
|
54
|
-
int stop_next;
|
55
46
|
int dest_frame;
|
56
|
-
int
|
57
|
-
int
|
58
|
-
|
47
|
+
int lines; /* # of lines in dest_frame before stopping */
|
48
|
+
int steps; /* # of steps before stopping */
|
49
|
+
int stop_frame; /* frame number after which we must stop */
|
59
50
|
char *last_file;
|
60
51
|
int last_line;
|
61
52
|
} debug_context_t;
|
62
53
|
|
63
54
|
/* functions */
|
64
55
|
extern VALUE Init_context(VALUE mByebug);
|
65
|
-
extern VALUE Context_create(
|
56
|
+
extern VALUE Context_create();
|
66
57
|
extern VALUE Context_dup(debug_context_t *context);
|
67
58
|
extern void reset_stepping_stop_points(debug_context_t *context);
|
68
|
-
extern VALUE Context_ignored(VALUE self);
|
69
59
|
|
70
60
|
extern void push_frame(debug_context_t *context, char* file, int lineno,
|
71
61
|
VALUE method_id, VALUE defined_class, VALUE binding,
|
@@ -77,16 +67,6 @@ extern void update_frame(debug_frame_t *context, char* file, int lineno,
|
|
77
67
|
VALUE method_id, VALUE defined_class, VALUE binding,
|
78
68
|
VALUE self);
|
79
69
|
|
80
|
-
/* locked threads container */
|
81
|
-
typedef struct locked_thread_t {
|
82
|
-
VALUE thread;
|
83
|
-
struct locked_thread_t *next;
|
84
|
-
} locked_thread_t;
|
85
|
-
|
86
|
-
extern int is_in_locked(VALUE thread_id);
|
87
|
-
extern void add_to_locked(VALUE thread);
|
88
|
-
extern VALUE remove_from_locked();
|
89
|
-
|
90
70
|
/* utility functions */
|
91
71
|
static inline int
|
92
72
|
classname_cmp(VALUE name, VALUE klass)
|
data/ext/byebug/context.c
CHANGED
@@ -1,19 +1,6 @@
|
|
1
1
|
#include <byebug.h>
|
2
2
|
|
3
3
|
static VALUE cContext;
|
4
|
-
static int thnum_current = 0;
|
5
|
-
|
6
|
-
static VALUE
|
7
|
-
id2ref(VALUE id)
|
8
|
-
{
|
9
|
-
return id;
|
10
|
-
}
|
11
|
-
|
12
|
-
static VALUE
|
13
|
-
context_thread_0(debug_context_t *context)
|
14
|
-
{
|
15
|
-
return id2ref(context->thread);
|
16
|
-
}
|
17
4
|
|
18
5
|
/* "Step", "Next" and "Finish" do their work by saving information about where
|
19
6
|
* to stop next. reset_stepping_stop_points removes/resets this information. */
|
@@ -21,15 +8,9 @@ extern void
|
|
21
8
|
reset_stepping_stop_points(debug_context_t *context)
|
22
9
|
{
|
23
10
|
context->dest_frame = -1;
|
24
|
-
context->
|
25
|
-
context->
|
26
|
-
|
27
|
-
|
28
|
-
static inline VALUE
|
29
|
-
Context_thnum(VALUE self) {
|
30
|
-
debug_context_t *context;
|
31
|
-
Data_Get_Struct(self, debug_context_t, context);
|
32
|
-
return INT2FIX(context->thnum);
|
11
|
+
context->lines = -1;
|
12
|
+
context->steps = -1;
|
13
|
+
context->stop_frame = -1;
|
33
14
|
}
|
34
15
|
|
35
16
|
static inline void
|
@@ -63,14 +44,6 @@ Context_stack_size(VALUE self)
|
|
63
44
|
return INT2FIX(context->stack_size);
|
64
45
|
}
|
65
46
|
|
66
|
-
static inline VALUE
|
67
|
-
Context_thread(VALUE self)
|
68
|
-
{
|
69
|
-
debug_context_t *context;
|
70
|
-
Data_Get_Struct(self, debug_context_t, context);
|
71
|
-
return context->thread;
|
72
|
-
}
|
73
|
-
|
74
47
|
static inline VALUE
|
75
48
|
Context_dead(VALUE self)
|
76
49
|
{
|
@@ -79,16 +52,6 @@ Context_dead(VALUE self)
|
|
79
52
|
return CTX_FL_TEST(context, CTX_FL_DEAD) ? Qtrue : Qfalse;
|
80
53
|
}
|
81
54
|
|
82
|
-
extern VALUE
|
83
|
-
Context_ignored(VALUE self)
|
84
|
-
{
|
85
|
-
debug_context_t *context;
|
86
|
-
|
87
|
-
if (self == Qnil) return Qtrue;
|
88
|
-
Data_Get_Struct(self, debug_context_t, context);
|
89
|
-
return CTX_FL_TEST(context, CTX_FL_IGNORE) ? Qtrue : Qfalse;
|
90
|
-
}
|
91
|
-
|
92
55
|
extern void
|
93
56
|
push_frame(debug_context_t *context, char* file, int lineno, VALUE method_id,
|
94
57
|
VALUE defined_class, VALUE binding, VALUE self)
|
@@ -115,7 +78,6 @@ Context_mark(debug_context_t *context)
|
|
115
78
|
{
|
116
79
|
debug_frame_t *frame;
|
117
80
|
|
118
|
-
//rb_gc_mark(context->thread);
|
119
81
|
frame = context->stack;
|
120
82
|
while (frame != NULL) {
|
121
83
|
rb_gc_mark(frame->self);
|
@@ -133,20 +95,17 @@ Context_free(debug_context_t *context) {
|
|
133
95
|
}
|
134
96
|
|
135
97
|
extern VALUE
|
136
|
-
Context_create(
|
98
|
+
Context_create()
|
99
|
+
{
|
137
100
|
debug_context_t *context;
|
138
101
|
|
139
102
|
context = ALLOC(debug_context_t);
|
140
103
|
context->stack_size = 0;
|
141
104
|
context->stack = NULL;
|
142
|
-
context->thnum = ++thnum_current;
|
143
|
-
context->thread = thread;
|
144
105
|
context->flags = 0;
|
145
106
|
context->last_file = NULL;
|
146
107
|
context->last_line = -1;
|
147
|
-
context->stop_frame = -1;
|
148
108
|
reset_stepping_stop_points(context);
|
149
|
-
if (rb_obj_class(thread) == cDebugThread) CTX_FL_SET(context, CTX_FL_IGNORE);
|
150
109
|
return Data_Wrap_Struct(cContext, Context_mark, Context_free, context);
|
151
110
|
}
|
152
111
|
|
@@ -169,10 +128,7 @@ Context_dup(debug_context_t *context)
|
|
169
128
|
|
170
129
|
new_context = ALLOC(debug_context_t);
|
171
130
|
memcpy(new_context, context, sizeof(debug_context_t));
|
172
|
-
new_context
|
173
|
-
new_context->stop_line = -1;
|
174
|
-
new_context->stop_frame = -1;
|
175
|
-
new_context->stop_next = -1;
|
131
|
+
reset_stepping_stop_points(new_context);
|
176
132
|
new_context->stack_size = context->stack_size;
|
177
133
|
CTX_FL_SET(new_context, CTX_FL_DEAD);
|
178
134
|
new_context->stack = ALLOC(debug_frame_t);
|
@@ -364,44 +320,6 @@ Context_stop_reason(VALUE self)
|
|
364
320
|
return ID2SYM(rb_intern(symbol));
|
365
321
|
}
|
366
322
|
|
367
|
-
static void
|
368
|
-
context_suspend_0(debug_context_t *context)
|
369
|
-
{
|
370
|
-
VALUE status;
|
371
|
-
|
372
|
-
status = rb_funcall(context_thread_0(context), rb_intern("status"), 0);
|
373
|
-
if (rb_str_cmp(status, rb_str_new2("run")) == 0)
|
374
|
-
CTX_FL_SET(context, CTX_FL_WAS_RUNNING);
|
375
|
-
else if(rb_str_cmp(status, rb_str_new2("sleep")) == 0)
|
376
|
-
CTX_FL_UNSET(context, CTX_FL_WAS_RUNNING);
|
377
|
-
else
|
378
|
-
return;
|
379
|
-
CTX_FL_SET(context, CTX_FL_SUSPEND);
|
380
|
-
}
|
381
|
-
|
382
|
-
static VALUE
|
383
|
-
Context_suspend(VALUE self)
|
384
|
-
{
|
385
|
-
debug_context_t *context;
|
386
|
-
|
387
|
-
Data_Get_Struct(self, debug_context_t, context);
|
388
|
-
|
389
|
-
if (CTX_FL_TEST(context, CTX_FL_SUSPEND))
|
390
|
-
rb_raise(rb_eRuntimeError, "Already suspended.");
|
391
|
-
context_suspend_0(context);
|
392
|
-
|
393
|
-
return Qnil;
|
394
|
-
}
|
395
|
-
|
396
|
-
static VALUE
|
397
|
-
Context_is_suspended(VALUE self)
|
398
|
-
{
|
399
|
-
debug_context_t *context;
|
400
|
-
|
401
|
-
Data_Get_Struct(self, debug_context_t, context);
|
402
|
-
return CTX_FL_TEST(context, CTX_FL_SUSPEND) ? Qtrue : Qfalse;
|
403
|
-
}
|
404
|
-
|
405
323
|
#if 0
|
406
324
|
|
407
325
|
static VALUE
|
@@ -427,7 +345,7 @@ Context_jump(VALUE self, VALUE line, VALUE file)
|
|
427
345
|
#endif
|
428
346
|
|
429
347
|
static VALUE
|
430
|
-
|
348
|
+
Context_step_into(int argc, VALUE *argv, VALUE self)
|
431
349
|
{
|
432
350
|
VALUE steps;
|
433
351
|
VALUE force;
|
@@ -438,7 +356,8 @@ Context_stop_next(int argc, VALUE *argv, VALUE self)
|
|
438
356
|
rb_raise(rb_eRuntimeError, "Steps argument can't be negative.");
|
439
357
|
|
440
358
|
Data_Get_Struct(self, debug_context_t, context);
|
441
|
-
context->
|
359
|
+
context->steps = FIX2INT(steps);
|
360
|
+
|
442
361
|
if(RTEST(force))
|
443
362
|
CTX_FL_SET(context, CTX_FL_FORCE_MOVE);
|
444
363
|
else
|
@@ -458,7 +377,7 @@ Context_step_over(int argc, VALUE *argv, VALUE self)
|
|
458
377
|
rb_raise(rb_eRuntimeError, "No frames collected.");
|
459
378
|
|
460
379
|
rb_scan_args(argc, argv, "12", &lines, &frame, &force);
|
461
|
-
context->
|
380
|
+
context->lines = FIX2INT(lines);
|
462
381
|
|
463
382
|
if (FIX2INT(frame) < 0 && FIX2INT(frame) >= context->stack_size)
|
464
383
|
rb_raise(rb_eRuntimeError, "Destination frame is out of range.");
|
@@ -473,13 +392,14 @@ Context_step_over(int argc, VALUE *argv, VALUE self)
|
|
473
392
|
}
|
474
393
|
|
475
394
|
static VALUE
|
476
|
-
|
395
|
+
Context_step_out(VALUE self, VALUE frame)
|
477
396
|
{
|
478
397
|
debug_context_t *context;
|
479
398
|
|
480
399
|
Data_Get_Struct(self, debug_context_t, context);
|
481
|
-
if(FIX2INT(frame) < 0 && FIX2INT(frame) >= context->stack_size)
|
400
|
+
if (FIX2INT(frame) < 0 && FIX2INT(frame) >= context->stack_size)
|
482
401
|
rb_raise(rb_eRuntimeError, "Stop frame is out of range.");
|
402
|
+
|
483
403
|
context->stop_frame = context->stack_size - FIX2INT(frame);
|
484
404
|
|
485
405
|
return frame;
|
@@ -490,20 +410,15 @@ Context_stop_frame(VALUE self, VALUE frame)
|
|
490
410
|
*
|
491
411
|
* == Summary
|
492
412
|
*
|
493
|
-
* Byebug keeps a single instance of this class
|
413
|
+
* Byebug keeps a single instance of this class.
|
494
414
|
*/
|
495
415
|
VALUE
|
496
416
|
Init_context(VALUE mByebug)
|
497
417
|
{
|
498
418
|
cContext = rb_define_class_under(mByebug, "Context", rb_cObject);
|
499
419
|
rb_define_method(cContext, "stack_size", Context_stack_size, 0);
|
500
|
-
rb_define_method(cContext, "thread", Context_thread, 0);
|
501
420
|
rb_define_method(cContext, "dead?", Context_dead, 0);
|
502
|
-
rb_define_method(cContext, "ignored?", Context_ignored, 0);
|
503
|
-
rb_define_method(cContext, "thnum", Context_thnum, 0);
|
504
421
|
rb_define_method(cContext, "stop_reason", Context_stop_reason, 0);
|
505
|
-
rb_define_method(cContext, "suspend", Context_suspend, 0);
|
506
|
-
rb_define_method(cContext, "suspended?", Context_is_suspended, 0);
|
507
422
|
rb_define_method(cContext, "tracing", Context_tracing, 0);
|
508
423
|
rb_define_method(cContext, "tracing=", Context_set_tracing, 1);
|
509
424
|
rb_define_method(cContext, "frame_file", Context_frame_file, -1);
|
@@ -514,10 +429,9 @@ Init_context(VALUE mByebug)
|
|
514
429
|
rb_define_method(cContext, "frame_class", Context_frame_class, -1);
|
515
430
|
rb_define_method(cContext, "frame_args_info", Context_frame_args_info, -1);
|
516
431
|
rb_define_method(cContext, "frame_locals", Context_frame_locals, -1);
|
517
|
-
rb_define_method(cContext, "
|
518
|
-
rb_define_method(cContext, "step", Context_stop_next, -1);
|
432
|
+
rb_define_method(cContext, "step_into", Context_step_into, -1);
|
519
433
|
rb_define_method(cContext, "step_over", Context_step_over, -1);
|
520
|
-
rb_define_method(cContext, "
|
434
|
+
rb_define_method(cContext, "step_out", Context_step_out, 1);
|
521
435
|
|
522
436
|
return cContext;
|
523
437
|
}
|
data/ext/byebug/extconf.rb
CHANGED
@@ -10,12 +10,3 @@ $CFLAGS += ' -g3' if ENV['debug']
|
|
10
10
|
|
11
11
|
dir_config("ruby")
|
12
12
|
create_makefile("byebug")
|
13
|
-
|
14
|
-
#if !Byebug::RubyCoreSource.create_makefile_with_core(hdrs, "ruby_debug")
|
15
|
-
# STDERR.print("Makefile creation failed\n")
|
16
|
-
# STDERR.print("*************************************************************\n\n")
|
17
|
-
# STDERR.print(" NOTE: If your headers were not found, try passing\n")
|
18
|
-
# STDERR.print(" --with-ruby-include=PATH_TO_HEADERS \n\n")
|
19
|
-
# STDERR.print("*************************************************************\n\n")
|
20
|
-
# exit(1)
|
21
|
-
#end
|
data/lib/byebug.rb
CHANGED
@@ -5,7 +5,6 @@ require_relative 'byebug/processor'
|
|
5
5
|
require 'pp'
|
6
6
|
require 'stringio'
|
7
7
|
require 'socket'
|
8
|
-
require 'thread'
|
9
8
|
require 'linecache19'
|
10
9
|
|
11
10
|
module Byebug
|
@@ -39,26 +38,6 @@ module Byebug
|
|
39
38
|
# A string to look for in caller() to see if the call stack is truncated
|
40
39
|
attr_accessor :start_sentinal
|
41
40
|
|
42
|
-
attr_reader :thread, :control_thread, :cmd_port, :ctrl_port
|
43
|
-
|
44
|
-
#
|
45
|
-
# Interrupts the current thread
|
46
|
-
#
|
47
|
-
def interrupt
|
48
|
-
current_context.interrupt
|
49
|
-
end
|
50
|
-
|
51
|
-
#
|
52
|
-
# Interrupts the last debugged thread
|
53
|
-
#
|
54
|
-
def interrupt_last
|
55
|
-
if context = last_context
|
56
|
-
return nil unless context.thread.alive?
|
57
|
-
context.interrupt
|
58
|
-
end
|
59
|
-
context
|
60
|
-
end
|
61
|
-
|
62
41
|
def source_reload
|
63
42
|
Object.send(:remove_const, "SCRIPT_LINES__") if
|
64
43
|
Object.const_defined?("SCRIPT_LINES__")
|
@@ -98,7 +77,7 @@ module Byebug
|
|
98
77
|
# Byebug.start(options) -> bool
|
99
78
|
# Byebug.start(options) { ... } -> obj
|
100
79
|
#
|
101
|
-
# If it's called without a block it returns +true
|
80
|
+
# If it's called without a block, it returns +true+ unless byebug was
|
102
81
|
# already started.
|
103
82
|
#
|
104
83
|
# If a block is given, it starts byebug and yields block. After the block is
|
@@ -143,90 +122,6 @@ module Byebug
|
|
143
122
|
return retval
|
144
123
|
end
|
145
124
|
|
146
|
-
#
|
147
|
-
# Starts a remote byebug.
|
148
|
-
#
|
149
|
-
def start_remote(host = nil, port = PORT)
|
150
|
-
return if @thread
|
151
|
-
|
152
|
-
self.interface = nil
|
153
|
-
start
|
154
|
-
|
155
|
-
if port.kind_of?(Array)
|
156
|
-
cmd_port, ctrl_port = port
|
157
|
-
else
|
158
|
-
cmd_port, ctrl_port = port, port + 1
|
159
|
-
end
|
160
|
-
|
161
|
-
ctrl_port = start_control(host, ctrl_port)
|
162
|
-
|
163
|
-
yield if block_given?
|
164
|
-
|
165
|
-
mutex = Mutex.new
|
166
|
-
proceed = ConditionVariable.new
|
167
|
-
|
168
|
-
server = TCPServer.new(host, cmd_port)
|
169
|
-
@cmd_port = cmd_port = server.addr[1]
|
170
|
-
@thread = DebugThread.new do
|
171
|
-
while (session = server.accept)
|
172
|
-
self.interface = RemoteInterface.new(session)
|
173
|
-
if wait_connection
|
174
|
-
mutex.synchronize do
|
175
|
-
proceed.signal
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
if wait_connection
|
181
|
-
mutex.synchronize do
|
182
|
-
proceed.wait(mutex)
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
alias start_server start_remote
|
187
|
-
|
188
|
-
def start_control(host = nil, ctrl_port = PORT + 1) # :nodoc:
|
189
|
-
return @ctrl_port if defined?(@control_thread) && @control_thread
|
190
|
-
server = TCPServer.new(host, ctrl_port)
|
191
|
-
@ctrl_port = server.addr[1]
|
192
|
-
@control_thread = DebugThread.new do
|
193
|
-
while (session = server.accept)
|
194
|
-
interface = RemoteInterface.new(session)
|
195
|
-
processor = ControlCommandProcessor.new(interface)
|
196
|
-
processor.process_commands
|
197
|
-
end
|
198
|
-
end
|
199
|
-
@ctrl_port
|
200
|
-
end
|
201
|
-
|
202
|
-
#
|
203
|
-
# Connects to the remote byebug
|
204
|
-
#
|
205
|
-
def start_client(host = 'localhost', port = PORT)
|
206
|
-
require "socket"
|
207
|
-
interface = Byebug::LocalInterface.new
|
208
|
-
socket = TCPSocket.new(host, port)
|
209
|
-
puts "Connected."
|
210
|
-
|
211
|
-
catch(:exit) do
|
212
|
-
while (line = socket.gets)
|
213
|
-
case line
|
214
|
-
when /^PROMPT (.*)$/
|
215
|
-
input = interface.read_command($1)
|
216
|
-
throw :exit unless input
|
217
|
-
socket.puts input
|
218
|
-
when /^CONFIRM (.*)$/
|
219
|
-
input = interface.confirm($1)
|
220
|
-
throw :exit unless input
|
221
|
-
socket.puts input
|
222
|
-
else
|
223
|
-
print line
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|
227
|
-
socket.close
|
228
|
-
end
|
229
|
-
|
230
125
|
##
|
231
126
|
# Runs normal byebug initialization scripts.
|
232
127
|
#
|
@@ -301,25 +196,16 @@ module Byebug
|
|
301
196
|
def handle_post_mortem(exp)
|
302
197
|
return if !exp || !exp.__debug_context ||
|
303
198
|
exp.__debug_context.stack_size == 0
|
304
|
-
|
305
|
-
|
306
|
-
Byebug.tracing = Byebug.current_context.tracing = false
|
199
|
+
orig_tracing = Byebug.tracing?
|
200
|
+
Byebug.tracing = false
|
307
201
|
Byebug.last_exception = exp
|
308
202
|
handler.at_line(exp.__debug_context, exp.__debug_file, exp.__debug_line)
|
309
203
|
ensure
|
310
|
-
Byebug.tracing
|
311
|
-
#Byebug.resume
|
204
|
+
Byebug.tracing = orig_tracing
|
312
205
|
end
|
313
206
|
private :handle_post_mortem
|
314
207
|
|
315
208
|
end
|
316
|
-
|
317
|
-
class DebugThread # :nodoc:
|
318
|
-
end
|
319
|
-
|
320
|
-
class ThreadsTable # :nodoc:
|
321
|
-
end
|
322
|
-
|
323
209
|
end
|
324
210
|
|
325
211
|
class Exception
|
@@ -366,7 +252,7 @@ end
|
|
366
252
|
module Kernel
|
367
253
|
|
368
254
|
##
|
369
|
-
# Enters byebug
|
255
|
+
# Enters byebug after _steps_ line events occur.
|
370
256
|
#
|
371
257
|
# Before entering byebug startup, the init script is read. Setting _steps_ to
|
372
258
|
# 0 will cause a break in byebug's subroutine and not wait for a line event to
|
@@ -378,9 +264,9 @@ module Kernel
|
|
378
264
|
Byebug.start
|
379
265
|
Byebug.run_init_script(StringIO.new)
|
380
266
|
if 0 == steps
|
381
|
-
Byebug.
|
267
|
+
Byebug.context.step_out
|
382
268
|
else
|
383
|
-
Byebug.
|
269
|
+
Byebug.context.step_into steps
|
384
270
|
end
|
385
271
|
end
|
386
272
|
alias breakpoint byebug unless respond_to?(:breakpoint)
|
@@ -390,7 +276,7 @@ module Kernel
|
|
390
276
|
#
|
391
277
|
def binding_n(n = 0)
|
392
278
|
Byebug.skip do
|
393
|
-
Byebug.
|
279
|
+
Byebug.context.frame_binding(n+1)
|
394
280
|
end
|
395
281
|
end
|
396
282
|
end
|