debugger 1.0.0.rc2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -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();
@@ -1,3 +1,4 @@
1
+ require 'rbconfig'
1
2
  bindir = RbConfig::CONFIG['bindir']
2
3
  # autodetect ruby headers
3
4
  if bindir =~ %r{(^.*/\.rbenv/versions)/([^/]+)/bin$}
@@ -10,33 +11,48 @@ end
10
11
 
11
12
  require "mkmf"
12
13
  require "ruby_core_source"
14
+ require 'fileutils'
13
15
 
14
16
  if RUBY_VERSION < "1.9"
15
17
  STDERR.print("Ruby version is too old\n")
16
18
  exit(1)
17
19
  end
18
20
 
19
- hdrs = lambda {
20
- iseqs = %w[vm_core.h iseq.h]
21
- begin
22
- have_struct_member("rb_method_entry_t", "called_id", "method.h") or
23
- have_struct_member("rb_control_frame_t", "method_id", "method.h")
24
- end and
25
- have_header("vm_core.h") and have_header("iseq.h") and have_header("insns.inc") and
26
- have_header("insns_info.inc") and have_header("eval_intern.h") or return(false)
27
- have_type("struct iseq_line_info_entry", iseqs) or
28
- have_type("struct iseq_insn_info_entry", iseqs) or
29
- return(false)
30
- if checking_for(checking_message("if rb_iseq_compile_with_option was added an argument filepath")) do
31
- try_compile(<<SRC)
21
+ hdrs = if RUBY_VERSION == '1.9.2'
22
+ lambda {
23
+ have_struct_member("rb_method_entry_t", "body", "method.h")
24
+ have_header("vm_core.h") and have_header("iseq.h") and have_header("insns.inc") and
25
+ have_header("insns_info.inc") and have_header("eval_intern.h")
26
+ }
27
+ else
28
+ lambda {
29
+ iseqs = %w[vm_core.h iseq.h]
30
+ begin
31
+ have_struct_member("rb_method_entry_t", "called_id", "method.h") or
32
+ have_struct_member("rb_control_frame_t", "method_id", "method.h")
33
+ end and
34
+ have_header("vm_core.h") and have_header("iseq.h") and have_header("insns.inc") and
35
+ have_header("insns_info.inc") and have_header("eval_intern.h") or return(false)
36
+ have_type("struct iseq_line_info_entry", iseqs) or
37
+ have_type("struct iseq_insn_info_entry", iseqs) or
38
+ return(false)
39
+ if checking_for(checking_message("if rb_iseq_compile_with_option was added an argument filepath")) do
40
+ try_compile(<<SRC)
32
41
  #include <ruby.h>
33
42
  #include "vm_core.h"
34
43
  extern VALUE rb_iseq_new_main(NODE *node, VALUE filename, VALUE filepath);
35
44
  SRC
45
+ end
46
+ $defs << '-DRB_ISEQ_COMPILE_5ARGS'
36
47
  end
37
- $defs << '-DRB_ISEQ_COMPILE_5ARGS'
38
- end
39
- }
48
+ }
49
+ end
50
+
51
+ header_dir = RUBY_VERSION == '1.9.2' ? '192' : '193'
52
+ current_dir = File.dirname(__FILE__)
53
+ %w{ruby_debug.h ruby_debug.c breakpoint.c}.each do |file|
54
+ FileUtils.cp("#{current_dir}/#{header_dir}/#{file}", current_dir)
55
+ end
40
56
 
41
57
  dir_config("ruby")
42
58
  if !Ruby_core_source::create_makefile_with_core(hdrs, "ruby_debug")
@@ -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.0.0.rc2'
4
+ VERSION = '1.0.0'
5
5
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debugger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc2
5
- prerelease: 6
4
+ version: 1.0.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kent Sibilev
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-04-04 00:00:00.000000000Z
14
+ date: 2012-04-04 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: columnize
18
- requirement: !ruby/object:Gem::Requirement
18
+ requirement: &70331528522140 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,15 +23,10 @@ dependencies:
23
23
  version: 0.3.1
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: !ruby/object:Gem::Requirement
27
- none: false
28
- requirements:
29
- - - ! '>='
30
- - !ruby/object:Gem::Version
31
- version: 0.3.1
26
+ version_requirements: *70331528522140
32
27
  - !ruby/object:Gem::Dependency
33
28
  name: debugger-ruby_core_source
34
- requirement: !ruby/object:Gem::Requirement
29
+ requirement: &70331528521700 !ruby/object:Gem::Requirement
35
30
  none: false
36
31
  requirements:
37
32
  - - ! '>='
@@ -39,15 +34,10 @@ dependencies:
39
34
  version: '0'
40
35
  type: :runtime
41
36
  prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- none: false
44
- requirements:
45
- - - ! '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
37
+ version_requirements: *70331528521700
48
38
  - !ruby/object:Gem::Dependency
49
39
  name: debugger-linecache
50
- requirement: !ruby/object:Gem::Requirement
40
+ requirement: &70331528521180 !ruby/object:Gem::Requirement
51
41
  none: false
52
42
  requirements:
53
43
  - - ! '>='
@@ -55,15 +45,10 @@ dependencies:
55
45
  version: '0'
56
46
  type: :runtime
57
47
  prerelease: false
58
- version_requirements: !ruby/object:Gem::Requirement
59
- none: false
60
- requirements:
61
- - - ! '>='
62
- - !ruby/object:Gem::Version
63
- version: '0'
48
+ version_requirements: *70331528521180
64
49
  - !ruby/object:Gem::Dependency
65
50
  name: rake
66
- requirement: !ruby/object:Gem::Requirement
51
+ requirement: &70331528520680 !ruby/object:Gem::Requirement
67
52
  none: false
68
53
  requirements:
69
54
  - - ~>
@@ -71,15 +56,10 @@ dependencies:
71
56
  version: 0.9.2.2
72
57
  type: :development
73
58
  prerelease: false
74
- version_requirements: !ruby/object:Gem::Requirement
75
- none: false
76
- requirements:
77
- - - ~>
78
- - !ruby/object:Gem::Version
79
- version: 0.9.2.2
59
+ version_requirements: *70331528520680
80
60
  - !ruby/object:Gem::Dependency
81
61
  name: rake-compiler
82
- requirement: !ruby/object:Gem::Requirement
62
+ requirement: &70331528520180 !ruby/object:Gem::Requirement
83
63
  none: false
84
64
  requirements:
85
65
  - - ~>
@@ -87,12 +67,7 @@ dependencies:
87
67
  version: 0.8.0
88
68
  type: :development
89
69
  prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- none: false
92
- requirements:
93
- - - ~>
94
- - !ruby/object:Gem::Version
95
- version: 0.8.0
70
+ version_requirements: *70331528520180
96
71
  description: ! 'debugger is a fast implementation of the standard Ruby debugger debug.rb.
97
72
 
98
73
  It is implemented by utilizing a new Ruby C API hook. The core component
@@ -205,10 +180,13 @@ files:
205
180
  - emacs/test/test-indent.el
206
181
  - emacs/test/test-regexp.el
207
182
  - emacs/test/test-shortkey.el
208
- - ext/ruby_debug/breakpoint.c
183
+ - ext/ruby_debug/192/breakpoint.c
184
+ - ext/ruby_debug/192/ruby_debug.c
185
+ - ext/ruby_debug/192/ruby_debug.h
186
+ - ext/ruby_debug/193/breakpoint.c
187
+ - ext/ruby_debug/193/ruby_debug.c
188
+ - ext/ruby_debug/193/ruby_debug.h
209
189
  - ext/ruby_debug/extconf.rb
210
- - ext/ruby_debug/ruby_debug.c
211
- - ext/ruby_debug/ruby_debug.h
212
190
  - lib/ChangeLog
213
191
  - lib/debugger.rb
214
192
  - lib/debugger/version.rb
@@ -391,7 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
391
369
  version: 1.3.6
392
370
  requirements: []
393
371
  rubyforge_project:
394
- rubygems_version: 1.8.19
372
+ rubygems_version: 1.8.11
395
373
  signing_key:
396
374
  specification_version: 3
397
375
  summary: Fast Ruby debugger - base + cli