debugger 1.3.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,148 @@
1
+ /* Context info */
2
+ enum ctx_stop_reason {CTX_STOP_NONE, CTX_STOP_STEP, CTX_STOP_BREAKPOINT,
3
+ CTX_STOP_CATCHPOINT};
4
+
5
+ /* Context flags */
6
+ #define CTX_FL_SUSPEND (1<<1)
7
+ #define CTX_FL_TRACING (1<<2)
8
+ #define CTX_FL_SKIPPED (1<<3)
9
+ #define CTX_FL_IGNORE (1<<4)
10
+ #define CTX_FL_DEAD (1<<5)
11
+ #define CTX_FL_WAS_RUNNING (1<<6)
12
+ #define CTX_FL_ENABLE_BKPT (1<<7)
13
+ #define CTX_FL_STEPPED (1<<8)
14
+ #define CTX_FL_FORCE_MOVE (1<<9)
15
+ #define CTX_FL_CATCHING (1<<10)
16
+
17
+ #define CTX_FL_TEST(c,f) ((c)->flags & (f))
18
+ #define CTX_FL_SET(c,f) do { (c)->flags |= (f); } while (0)
19
+ #define CTX_FL_UNSET(c,f) do { (c)->flags &= ~(f); } while (0)
20
+
21
+ typedef struct {
22
+ struct iseq_catch_table_entry tmp_catch_table;
23
+ struct iseq_catch_table_entry *old_catch_table;
24
+ int old_catch_table_size;
25
+ VALUE mod_name;
26
+ VALUE errinfo;
27
+ } debug_catch_t;
28
+
29
+ typedef struct {
30
+ struct rb_iseq_struct *iseq;
31
+ struct iseq_catch_table_entry *catch_table;
32
+ int catch_table_size;
33
+ } iseq_catch_t;
34
+
35
+ typedef struct {
36
+ int argc; /* Number of arguments a frame should have. */
37
+ VALUE binding;
38
+ ID id;
39
+ ID orig_id;
40
+ int line;
41
+ const char * file;
42
+ short dead;
43
+ VALUE self;
44
+ VALUE arg_ary;
45
+ union {
46
+ struct {
47
+ rb_control_frame_t *cfp;
48
+ VALUE *bp;
49
+ struct rb_iseq_struct *block_iseq;
50
+ VALUE *block_pc;
51
+ VALUE *last_pc;
52
+ } runtime;
53
+ struct {
54
+ VALUE args;
55
+ VALUE locals;
56
+ VALUE arg_ary;
57
+ } copy;
58
+ } info;
59
+ } debug_frame_t;
60
+
61
+ typedef struct {
62
+ VALUE thread_id;
63
+ int thnum;
64
+ int flags;
65
+ enum ctx_stop_reason stop_reason;
66
+ int stop_next;
67
+ int dest_frame;
68
+ int stop_line;
69
+ int stop_frame;
70
+ int stack_size;
71
+ int stack_len;
72
+ debug_frame_t *frames;
73
+ const char * last_file;
74
+ int last_line;
75
+ VALUE breakpoint;
76
+ debug_catch_t catch_table;
77
+ VALUE saved_jump_ins[2];
78
+ rb_control_frame_t *jump_cfp;
79
+ VALUE *jump_pc;
80
+ iseq_catch_t *old_iseq_catch;
81
+ volatile int thread_pause;
82
+ } debug_context_t;
83
+
84
+ /* variables in ruby_debug.c */
85
+ extern VALUE mDebugger;
86
+ extern VALUE rdebug_breakpoints;
87
+ extern VALUE rdebug_catchpoints;
88
+ extern VALUE rdebug_threads_tbl;
89
+
90
+ /* routines in ruby_debug.c */
91
+ extern int filename_cmp(VALUE source, char *file);
92
+
93
+ #define IS_STARTED (rdebug_threads_tbl != Qnil)
94
+ static inline void
95
+ debug_check_started()
96
+ {
97
+ if(!IS_STARTED)
98
+ {
99
+ rb_raise(rb_eRuntimeError, "Debugger.start is not called yet.");
100
+ }
101
+ }
102
+
103
+ static inline int
104
+ classname_cmp(VALUE name, VALUE klass)
105
+ {
106
+ VALUE mod_name;
107
+ VALUE class_name = (Qnil == name) ? rb_str_new2("main") : name;
108
+ if (klass == Qnil) return(0);
109
+ mod_name = rb_mod_name(klass);
110
+ return (mod_name != Qnil
111
+ && rb_str_cmp(class_name, mod_name) == 0);
112
+ }
113
+
114
+ /* Breakpoint information */
115
+ enum bp_type {BP_POS_TYPE, BP_METHOD_TYPE};
116
+ enum hit_condition {HIT_COND_NONE, HIT_COND_GE, HIT_COND_EQ, HIT_COND_MOD};
117
+
118
+ typedef struct {
119
+ int id;
120
+ enum bp_type type;
121
+ VALUE source;
122
+ union
123
+ {
124
+ int line;
125
+ ID mid;
126
+ } pos;
127
+ VALUE expr;
128
+ VALUE enabled;
129
+ int hit_count;
130
+ int hit_value;
131
+ enum hit_condition hit_condition;
132
+ } debug_breakpoint_t;
133
+
134
+ /* routines in breakpoint.c */
135
+ extern int check_breakpoint_expression(VALUE breakpoint, VALUE binding);
136
+ extern int check_breakpoint_hit_condition(VALUE breakpoint);
137
+ extern VALUE check_breakpoints_by_method(debug_context_t *debug_context,
138
+ VALUE klass, ID mid, VALUE self);
139
+ extern VALUE check_breakpoints_by_pos(debug_context_t *debug_context,
140
+ char *file, int line);
141
+ extern VALUE create_breakpoint_from_args(int argc, VALUE *argv, int id);
142
+ extern VALUE context_breakpoint(VALUE self);
143
+ extern VALUE context_set_breakpoint(int argc, VALUE *argv, VALUE self);
144
+ extern VALUE rdebug_add_catchpoint(VALUE self, VALUE value);
145
+ extern VALUE debug_catchpoints(VALUE self);
146
+ extern VALUE rdebug_remove_breakpoint(VALUE self, VALUE id_value);
147
+
148
+ extern void Init_breakpoint();
@@ -3,10 +3,10 @@ unless ARGV.any? {|arg| arg.include?('--with-ruby-include') }
3
3
  require 'rbconfig'
4
4
  bindir = RbConfig::CONFIG['bindir']
5
5
  if bindir =~ %r{(^.*/\.rbenv/versions)/([^/]+)/bin$}
6
- ruby_include = "#{$1}/#{$2}/include/ruby-1.9.1/ruby-#{$2}"
6
+ ruby_include = "#{$1}/#{$2}/include/ruby-#{RUBY_VERSION.start_with?("1.9") ? "1.9.1" : RUBY_VERSION}/ruby-#{$2}"
7
7
  ARGV << "--with-ruby-include=#{ruby_include}"
8
8
  elsif bindir =~ %r{(^.*/\.rvm/rubies)/([^/]+)/bin$}
9
- ruby_include = "#{$1}/#{$2}/include/ruby-1.9.1/#{$2}"
9
+ ruby_include = "#{$1}/#{$2}/include/ruby-#{RUBY_VERSION.start_with?("1.9") ? "1.9.1" : RUBY_VERSION}/#{$2}"
10
10
  ruby_include = "#{ENV['rvm_path']}/src/#{$2}" unless File.exist?(ruby_include)
11
11
  ARGV << "--with-ruby-include=#{ruby_include}"
12
12
  end
@@ -27,7 +27,7 @@ hdrs = if RUBY_VERSION == '1.9.2'
27
27
  have_header("vm_core.h") and have_header("iseq.h") and have_header("insns.inc") and
28
28
  have_header("insns_info.inc") and have_header("eval_intern.h")
29
29
  }
30
- else
30
+ elsif RUBY_VERSION == '1.9.3'
31
31
  lambda {
32
32
  iseqs = %w[vm_core.h iseq.h]
33
33
  begin
@@ -49,9 +49,35 @@ SRC
49
49
  $defs << '-DRB_ISEQ_COMPILE_5ARGS'
50
50
  end
51
51
  }
52
+ elsif RUBY_VERSION == '2.0.0'
53
+ lambda {
54
+ iseqs = %w[vm_core.h iseq.h]
55
+ begin
56
+ have_struct_member("rb_method_entry_t", "called_id", "method.h") or
57
+ have_struct_member("rb_control_frame_t", "method_id", "method.h")
58
+ end and
59
+ have_header("vm_core.h") and have_header("iseq.h") and have_header("insns.inc") and
60
+ have_header("insns_info.inc") and have_header("eval_intern.h") or return(false)
61
+ have_type("struct iseq_line_info_entry", iseqs) or
62
+ have_type("struct iseq_insn_info_entry", iseqs) or
63
+ return(false)
64
+ if checking_for(checking_message("if rb_iseq_compile_with_option was added an argument filepath")) do
65
+ try_compile(<<SRC)
66
+ #include <ruby.h>
67
+ #include "vm_core.h"
68
+ extern VALUE rb_iseq_new_main(NODE *node, VALUE filename, VALUE filepath);
69
+ SRC
70
+ end
71
+ $defs << "-DHAVE_RB_ISEQ_COMPILE_ON_BASE -DVM_DEBUG_BP_CHECK -DHAVE_RB_CONTROL_FRAME_T_EP -DHAVE_RB_ISEQ_T_LOCATION -DHAVE_RB_ISEQ_T_LINE_INFO_SIZE "
72
+ end
73
+ }
74
+ else
75
+ STDERR.puts "Ruby version #{RUBY_VERSION} is not supported."
76
+ exit(1)
52
77
  end
53
78
 
54
- header_dir = RUBY_VERSION == '1.9.2' ? '192' : '193'
79
+
80
+ header_dir = RUBY_VERSION.gsub('.', '')
55
81
  current_dir = File.dirname(__FILE__)
56
82
  %w{ruby_debug.h ruby_debug.c breakpoint.c}.each do |file|
57
83
  FileUtils.cp("#{current_dir}/#{header_dir}/#{file}", current_dir)
@@ -1,5 +1,5 @@
1
1
  module Debugger
2
2
  # TODO: remove version from C ext
3
3
  send :remove_const, :VERSION if const_defined? :VERSION
4
- VERSION = '1.3.3'
4
+ VERSION = '1.4.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debugger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-02-24 00:00:00.000000000Z
14
+ date: 2013-03-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: columnize
@@ -206,6 +206,9 @@ files:
206
206
  - ext/ruby_debug/193/breakpoint.c
207
207
  - ext/ruby_debug/193/ruby_debug.c
208
208
  - ext/ruby_debug/193/ruby_debug.h
209
+ - ext/ruby_debug/200/breakpoint.c
210
+ - ext/ruby_debug/200/ruby_debug.c
211
+ - ext/ruby_debug/200/ruby_debug.h
209
212
  - ext/ruby_debug/extconf.rb
210
213
  - lib/debugger.rb
211
214
  - lib/debugger/version.rb
@@ -346,7 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
346
349
  version: 1.3.6
347
350
  requirements: []
348
351
  rubyforge_project:
349
- rubygems_version: 1.8.19
352
+ rubygems_version: 1.8.23
350
353
  signing_key:
351
354
  specification_version: 3
352
355
  summary: Fast Ruby debugger - base + cli