readapt 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +16 -16
  3. data/.rspec +2 -2
  4. data/.travis.yml +19 -19
  5. data/CHANGELOG.md +91 -87
  6. data/Gemfile +4 -4
  7. data/LICENSE.txt +21 -21
  8. data/README.md +37 -37
  9. data/Rakefile +14 -14
  10. data/bin/console +14 -14
  11. data/bin/setup +8 -8
  12. data/exe/readapt +5 -5
  13. data/ext/readapt/breakpoints.c +83 -83
  14. data/ext/readapt/breakpoints.h +11 -11
  15. data/ext/readapt/extconf.rb +0 -0
  16. data/ext/readapt/frame.c +137 -137
  17. data/ext/readapt/frame.h +17 -17
  18. data/ext/readapt/inspector.c +51 -51
  19. data/ext/readapt/inspector.h +8 -8
  20. data/ext/readapt/lookup_table.c +211 -211
  21. data/ext/readapt/lookup_table.h +30 -30
  22. data/ext/readapt/monitor.c +0 -0
  23. data/ext/readapt/monitor.h +0 -0
  24. data/ext/readapt/normalize.c +59 -59
  25. data/ext/readapt/normalize.h +7 -7
  26. data/ext/readapt/readapt.c +18 -18
  27. data/ext/readapt/stack.c +86 -86
  28. data/ext/readapt/stack.h +20 -20
  29. data/ext/readapt/threads.c +13 -2
  30. data/ext/readapt/threads.h +2 -1
  31. data/lib/readapt.rb +21 -21
  32. data/lib/readapt/adapter.rb +98 -98
  33. data/lib/readapt/breakpoint.rb +21 -21
  34. data/lib/readapt/data_reader.rb +62 -62
  35. data/lib/readapt/debugger.rb +227 -228
  36. data/lib/readapt/error.rb +63 -63
  37. data/lib/readapt/finder.rb +34 -34
  38. data/lib/readapt/frame.rb +40 -40
  39. data/lib/readapt/input.rb +7 -7
  40. data/lib/readapt/message.rb +62 -62
  41. data/lib/readapt/message/attach.rb +11 -11
  42. data/lib/readapt/message/base.rb +32 -32
  43. data/lib/readapt/message/configuration_done.rb +11 -11
  44. data/lib/readapt/message/continue.rb +15 -15
  45. data/lib/readapt/message/disconnect.rb +13 -13
  46. data/lib/readapt/message/evaluate.rb +18 -18
  47. data/lib/readapt/message/initialize.rb +21 -21
  48. data/lib/readapt/message/launch.rb +11 -11
  49. data/lib/readapt/message/next.rb +12 -12
  50. data/lib/readapt/message/pause.rb +11 -11
  51. data/lib/readapt/message/scopes.rb +26 -26
  52. data/lib/readapt/message/set_breakpoints.rb +25 -25
  53. data/lib/readapt/message/set_exception_breakpoints.rb +11 -11
  54. data/lib/readapt/message/stack_trace.rb +38 -38
  55. data/lib/readapt/message/step_in.rb +11 -11
  56. data/lib/readapt/message/step_out.rb +11 -11
  57. data/lib/readapt/message/threads.rb +18 -18
  58. data/lib/readapt/message/variables.rb +53 -53
  59. data/lib/readapt/monitor.rb +0 -0
  60. data/lib/readapt/output.rb +25 -25
  61. data/lib/readapt/references.rb +27 -27
  62. data/lib/readapt/server.rb +22 -22
  63. data/lib/readapt/shell.rb +104 -104
  64. data/lib/readapt/snapshot.rb +0 -0
  65. data/lib/readapt/thread.rb +20 -25
  66. data/lib/readapt/variable.rb +0 -0
  67. data/lib/readapt/version.rb +3 -3
  68. data/readapt.gemspec +39 -39
  69. metadata +3 -3
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/readapt CHANGED
@@ -1,5 +1,5 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "readapt"
4
-
5
- Readapt::Shell.start(ARGV)
1
+ #!/usr/bin/env ruby
2
+
3
+ require "readapt"
4
+
5
+ Readapt::Shell.start(ARGV)
@@ -1,83 +1,83 @@
1
- #include "ruby.h"
2
- #include "lookup_table.h"
3
-
4
- static VALUE m_Breakpoints;
5
- lt_lookup_table *ht;
6
-
7
- void breakpoints_set(char *file, long *lines)
8
- {
9
-
10
- }
11
-
12
- static VALUE breakpoints_set_s(VALUE self, VALUE file, VALUE lines)
13
- {
14
- long length = NUM2LONG(rb_funcall(lines, rb_intern("length"), 0));
15
- long *ll;
16
- long i;
17
-
18
- ll = malloc(sizeof(long) * length);
19
- for (i = 0; i < length; i++)
20
- {
21
- ll[i] = NUM2LONG(rb_ary_entry(lines, i));
22
- }
23
- lt_insert(ht, StringValueCStr(file), ll, length);
24
- free(ll);
25
- return Qnil;
26
- }
27
-
28
- void breakpoints_delete(char *file)
29
- {
30
-
31
- }
32
-
33
- static VALUE breakpoints_delete_s(VALUE self, VALUE file)
34
- {
35
- return Qnil;
36
- }
37
-
38
- int breakpoints_match(char *file, long line)
39
- {
40
- lt_long_array *lines;
41
- long i;
42
-
43
- lines = lt_search(ht, file);
44
- if (lines != NULL)
45
- {
46
- for (i = 0; i < lines->size; i++)
47
- {
48
- if (lines->items[i] == line)
49
- {
50
- return 1;
51
- }
52
- }
53
- }
54
- return 0;
55
- }
56
-
57
- static VALUE breakpoints_match_s(VALUE self, VALUE file, VALUE line)
58
- {
59
- return breakpoints_match(StringValueCStr(file), NUM2LONG(line)) == 0 ? Qfalse : Qtrue;
60
- }
61
-
62
- static VALUE breakpoints_clear_s(VALUE self)
63
- {
64
- lt_del_lookup_table(ht);
65
- ht = lt_new();
66
- return Qnil;
67
- }
68
-
69
- long breakpoints_files()
70
- {
71
- return ht->size;
72
- }
73
-
74
- void initialize_breakpoints(VALUE m_Readapt)
75
- {
76
- m_Breakpoints = rb_define_module_under(m_Readapt, "Breakpoints");
77
- rb_define_singleton_method(m_Breakpoints, "set", breakpoints_set_s, 2);
78
- rb_define_singleton_method(m_Breakpoints, "delete", breakpoints_delete_s, 1);
79
- rb_define_singleton_method(m_Breakpoints, "match", breakpoints_match_s, 2);
80
- rb_define_singleton_method(m_Breakpoints, "clear", breakpoints_clear_s, 0);
81
-
82
- ht = lt_new(); // TODO Need to free?
83
- }
1
+ #include "ruby.h"
2
+ #include "lookup_table.h"
3
+
4
+ static VALUE m_Breakpoints;
5
+ lt_lookup_table *ht;
6
+
7
+ void breakpoints_set(char *file, long *lines)
8
+ {
9
+
10
+ }
11
+
12
+ static VALUE breakpoints_set_s(VALUE self, VALUE file, VALUE lines)
13
+ {
14
+ long length = NUM2LONG(rb_funcall(lines, rb_intern("length"), 0));
15
+ long *ll;
16
+ long i;
17
+
18
+ ll = malloc(sizeof(long) * length);
19
+ for (i = 0; i < length; i++)
20
+ {
21
+ ll[i] = NUM2LONG(rb_ary_entry(lines, i));
22
+ }
23
+ lt_insert(ht, StringValueCStr(file), ll, length);
24
+ free(ll);
25
+ return Qnil;
26
+ }
27
+
28
+ void breakpoints_delete(char *file)
29
+ {
30
+
31
+ }
32
+
33
+ static VALUE breakpoints_delete_s(VALUE self, VALUE file)
34
+ {
35
+ return Qnil;
36
+ }
37
+
38
+ int breakpoints_match(char *file, long line)
39
+ {
40
+ lt_long_array *lines;
41
+ long i;
42
+
43
+ lines = lt_search(ht, file);
44
+ if (lines != NULL)
45
+ {
46
+ for (i = 0; i < lines->size; i++)
47
+ {
48
+ if (lines->items[i] == line)
49
+ {
50
+ return 1;
51
+ }
52
+ }
53
+ }
54
+ return 0;
55
+ }
56
+
57
+ static VALUE breakpoints_match_s(VALUE self, VALUE file, VALUE line)
58
+ {
59
+ return breakpoints_match(StringValueCStr(file), NUM2LONG(line)) == 0 ? Qfalse : Qtrue;
60
+ }
61
+
62
+ static VALUE breakpoints_clear_s(VALUE self)
63
+ {
64
+ lt_del_lookup_table(ht);
65
+ ht = lt_new();
66
+ return Qnil;
67
+ }
68
+
69
+ long breakpoints_files()
70
+ {
71
+ return ht->size;
72
+ }
73
+
74
+ void initialize_breakpoints(VALUE m_Readapt)
75
+ {
76
+ m_Breakpoints = rb_define_module_under(m_Readapt, "Breakpoints");
77
+ rb_define_singleton_method(m_Breakpoints, "set", breakpoints_set_s, 2);
78
+ rb_define_singleton_method(m_Breakpoints, "delete", breakpoints_delete_s, 1);
79
+ rb_define_singleton_method(m_Breakpoints, "match", breakpoints_match_s, 2);
80
+ rb_define_singleton_method(m_Breakpoints, "clear", breakpoints_clear_s, 0);
81
+
82
+ ht = lt_new(); // TODO Need to free?
83
+ }
@@ -1,11 +1,11 @@
1
- #ifndef BREAKPOINTS_H_
2
- #define BREAKPOINTS_H_
3
-
4
- void initialize_breakpoints(VALUE m_Readapt);
5
-
6
- void breakpoints_set(char *file, long *lines);
7
- void breakpoints_delete(char *file);
8
- int breakpoints_match(char *file, long line);
9
- long breakpoints_files();
10
-
11
- #endif
1
+ #ifndef BREAKPOINTS_H_
2
+ #define BREAKPOINTS_H_
3
+
4
+ void initialize_breakpoints(VALUE m_Readapt);
5
+
6
+ void breakpoints_set(char *file, long *lines);
7
+ void breakpoints_delete(char *file);
8
+ int breakpoints_match(char *file, long line);
9
+ long breakpoints_files();
10
+
11
+ #endif
File without changes
data/ext/readapt/frame.c CHANGED
@@ -1,137 +1,137 @@
1
- #include "ruby.h"
2
- #include "ruby/debug.h"
3
- #include "frame.h"
4
- #include "normalize.h"
5
-
6
- static VALUE c_Frame;
7
-
8
- void frame_free(void *data)
9
- {
10
- frame_t *frm = data;
11
-
12
- free(frm->file);
13
- free(frm);
14
- }
15
-
16
- static size_t
17
- frame_size(const void *data)
18
- {
19
- return sizeof(frame_t);
20
- }
21
-
22
- static const rb_data_type_t frame_type = {
23
- .wrap_struct_name = "frame_data",
24
- .function = {
25
- .dmark = NULL,
26
- .dfree = frame_free,
27
- .dsize = frame_size,
28
- },
29
- .data = NULL,
30
- .flags = RUBY_TYPED_FREE_IMMEDIATELY,
31
- };
32
-
33
- VALUE frame_allocate_s(VALUE self)
34
- {
35
- VALUE obj;
36
- frame_t *data = malloc(sizeof(frame_t));
37
- obj = TypedData_Wrap_Struct(self, &frame_type, data);
38
- data->file = NULL;
39
- data->line = 0;
40
- data->binding = Qnil;
41
- return obj;
42
- }
43
-
44
- VALUE frame_allocate()
45
- {
46
- return frame_allocate_s(c_Frame);
47
- }
48
-
49
- frame_t *frame_data_from_tracepoint(VALUE tracepoint)
50
- {
51
- frame_t *data;
52
- VALUE tmp;
53
- rb_trace_arg_t *tracearg;
54
- char *file;
55
- int line;
56
-
57
- data = malloc(sizeof(frame_t));
58
- tracearg = rb_tracearg_from_tracepoint(tracepoint);
59
- tmp = rb_tracearg_path(tracearg);
60
- file = (tmp == Qnil ? NULL : normalize_path_new_cstr(StringValueCStr(tmp)));
61
- line = NUM2INT(rb_tracearg_lineno(tracearg));
62
-
63
- data->file = file;
64
- data->line = line;
65
- data->binding = Qnil;
66
-
67
- return data;
68
- }
69
-
70
- VALUE frame_initialize_m(VALUE self, VALUE file, VALUE line, VALUE binding)
71
- {
72
- frame_t *data;
73
- TypedData_Get_Struct(self, frame_t, &frame_type, data);
74
- if (file == Qnil)
75
- {
76
- data->file = NULL;
77
- }
78
- else
79
- {
80
- data->file = normalize_path_new_cstr(StringValueCStr(file));
81
- }
82
- data->line = NUM2INT(line);
83
- data->binding = binding;
84
- return self;
85
- }
86
-
87
- VALUE frame_new_from_data(frame_t *data)
88
- {
89
- VALUE obj;
90
-
91
- obj = frame_allocate();
92
- frame_initialize_m(
93
- obj,
94
- rb_str_new_cstr(data->file),
95
- INT2NUM(data->line),
96
- data->binding);
97
-
98
- return obj;
99
- }
100
-
101
- VALUE frame_file_m(VALUE self)
102
- {
103
- frame_t *data;
104
- VALUE str = Qnil;
105
-
106
- TypedData_Get_Struct(self, frame_t, &frame_type, data);
107
- if (data->file)
108
- {
109
- str = rb_str_new_cstr(data->file);
110
- rb_obj_freeze(str);
111
- }
112
- return str;
113
- }
114
-
115
- VALUE frame_line_m(VALUE self)
116
- {
117
- frame_t *data;
118
- TypedData_Get_Struct(self, frame_t, &frame_type, data);
119
- return INT2NUM(data->line);
120
- }
121
-
122
- VALUE frame_binding_m(VALUE self)
123
- {
124
- frame_t *data;
125
- TypedData_Get_Struct(self, frame_t, &frame_type, data);
126
- return data->binding;
127
- }
128
-
129
- void initialize_frame(VALUE m_Readapt)
130
- {
131
- c_Frame = rb_define_class_under(m_Readapt, "Frame", rb_cData);
132
- rb_define_alloc_func(c_Frame, frame_allocate_s);
133
- rb_define_method(c_Frame, "initialize", frame_initialize_m, 3);
134
- rb_define_method(c_Frame, "file", frame_file_m, 0);
135
- rb_define_method(c_Frame, "line", frame_line_m, 0);
136
- rb_define_method(c_Frame, "frame_binding", frame_binding_m, 0);
137
- }
1
+ #include "ruby.h"
2
+ #include "ruby/debug.h"
3
+ #include "frame.h"
4
+ #include "normalize.h"
5
+
6
+ static VALUE c_Frame;
7
+
8
+ void frame_free(void *data)
9
+ {
10
+ frame_t *frm = data;
11
+
12
+ free(frm->file);
13
+ free(frm);
14
+ }
15
+
16
+ static size_t
17
+ frame_size(const void *data)
18
+ {
19
+ return sizeof(frame_t);
20
+ }
21
+
22
+ static const rb_data_type_t frame_type = {
23
+ .wrap_struct_name = "frame_data",
24
+ .function = {
25
+ .dmark = NULL,
26
+ .dfree = frame_free,
27
+ .dsize = frame_size,
28
+ },
29
+ .data = NULL,
30
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY,
31
+ };
32
+
33
+ VALUE frame_allocate_s(VALUE self)
34
+ {
35
+ VALUE obj;
36
+ frame_t *data = malloc(sizeof(frame_t));
37
+ obj = TypedData_Wrap_Struct(self, &frame_type, data);
38
+ data->file = NULL;
39
+ data->line = 0;
40
+ data->binding = Qnil;
41
+ return obj;
42
+ }
43
+
44
+ VALUE frame_allocate()
45
+ {
46
+ return frame_allocate_s(c_Frame);
47
+ }
48
+
49
+ frame_t *frame_data_from_tracepoint(VALUE tracepoint)
50
+ {
51
+ frame_t *data;
52
+ VALUE tmp;
53
+ rb_trace_arg_t *tracearg;
54
+ char *file;
55
+ int line;
56
+
57
+ data = malloc(sizeof(frame_t));
58
+ tracearg = rb_tracearg_from_tracepoint(tracepoint);
59
+ tmp = rb_tracearg_path(tracearg);
60
+ file = (tmp == Qnil ? NULL : normalize_path_new_cstr(StringValueCStr(tmp)));
61
+ line = NUM2INT(rb_tracearg_lineno(tracearg));
62
+
63
+ data->file = file;
64
+ data->line = line;
65
+ data->binding = Qnil;
66
+
67
+ return data;
68
+ }
69
+
70
+ VALUE frame_initialize_m(VALUE self, VALUE file, VALUE line, VALUE binding)
71
+ {
72
+ frame_t *data;
73
+ TypedData_Get_Struct(self, frame_t, &frame_type, data);
74
+ if (file == Qnil)
75
+ {
76
+ data->file = NULL;
77
+ }
78
+ else
79
+ {
80
+ data->file = normalize_path_new_cstr(StringValueCStr(file));
81
+ }
82
+ data->line = NUM2INT(line);
83
+ data->binding = binding;
84
+ return self;
85
+ }
86
+
87
+ VALUE frame_new_from_data(frame_t *data)
88
+ {
89
+ VALUE obj;
90
+
91
+ obj = frame_allocate();
92
+ frame_initialize_m(
93
+ obj,
94
+ rb_str_new_cstr(data->file),
95
+ INT2NUM(data->line),
96
+ data->binding);
97
+
98
+ return obj;
99
+ }
100
+
101
+ VALUE frame_file_m(VALUE self)
102
+ {
103
+ frame_t *data;
104
+ VALUE str = Qnil;
105
+
106
+ TypedData_Get_Struct(self, frame_t, &frame_type, data);
107
+ if (data->file)
108
+ {
109
+ str = rb_str_new_cstr(data->file);
110
+ rb_obj_freeze(str);
111
+ }
112
+ return str;
113
+ }
114
+
115
+ VALUE frame_line_m(VALUE self)
116
+ {
117
+ frame_t *data;
118
+ TypedData_Get_Struct(self, frame_t, &frame_type, data);
119
+ return INT2NUM(data->line);
120
+ }
121
+
122
+ VALUE frame_binding_m(VALUE self)
123
+ {
124
+ frame_t *data;
125
+ TypedData_Get_Struct(self, frame_t, &frame_type, data);
126
+ return data->binding;
127
+ }
128
+
129
+ void initialize_frame(VALUE m_Readapt)
130
+ {
131
+ c_Frame = rb_define_class_under(m_Readapt, "Frame", rb_cData);
132
+ rb_define_alloc_func(c_Frame, frame_allocate_s);
133
+ rb_define_method(c_Frame, "initialize", frame_initialize_m, 3);
134
+ rb_define_method(c_Frame, "file", frame_file_m, 0);
135
+ rb_define_method(c_Frame, "line", frame_line_m, 0);
136
+ rb_define_method(c_Frame, "frame_binding", frame_binding_m, 0);
137
+ }