@@ -645,7 +645,7 @@ c_call_new_frame_p(VALUE klass, ID mid)
645
645
{
646
646
klass = real_class (klass );
647
647
if (rb_block_given_p ()) return 1 ;
648
- if (klass == rb_cProc || klass == rb_mKernel || klass == rb_cModule ) return 1 ;
648
+ if (klass == rb_cProc || klass == rb_mKernel || klass == rb_cModule /*|| klass == rb_cFixnum*/ ) return 1 ;
649
649
return 0 ;
650
650
}
651
651
@@ -865,21 +865,27 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
865
865
{
866
866
rb_control_frame_t * cfp = top_frame -> info .runtime .cfp ;
867
867
VALUE hit_count ;
868
+ rb_iseq_t * iseq = cfp -> iseq ;
868
869
869
- /* restore the proper catch table */
870
- cfp -> iseq -> catch_table_size = debug_context -> catch_table .old_catch_table_size ;
871
- cfp -> iseq -> catch_table = debug_context -> catch_table .old_catch_table ;
870
+ if (iseq != NULL ) {
871
+ /* restore the proper catch table */
872
+ iseq -> catch_table_size = debug_context -> catch_table .old_catch_table_size ;
873
+ iseq -> catch_table = debug_context -> catch_table .old_catch_table ;
874
+ }
872
875
873
876
/* send catchpoint notification */
874
- int c_hit_count = FIX2INT (rb_hash_aref (rdebug_catchpoints , debug_context -> catch_table .mod_name )) + 1 ;
875
- hit_count = INT2FIX (c_hit_count );
876
- rb_hash_aset (rdebug_catchpoints , debug_context -> catch_table .mod_name , hit_count );
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);
877
882
debug_context -> stop_reason = CTX_STOP_CATCHPOINT ;
878
883
rb_funcall (context , idAtCatchpoint , 1 , debug_context -> catch_table .errinfo );
879
884
if (self && binding == Qnil )
880
885
binding = create_binding (self );
881
886
save_top_binding (debug_context , binding );
882
887
call_at_line (context , debug_context , rb_str_new2 (file ), INT2FIX (line ));
888
+ rb_raise (rb_eRuntimeError , "rise up" );
883
889
}
884
890
885
891
/* now allow the next exception to be caught */
@@ -1000,7 +1006,12 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
1000
1006
VALUE expn_class , aclass ;
1001
1007
int i ;
1002
1008
1003
- set_frame_source (event , debug_context , self , file , line , mid );
1009
+ if (debug == Qtrue ) {
1010
+ fprintf (stderr , "stack_size %d\n" , debug_context -> stack_size );
1011
+ for (i = 0 ; i < debug_context -> stack_size ; i ++ ) {
1012
+ fprintf (stderr , "%s:%d, iseq: %p\n" , FRAME_N (i )-> file , FRAME_N (i )-> line , FRAME_N (i )-> info .runtime .cfp -> iseq );
1013
+ }
1014
+ }
1004
1015
1005
1016
if (post_mortem == Qtrue && self )
1006
1017
{
@@ -1054,18 +1065,23 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
1054
1065
{
1055
1066
debug_frame_t * top_frame = get_top_frame (debug_context );
1056
1067
rb_control_frame_t * cfp = top_frame -> info .runtime .cfp ;
1057
-
1058
- /* save the current catch table */
1059
- CTX_FL_SET (debug_context , CTX_FL_CATCHING );
1060
- debug_context -> catch_table .old_catch_table_size = cfp -> iseq -> catch_table_size ;
1061
- debug_context -> catch_table .old_catch_table = cfp -> iseq -> catch_table ;
1068
+ rb_iseq_t * iseq = cfp -> iseq ;
1069
+
1062
1070
debug_context -> catch_table .mod_name = mod_name ;
1063
1071
debug_context -> catch_table .errinfo = rb_errinfo ();
1064
-
1065
- /* create a new catch table to catch this exception, and put it in the current iseq */
1066
- cfp -> iseq -> catch_table_size = 1 ;
1067
- cfp -> iseq -> catch_table =
1068
- create_catch_table (debug_context , top_frame -> info .runtime .last_pc - cfp -> iseq -> iseq_encoded - insn_len (BIN (trace )));
1072
+ CTX_FL_SET (debug_context , CTX_FL_CATCHING );
1073
+ if (iseq != NULL ) {
1074
+
1075
+ /* save the current catch table */
1076
+ debug_context -> catch_table .old_catch_table_size = iseq -> catch_table_size ;
1077
+ debug_context -> catch_table .old_catch_table = iseq -> catch_table ;
1078
+
1079
+
1080
+ /* create a new catch table to catch this exception, and put it in the current iseq */
1081
+ iseq -> catch_table_size = 1 ;
1082
+ iseq -> catch_table =
1083
+ create_catch_table (debug_context , top_frame -> info .runtime .last_pc - cfp -> iseq -> iseq_encoded - insn_len (BIN (trace )));
1084
+ }
1069
1085
}
1070
1086
}
1071
1087
0 commit comments