ruby-debug-base19x 0.11.30.pre → 0.11.30.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -0
  2. data/ext/ruby_debug/ruby_debug.c +72 -23
  3. metadata +10 -10
data/Rakefile CHANGED
@@ -13,6 +13,7 @@ desc "Create the core ruby-debug shared library extension"
13
13
  task :lib do
14
14
  Dir.chdir("ext/ruby_debug") do
15
15
  system("#{Gem.ruby} extconf.rb && make")
16
+ exit $?.to_i if $?.to_i != 0
16
17
  end
17
18
  end
18
19
 
@@ -9,7 +9,7 @@
9
9
  #include <insns_info.inc>
10
10
  #include "ruby_debug.h"
11
11
 
12
- #define DEBUG_VERSION "0.11.30.pre"
12
+ #define DEBUG_VERSION "0.11.30.pre2"
13
13
 
14
14
  #define FRAME_N(n) (&debug_context->frames[debug_context->stack_size-(n)-1])
15
15
  #define GET_FRAME (FRAME_N(check_frame_number(debug_context, frame)))
@@ -476,7 +476,7 @@ call_at_line_unprotected(VALUE args)
476
476
  {
477
477
  VALUE context;
478
478
  context = *RARRAY_PTR(args);
479
- return rb_funcall2(context, idAtLine, RARRAY_LEN(args) - 1, RARRAY_PTR(args) + 1);
479
+ return rb_funcall2(context, idAtLine, (int)RARRAY_LEN(args) - 1, RARRAY_PTR(args) + 1);
480
480
  }
481
481
 
482
482
  static VALUE
@@ -536,8 +536,8 @@ int
536
536
  filename_cmp(VALUE source, char *file)
537
537
  {
538
538
  char *source_ptr, *file_ptr;
539
- int s_len, f_len, min_len;
540
- int s,f;
539
+ long s_len, f_len, min_len;
540
+ long s,f;
541
541
  int dirsep_flag = 0;
542
542
 
543
543
  s_len = RSTRING_LEN(source);
@@ -644,8 +644,10 @@ 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
- if(klass == rb_cProc || klass == rb_mKernel || klass == rb_cModule) return 1;
650
+ if(klass == rb_cProc || klass == rb_mKernel || klass == rb_cModule /*|| klass == rb_cFixnum*/) return 1;
649
651
  return 0;
650
652
  }
651
653
 
@@ -851,6 +853,36 @@ 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
  {
856
+ if (CTX_FL_TEST(debug_context, CTX_FL_CATCHING))
857
+ {
858
+ debug_frame_t *top_frame = get_top_frame(debug_context);
859
+
860
+ if (top_frame != NULL)
861
+ {
862
+ rb_control_frame_t *cfp = top_frame->info.runtime.cfp;
863
+ VALUE hit_count;
864
+ rb_iseq_t *iseq = cfp->iseq;
865
+
866
+ if (iseq != NULL) {
867
+ /* restore the proper catch table */
868
+ iseq->catch_table_size = debug_context->catch_table.old_catch_table_size;
869
+ iseq->catch_table = debug_context->catch_table.old_catch_table;
870
+ }
871
+
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);
876
+ debug_context->stop_reason = CTX_STOP_CATCHPOINT;
877
+ rb_funcall(context, idAtCatchpoint, 1, debug_context->catch_table.errinfo);
878
+ if(self && binding == Qnil)
879
+ binding = create_binding(self);
880
+ save_top_binding(debug_context, binding);
881
+ call_at_line(context, debug_context, rb_str_new2(top_frame->file), INT2FIX(top_frame->line));
882
+ }
883
+
884
+ break;
885
+ }
854
886
  if(debug_context->stack_size == 0 ||
855
887
  get_top_frame(debug_context)->info.runtime.block_iseq != thread->cfp->block_iseq ||
856
888
  get_top_frame(debug_context)->info.runtime.cfp->iseq != thread->cfp->iseq)
@@ -967,11 +999,23 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
967
999
  }
968
1000
  case RUBY_EVENT_RAISE:
969
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
+
970
1009
  VALUE ancestors;
971
1010
  VALUE expn_class, aclass;
972
1011
  int i;
973
1012
 
974
- // set_frame_source(event, debug_context, self, file, line, mid);
1013
+ if(debug == Qtrue) {
1014
+ fprintf(stderr, "stack_size %d\n", debug_context->stack_size);
1015
+ for (i = 0; i < debug_context->stack_size; i++) {
1016
+ fprintf(stderr, "%s:%d, iseq: %p\n", FRAME_N(i)->file, FRAME_N(i)->line, FRAME_N(i)->info.runtime.cfp->iseq);
1017
+ }
1018
+ }
975
1019
 
976
1020
  if(post_mortem == Qtrue && self)
977
1021
  {
@@ -1025,19 +1069,24 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
1025
1069
  {
1026
1070
  debug_frame_t *top_frame = get_top_frame(debug_context);
1027
1071
  rb_control_frame_t *cfp = top_frame->info.runtime.cfp;
1028
-
1029
- /* send catchpoint notification */
1030
- int c_hit_count = FIX2INT(rb_hash_aref(rdebug_catchpoints, mod_name)) + 1;
1031
- hit_count = INT2FIX(c_hit_count);
1032
- rb_hash_aset(rdebug_catchpoints, mod_name, hit_count);
1033
- debug_context->stop_reason = CTX_STOP_CATCHPOINT;
1034
- rb_funcall(context, idAtCatchpoint, 1, rb_errinfo());
1035
-
1036
- if(self && binding == Qnil)
1037
- binding = create_binding(self);
1038
- save_top_binding(debug_context, binding);
1039
- call_at_line(context, debug_context, rb_str_new2(file), INT2FIX(line));
1040
- break;
1072
+ rb_iseq_t *iseq = cfp->iseq;
1073
+
1074
+ debug_context->catch_table.mod_name = mod_name;
1075
+ debug_context->catch_table.errinfo = rb_errinfo();
1076
+ CTX_FL_SET(debug_context, CTX_FL_CATCHING);
1077
+ if (iseq != NULL) {
1078
+
1079
+ /* save the current catch table */
1080
+ debug_context->catch_table.old_catch_table_size = iseq->catch_table_size;
1081
+ debug_context->catch_table.old_catch_table = iseq->catch_table;
1082
+
1083
+
1084
+ /* create a new catch table to catch this exception, and put it in the current iseq */
1085
+ iseq->catch_table_size = 1;
1086
+ iseq->catch_table =
1087
+ create_catch_table(debug_context, top_frame->info.runtime.last_pc - cfp->iseq->iseq_encoded - insn_len(BIN(trace)));
1088
+ break;
1089
+ }
1041
1090
  }
1042
1091
  }
1043
1092
 
@@ -1691,7 +1740,7 @@ check_frame_number(debug_context_t *debug_context, VALUE frame)
1691
1740
  return frame_n;
1692
1741
  }
1693
1742
 
1694
- static int
1743
+ static long
1695
1744
  optional_frame_position(int argc, VALUE *argv) {
1696
1745
  unsigned int i_scanned;
1697
1746
  VALUE level;
@@ -2317,7 +2366,7 @@ FUNC_FASTCALL(do_jump)(rb_thread_t *th, rb_control_frame_t *cfp)
2317
2366
  +1 for target frame
2318
2367
  +1 for array terminator
2319
2368
  */
2320
- int frames = jump_cfp - cfp + 2;
2369
+ long frames = jump_cfp - cfp + 2;
2321
2370
  debug_context->old_iseq_catch = (iseq_catch_t*)malloc(frames * sizeof(iseq_catch_t));
2322
2371
  MEMZERO(debug_context->old_iseq_catch, iseq_catch_t, frames);
2323
2372
  frames = 0;
@@ -2361,7 +2410,7 @@ context_jump(VALUE self, VALUE line, VALUE file)
2361
2410
  {
2362
2411
  debug_context_t *debug_context;
2363
2412
  debug_frame_t *debug_frame;
2364
- int i;
2413
+ unsigned i;
2365
2414
  rb_thread_t *th;
2366
2415
  rb_control_frame_t *cfp;
2367
2416
  rb_control_frame_t *cfp_end;
@@ -2385,7 +2434,7 @@ context_jump(VALUE self, VALUE line, VALUE file)
2385
2434
  if (cfp->pc == debug_frame->info.runtime.last_pc)
2386
2435
  {
2387
2436
  cfp_start = cfp;
2388
- if ((cfp->pc - cfp->iseq->iseq_encoded) >= (cfp->iseq->iseq_size - 1))
2437
+ if ((unsigned)(cfp->pc - cfp->iseq->iseq_encoded) >= (cfp->iseq->iseq_size - 1))
2389
2438
  return(INT2FIX(1)); /* no space for opt_call_c_function hijack */
2390
2439
  break;
2391
2440
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-debug-base19x
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.30.pre
4
+ version: 0.11.30.pre2
5
5
  prerelease: 8
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-10 00:00:00.000000000Z
12
+ date: 2011-08-13 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: columnize
16
- requirement: &70174364715960 !ruby/object:Gem::Requirement
16
+ requirement: &70261391956160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.3.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70174364715960
24
+ version_requirements: *70261391956160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: ruby_core_source
27
- requirement: &70174364715480 !ruby/object:Gem::Requirement
27
+ requirement: &70261391955680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.1.4
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70174364715480
35
+ version_requirements: *70261391955680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: linecache19
38
- requirement: &70174364715000 !ruby/object:Gem::Requirement
38
+ requirement: &70261391955200 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.5.11
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70174364715000
46
+ version_requirements: *70261391955200
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &70174364714540 !ruby/object:Gem::Requirement
49
+ requirement: &70261391971120 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 0.8.1
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70174364714540
57
+ version_requirements: *70261391971120
58
58
  description: ! 'ruby-debug is a fast implementation of the standard Ruby debugger
59
59
  debug.rb.
60
60