ruby-debug 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/CHANGES +4 -0
  2. data/Rakefile +19 -10
  3. data/ext/ruby_debug.c +46 -34
  4. metadata +2 -2
data/CHANGES CHANGED
@@ -1,3 +1,7 @@
1
+ 0.1.5 (2006-06-13)
2
+ - Now the check for a breakpoint uses base filename of the source file.
3
+ - Removed compilation warnings when compiling with -Wall
4
+
1
5
  0.1.4 (2006-06-12)
2
6
  - Remembers the previous command. Invoke it by typing a carriage return
3
7
  at the command prompt.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake/rdoctask'
5
5
  SO_NAME = "ruby_debug.so"
6
6
 
7
7
  # ------- Default Package ----------
8
- RUBY_DEBUG_VERSION = "0.1.4"
8
+ RUBY_DEBUG_VERSION = "0.1.5"
9
9
 
10
10
  FILES = FileList[
11
11
  'Rakefile',
@@ -41,7 +41,7 @@ EOF
41
41
  spec.files = FILES.to_a
42
42
 
43
43
  spec.required_ruby_version = '>= 1.8.2'
44
- spec.date = DateTime.now
44
+ spec.date = DateTime.now
45
45
  spec.rubyforge_project = 'ruby-debug'
46
46
 
47
47
  # rdoc
@@ -55,16 +55,25 @@ Rake::GemPackageTask.new(default_spec) do |pkg|
55
55
  pkg.need_tar = true
56
56
  end
57
57
 
58
- task :default => :package
58
+ task :default => [:package]
59
59
 
60
- # --------- Publish to RubyForge ----------------
61
60
  desc "Publish ruby-debug to RubyForge."
62
61
  task :publish do
63
- require 'rake/contrib/sshpublisher'
64
-
65
- # Get ruby-debug path
66
- ruby_debug_path = File.expand_path(File.dirname(__FILE__))
62
+ require 'rake/contrib/sshpublisher'
63
+
64
+ # Get ruby-debug path
65
+ ruby_debug_path = File.expand_path(File.dirname(__FILE__))
67
66
 
68
- publisher = Rake::SshDirPublisher.new("kent@rubyforge.org",
69
- "/var/www/gforge-projects/ruby-debug", ruby_debug_path)
67
+ publisher = Rake::SshDirPublisher.new("kent@rubyforge.org",
68
+ "/var/www/gforge-projects/ruby-debug", ruby_debug_path)
70
69
  end
70
+
71
+ desc "Clear temp files"
72
+ task :clean do
73
+ cd "ext" do
74
+ if File.exists?("Makefile")
75
+ sh "make clean"
76
+ rm "Makefile"
77
+ end
78
+ end
79
+ end
data/ext/ruby_debug.c CHANGED
@@ -4,7 +4,7 @@
4
4
  #include <rubysig.h>
5
5
  #include <st.h>
6
6
 
7
- #define DEBUG_VERSION "0.1.4"
7
+ #define DEBUG_VERSION "0.1.5"
8
8
 
9
9
  typedef struct {
10
10
  int thnum;
@@ -48,6 +48,10 @@ static ID idAtBreakpoint;
48
48
  static ID idAtCatchpoint;
49
49
  static ID idAtTracing;
50
50
  static ID idBinding;
51
+ static ID idBasename;
52
+ static ID idEval;
53
+ static ID idList;
54
+ static ID idClear;
51
55
 
52
56
  static int thnum_max = 0;
53
57
  static int last_debugged_thnum = 0;
@@ -62,7 +66,7 @@ debug_is_started(VALUE self)
62
66
  return threads_tbl != Qnil ? Qtrue : Qfalse;
63
67
  }
64
68
 
65
- static VALUE
69
+ static void
66
70
  debug_check_started()
67
71
  {
68
72
  if(threads_tbl == Qnil)
@@ -178,6 +182,12 @@ save_call_frame(VALUE self, VALUE file, VALUE line, ID mid, debug_context_t *deb
178
182
  rb_ary_unshift(debug_context->frames, frame);
179
183
  }
180
184
 
185
+ static VALUE
186
+ basename(VALUE filename)
187
+ {
188
+ return rb_funcall(rb_cFile, idBasename, 1, filename);
189
+ }
190
+
181
191
  static int
182
192
  check_breakpoints(VALUE context, VALUE file, VALUE klass, VALUE pos)
183
193
  {
@@ -194,8 +204,8 @@ check_breakpoints(VALUE context, VALUE file, VALUE klass, VALUE pos)
194
204
  if(debug_breakpoint->pos != pos && !(TYPE(pos) == T_STRING &&
195
205
  TYPE(debug_breakpoint->pos) == T_STRING && rb_str_cmp(debug_breakpoint->pos, pos) == 0))
196
206
  continue;
197
- if(rb_str_cmp(debug_breakpoint->source, file) == 0 ||
198
- klass != Qnil && rb_str_cmp(debug_breakpoint->source, rb_mod_name(klass)) == 0)
207
+ if((rb_str_cmp(debug_breakpoint->source, basename(file)) == 0) ||
208
+ (klass != Qnil && rb_str_cmp(debug_breakpoint->source, rb_mod_name(klass)) == 0))
199
209
  return i;
200
210
  }
201
211
  return -1;
@@ -213,7 +223,6 @@ create_binding(VALUE self)
213
223
 
214
224
  if(f_binding == NULL)
215
225
  {
216
- ID idBinding = rb_intern("binding");
217
226
  NODE *body, *method;
218
227
  st_lookup(RCLASS(rb_mKernel)->m_tbl, idBinding, (st_data_t *)&body);
219
228
  method = (NODE *)body->u2.value;
@@ -248,7 +257,7 @@ get_breakpoint_at(int index)
248
257
  static VALUE
249
258
  eval_expression(VALUE args)
250
259
  {
251
- return rb_funcall(rb_mKernel, rb_intern("eval"), 2, RARRAY(args)->ptr[0], RARRAY(args)->ptr[1]);
260
+ return rb_funcall(rb_mKernel, idEval, 2, RARRAY(args)->ptr[0], RARRAY(args)->ptr[1]);
252
261
  }
253
262
 
254
263
  static int
@@ -271,7 +280,6 @@ debug_event_hook(rb_event_t event, NODE *node, VALUE self, ID mid, VALUE klass)
271
280
  {
272
281
  VALUE thread, context, binding, breakpoint;
273
282
  debug_context_t *debug_context;
274
- debug_breakpoint_t *debug_breakpoint;
275
283
  VALUE file = Qnil, line = Qnil;
276
284
  int breakpoint_index = -1;
277
285
 
@@ -393,7 +401,7 @@ debug_event_hook(rb_event_t event, NODE *node, VALUE self, ID mid, VALUE klass)
393
401
  {
394
402
  VALUE ancestors;
395
403
  VALUE expn_class, aclass;
396
- int i, found = 0;
404
+ int i;
397
405
 
398
406
  expn_class = rb_obj_class(ruby_errinfo);
399
407
  if( !NIL_P(rb_class_inherited_p(expn_class, rb_eSystemExit)) )
@@ -524,7 +532,7 @@ debug_set_catchpoint(VALUE self, VALUE value)
524
532
  debug_check_started();
525
533
 
526
534
  if (!NIL_P(value) && TYPE(value) != T_STRING) {
527
- rb_raise(rb_eTypeError, "value of checkpoint must be String");
535
+ rb_raise(rb_eTypeError, "value of checkpoint must be String");
528
536
  }
529
537
  if(NIL_P(value))
530
538
  catchpoint = Qnil;
@@ -556,8 +564,8 @@ find_last_context_func(VALUE key, VALUE value, VALUE *result)
556
564
  Data_Get_Struct(value, debug_context_t, debug_context);
557
565
  if(debug_context->thnum == last_debugged_thnum)
558
566
  {
559
- *result = value;
560
- return ST_STOP;
567
+ *result = value;
568
+ return ST_STOP;
561
569
  }
562
570
  return ST_CONTINUE;
563
571
  }
@@ -573,7 +581,7 @@ find_last_context()
573
581
  static VALUE
574
582
  debug_interrupt_last(VALUE self)
575
583
  {
576
- VALUE thread, context = Qnil;
584
+ VALUE context = Qnil;
577
585
  debug_context_t *debug_context;
578
586
 
579
587
  debug_check_started();
@@ -581,8 +589,8 @@ debug_interrupt_last(VALUE self)
581
589
  context = find_last_context();
582
590
  if(context != Qnil)
583
591
  {
584
- Data_Get_Struct(context, debug_context_t, debug_context);
585
- debug_context->stop_next = 1;
592
+ Data_Get_Struct(context, debug_context_t, debug_context);
593
+ debug_context->stop_next = 1;
586
594
  }
587
595
 
588
596
  return Qnil;
@@ -613,22 +621,22 @@ debug_contexts(VALUE self)
613
621
  debug_check_started();
614
622
 
615
623
  new_list = rb_ary_new();
616
- list = rb_funcall(rb_cThread, rb_intern("list"), 0);
624
+ list = rb_funcall(rb_cThread, idList, 0);
617
625
  for(i = 0; i < RARRAY(list)->len; i++)
618
626
  {
619
- thread = rb_ary_entry(list, i);
620
- context = thread_context_lookup(thread);
621
- rb_ary_push(new_list, context);
627
+ thread = rb_ary_entry(list, i);
628
+ context = thread_context_lookup(thread);
629
+ rb_ary_push(new_list, context);
622
630
  }
623
631
  /*
624
632
  * I wonder why rb_hash_clear is declared static?
625
633
  */
626
- rb_funcall(threads_tbl, rb_intern("clear"), 0);
634
+ rb_funcall(threads_tbl, idClear, 0);
627
635
  for(i = 0; i < RARRAY(new_list)->len; i++)
628
636
  {
629
- context = rb_ary_entry(new_list, i);
630
- Data_Get_Struct(context, debug_context_t, debug_context);
631
- rb_hash_aset(threads_tbl, debug_context->thread, context);
637
+ context = rb_ary_entry(new_list, i);
638
+ Data_Get_Struct(context, debug_context_t, debug_context);
639
+ rb_hash_aset(threads_tbl, debug_context->thread, context);
632
640
  }
633
641
 
634
642
  return new_list;
@@ -652,18 +660,18 @@ debug_suspend(VALUE self)
652
660
 
653
661
  for(i = 0; i < RARRAY(context_list)->len; i++)
654
662
  {
655
- context = rb_ary_entry(context_list, i);
656
- if(current == context)
657
- continue;
658
- Data_Get_Struct(context, debug_context_t, debug_context);
659
- debug_context->suspend = 1;
663
+ context = rb_ary_entry(context_list, i);
664
+ if(current == context)
665
+ continue;
666
+ Data_Get_Struct(context, debug_context_t, debug_context);
667
+ debug_context->suspend = 1;
660
668
  }
661
669
  rb_thread_critical = saved_crit;
662
670
 
663
671
  if(rb_thread_critical == Qfalse)
664
672
  rb_thread_schedule();
665
673
 
666
- return context;
674
+ return self;
667
675
  }
668
676
 
669
677
  static VALUE
@@ -685,11 +693,11 @@ debug_resume(VALUE self)
685
693
  current = thread_context_lookup(rb_thread_current());
686
694
  for(i = 0; i < RARRAY(context_list)->len; i++)
687
695
  {
688
- context = rb_ary_entry(context_list, i);
689
- if(current == context)
690
- continue;
691
- Data_Get_Struct(context, debug_context_t, debug_context);
692
- debug_context->suspend = 0;
696
+ context = rb_ary_entry(context_list, i);
697
+ if(current == context)
698
+ continue;
699
+ Data_Get_Struct(context, debug_context_t, debug_context);
700
+ debug_context->suspend = 0;
693
701
  }
694
702
  for(i = 0; i < RARRAY(waiting)->len; i++)
695
703
  {
@@ -701,7 +709,7 @@ debug_resume(VALUE self)
701
709
 
702
710
  rb_thread_schedule();
703
711
 
704
- return context;
712
+ return self;
705
713
  }
706
714
 
707
715
  static VALUE
@@ -971,6 +979,10 @@ Init_ruby_debug()
971
979
  idAtCatchpoint = rb_intern("at_catchpoint");
972
980
  idAtTracing = rb_intern("at_tracing");
973
981
  idBinding = rb_intern("binding");
982
+ idBasename = rb_intern("basename");
983
+ idEval = rb_intern("eval");
984
+ idList = rb_intern("list");
985
+ idClear = rb_intern("clear");
974
986
 
975
987
  rb_global_variable(&threads_tbl);
976
988
  rb_global_variable(&breakpoints);
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: ruby-debug
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.4
7
- date: 2006-07-12 20:47:26 -04:00
6
+ version: 0.1.5
7
+ date: 2006-07-13 08:20:06 -04:00
8
8
  summary: Fast Ruby debugger
9
9
  require_paths:
10
10
  - lib