@@ -644,6 +644,8 @@ inline static int
644
644
c_call_new_frame_p (VALUE klass , ID mid )
645
645
{
646
646
klass = real_class (klass );
647
+ // if ((klass == rb_mKernel) && (strcmp(rb_id2name(mid), "raise") == 0)) return 0;
648
+
647
649
if (rb_block_given_p ()) return 1 ;
648
650
if (klass == rb_cProc || klass == rb_mKernel || klass == rb_cModule /*|| klass == rb_cFixnum*/ ) return 1 ;
649
651
return 0 ;
@@ -851,12 +853,6 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
851
853
{
852
854
case RUBY_EVENT_LINE :
853
855
{
854
- if (debug_context -> stack_size == 0 ||
855
- get_top_frame (debug_context )-> info .runtime .block_iseq != thread -> cfp -> block_iseq ||
856
- get_top_frame (debug_context )-> info .runtime .cfp -> iseq != thread -> cfp -> iseq )
857
- save_call_frame (event , debug_context , self , file , line , mid );
858
- else
859
- set_frame_source (event , debug_context , self , file , line , mid );
860
856
if (CTX_FL_TEST (debug_context , CTX_FL_CATCHING ))
861
857
{
862
858
debug_frame_t * top_frame = get_top_frame (debug_context );
@@ -873,25 +869,26 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
873
869
iseq -> catch_table = debug_context -> catch_table .old_catch_table ;
874
870
}
875
871
876
- /* send catchpoint notification */
877
- if (debug == Qtrue )
878
- fprintf (stderr , "modname: %s\n" , RSTRING_PTR (debug_context -> catch_table .mod_name ));
879
- // int c_hit_count = FIX2INT(rb_hash_aref(rdebug_catchpoints, debug_context->catch_table.mod_name)) + 1;
880
- // hit_count = INT2FIX(c_hit_count);
881
- // rb_hash_aset(rdebug_catchpoints, debug_context->catch_table.mod_name, hit_count);
872
+ /* send catchpoint notification */
873
+ int c_hit_count = FIX2INT (rb_hash_aref (rdebug_catchpoints , debug_context -> catch_table .mod_name )) + 1 ;
874
+ hit_count = INT2FIX (c_hit_count );
875
+ rb_hash_aset (rdebug_catchpoints , debug_context -> catch_table .mod_name , hit_count );
882
876
debug_context -> stop_reason = CTX_STOP_CATCHPOINT ;
883
877
rb_funcall (context , idAtCatchpoint , 1 , debug_context -> catch_table .errinfo );
884
878
if (self && binding == Qnil )
885
879
binding = create_binding (self );
886
880
save_top_binding (debug_context , binding );
887
- call_at_line (context , debug_context , rb_str_new2 (file ), INT2FIX (line ));
888
- rb_raise (rb_eRuntimeError , "rise up" );
881
+ call_at_line (context , debug_context , rb_str_new2 (top_frame -> file ), INT2FIX (top_frame -> line ));
889
882
}
890
-
891
- /* now allow the next exception to be caught */
892
- CTX_FL_UNSET (debug_context , CTX_FL_CATCHING );
883
+
893
884
break ;
894
885
}
886
+ if (debug_context -> stack_size == 0 ||
887
+ get_top_frame (debug_context )-> info .runtime .block_iseq != thread -> cfp -> block_iseq ||
888
+ get_top_frame (debug_context )-> info .runtime .cfp -> iseq != thread -> cfp -> iseq )
889
+ save_call_frame (event , debug_context , self , file , line , mid );
890
+ else
891
+ set_frame_source (event , debug_context , self , file , line , mid );
895
892
896
893
if (RTEST (tracing ) || CTX_FL_TEST (debug_context , CTX_FL_TRACING ))
897
894
rb_funcall (context , idAtTracing , 2 , rb_str_new2 (file ), INT2FIX (line ));
@@ -1002,6 +999,13 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
1002
999
}
1003
1000
case RUBY_EVENT_RAISE :
1004
1001
{
1002
+ if (CTX_FL_TEST (debug_context , CTX_FL_CATCHING )) {
1003
+ /* we're re-raising exception after processing line event,
1004
+ now allow the next exception to be caught, don't setup catchers */
1005
+ CTX_FL_UNSET (debug_context , CTX_FL_CATCHING );
1006
+ break ;
1007
+ }
1008
+
1005
1009
VALUE ancestors ;
1006
1010
VALUE expn_class , aclass ;
1007
1011
int i ;
@@ -1080,7 +1084,8 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
1080
1084
/* create a new catch table to catch this exception, and put it in the current iseq */
1081
1085
iseq -> catch_table_size = 1 ;
1082
1086
iseq -> catch_table =
1083
- create_catch_table (debug_context , top_frame -> info .runtime .last_pc - cfp -> iseq -> iseq_encoded - insn_len (BIN (trace )));
1087
+ create_catch_table (debug_context , top_frame -> info .runtime .last_pc - cfp -> iseq -> iseq_encoded - insn_len (BIN (trace )));
1088
+ break ;
1084
1089
}
1085
1090
}
1086
1091
}
0 commit comments