ruby-debug-base19 0.11.22 → 0.11.23
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/ruby_debug/ruby_debug.c +50 -12
- data/ext/ruby_debug/ruby_debug.h +1 -0
- data/lib/ruby-debug-base.rb +3 -1
- metadata +1 -1
data/ext/ruby_debug/ruby_debug.c
CHANGED
@@ -392,6 +392,7 @@ debug_context_create(VALUE thread)
|
|
392
392
|
debug_context->jump_pc = NULL;
|
393
393
|
debug_context->jump_cfp = NULL;
|
394
394
|
debug_context->old_iseq_catch = NULL;
|
395
|
+
debug_context->thread_pause = 0;
|
395
396
|
if(rb_obj_class(thread) == cDebugThread)
|
396
397
|
CTX_FL_SET(debug_context, CTX_FL_IGNORE);
|
397
398
|
return Data_Wrap_Struct(cContext, debug_context_mark, debug_context_free, debug_context);
|
@@ -800,16 +801,27 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
|
|
800
801
|
debug_context->stack_size--;
|
801
802
|
}
|
802
803
|
|
803
|
-
|
804
|
-
if(CTX_FL_TEST(debug_context, CTX_FL_SKIPPED)) goto cleanup;
|
805
|
-
|
806
|
-
if ((event == RUBY_EVENT_LINE) && (debug_context->stack_size > 0) &&
|
807
|
-
(get_top_frame(debug_context)->line == line) && (get_top_frame(debug_context)->info.runtime.cfp->iseq == iseq) &&
|
808
|
-
!CTX_FL_TEST(debug_context, CTX_FL_CATCHING))
|
804
|
+
if (debug_context->thread_pause)
|
809
805
|
{
|
810
|
-
|
811
|
-
|
812
|
-
|
806
|
+
debug_context->thread_pause = 0;
|
807
|
+
debug_context->stop_next = 1;
|
808
|
+
debug_context->dest_frame = -1;
|
809
|
+
moved = 1;
|
810
|
+
}
|
811
|
+
else
|
812
|
+
{
|
813
|
+
/* ignore a skipped section of code */
|
814
|
+
if (CTX_FL_TEST(debug_context, CTX_FL_SKIPPED))
|
815
|
+
goto cleanup;
|
816
|
+
|
817
|
+
if ((event == RUBY_EVENT_LINE) && (debug_context->stack_size > 0) &&
|
818
|
+
(get_top_frame(debug_context)->line == line) && (get_top_frame(debug_context)->info.runtime.cfp->iseq == iseq) &&
|
819
|
+
!CTX_FL_TEST(debug_context, CTX_FL_CATCHING))
|
820
|
+
{
|
821
|
+
/* Sometimes duplicate RUBY_EVENT_LINE messages get generated by the compiler.
|
822
|
+
* Ignore them. */
|
823
|
+
goto cleanup;
|
824
|
+
}
|
813
825
|
}
|
814
826
|
|
815
827
|
if(debug == Qtrue)
|
@@ -892,7 +904,7 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
|
|
892
904
|
(breakpoint = check_breakpoints_by_pos(debug_context, file, line)) != Qnil)
|
893
905
|
{
|
894
906
|
call_at_line_check(self, debug_context, breakpoint, context, file, line);
|
895
|
-
}
|
907
|
+
}
|
896
908
|
break;
|
897
909
|
}
|
898
910
|
case RUBY_EVENT_CALL:
|
@@ -1794,7 +1806,7 @@ context_frame_line(int argc, VALUE *argv, VALUE self)
|
|
1794
1806
|
|
1795
1807
|
pc = GET_FRAME->info.runtime.last_pc;
|
1796
1808
|
cfp = GET_FRAME->info.runtime.cfp;
|
1797
|
-
while (cfp
|
1809
|
+
while (cfp >= th->cfp)
|
1798
1810
|
{
|
1799
1811
|
if ((cfp->iseq != NULL) && (pc >= cfp->iseq->iseq_encoded) && (pc < cfp->iseq->iseq_encoded + cfp->iseq->iseq_size))
|
1800
1812
|
return(INT2FIX(rb_vm_get_sourceline(cfp)));
|
@@ -2307,7 +2319,7 @@ FUNC_FASTCALL(do_jump)(rb_thread_t *th, rb_control_frame_t *cfp)
|
|
2307
2319
|
cfp->pc[-1] = debug_context->saved_jump_ins[1];
|
2308
2320
|
|
2309
2321
|
if ((debug_context->jump_pc < debug_context->jump_cfp->iseq->iseq_encoded) ||
|
2310
|
-
(debug_context->jump_pc >= debug_context->jump_cfp->iseq->iseq_encoded +
|
2322
|
+
(debug_context->jump_pc >= debug_context->jump_cfp->iseq->iseq_encoded + debug_context->jump_cfp->iseq->iseq_size))
|
2311
2323
|
rb_raise(rb_eRuntimeError, "Invalid jump PC target");
|
2312
2324
|
|
2313
2325
|
jump_cfp = debug_context->jump_cfp;
|
@@ -2431,6 +2443,31 @@ context_jump(VALUE self, VALUE line, VALUE file)
|
|
2431
2443
|
return(INT2FIX(3)); /* couldn't find a line and file frame match */
|
2432
2444
|
}
|
2433
2445
|
|
2446
|
+
/*
|
2447
|
+
* call-seq:
|
2448
|
+
* context.break -> bool
|
2449
|
+
*
|
2450
|
+
* Returns +true+ if context is currently running and set flag to break it at next line
|
2451
|
+
*/
|
2452
|
+
static VALUE
|
2453
|
+
context_pause(VALUE self)
|
2454
|
+
{
|
2455
|
+
debug_context_t *debug_context;
|
2456
|
+
rb_thread_t *th;
|
2457
|
+
|
2458
|
+
debug_check_started();
|
2459
|
+
|
2460
|
+
Data_Get_Struct(self, debug_context_t, debug_context);
|
2461
|
+
if (CTX_FL_TEST(debug_context, CTX_FL_DEAD))
|
2462
|
+
return(Qfalse);
|
2463
|
+
|
2464
|
+
GetThreadPtr(context_thread_0(debug_context), th);
|
2465
|
+
if (th == GET_THREAD())
|
2466
|
+
return(Qfalse);
|
2467
|
+
|
2468
|
+
debug_context->thread_pause = 1;
|
2469
|
+
return(Qtrue);
|
2470
|
+
}
|
2434
2471
|
|
2435
2472
|
/*
|
2436
2473
|
* Document-class: Context
|
@@ -2473,6 +2510,7 @@ Init_context()
|
|
2473
2510
|
rb_define_method(cContext, "set_breakpoint",
|
2474
2511
|
context_set_breakpoint, -1); /* in breakpoint.c */
|
2475
2512
|
rb_define_method(cContext, "jump", context_jump, 2);
|
2513
|
+
rb_define_method(cContext, "pause", context_pause, 0);
|
2476
2514
|
}
|
2477
2515
|
|
2478
2516
|
/*
|
data/ext/ruby_debug/ruby_debug.h
CHANGED
data/lib/ruby-debug-base.rb
CHANGED
@@ -47,7 +47,8 @@ module Debugger
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def at_tracing(file, line)
|
50
|
-
|
50
|
+
@tracing_started = true if File.identical?(file, File.join(Debugger::INITIAL_DIR, Debugger::PROG_SCRIPT))
|
51
|
+
handler.at_tracing(self, file, line) if @tracing_started
|
51
52
|
end
|
52
53
|
|
53
54
|
def at_line(file, line)
|
@@ -60,6 +61,7 @@ module Debugger
|
|
60
61
|
end
|
61
62
|
|
62
63
|
@reload_source_on_change = false
|
64
|
+
@tracing_started = false
|
63
65
|
|
64
66
|
class << self
|
65
67
|
# interface modules provide +handler+ object
|