readapt 1.4.4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rspec.yml +38 -0
  3. data/.gitignore +16 -16
  4. data/.rspec +2 -2
  5. data/.travis.yml +19 -19
  6. data/CHANGELOG.md +103 -100
  7. data/Gemfile +4 -4
  8. data/LICENSE.txt +21 -21
  9. data/README.md +37 -37
  10. data/Rakefile +14 -14
  11. data/bin/console +14 -14
  12. data/bin/setup +8 -8
  13. data/exe/readapt +5 -5
  14. data/ext/readapt/breakpoints.c +83 -83
  15. data/ext/readapt/breakpoints.h +11 -11
  16. data/ext/readapt/extconf.rb +0 -0
  17. data/ext/readapt/frame.c +137 -137
  18. data/ext/readapt/frame.h +17 -17
  19. data/ext/readapt/inspector.c +51 -51
  20. data/ext/readapt/inspector.h +8 -8
  21. data/ext/readapt/lookup_table.c +211 -211
  22. data/ext/readapt/lookup_table.h +30 -30
  23. data/ext/readapt/monitor.c +0 -0
  24. data/ext/readapt/monitor.h +0 -0
  25. data/ext/readapt/normalize.c +62 -62
  26. data/ext/readapt/normalize.h +7 -7
  27. data/ext/readapt/readapt.c +18 -18
  28. data/ext/readapt/stack.c +86 -86
  29. data/ext/readapt/stack.h +20 -20
  30. data/ext/readapt/threads.c +1 -1
  31. data/ext/readapt/threads.h +0 -0
  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 -227
  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/attach.rb +11 -11
  41. data/lib/readapt/message/base.rb +32 -32
  42. data/lib/readapt/message/configuration_done.rb +11 -11
  43. data/lib/readapt/message/continue.rb +15 -15
  44. data/lib/readapt/message/disconnect.rb +13 -13
  45. data/lib/readapt/message/evaluate.rb +19 -19
  46. data/lib/readapt/message/initialize.rb +21 -21
  47. data/lib/readapt/message/launch.rb +11 -11
  48. data/lib/readapt/message/next.rb +12 -12
  49. data/lib/readapt/message/pause.rb +11 -11
  50. data/lib/readapt/message/scopes.rb +26 -26
  51. data/lib/readapt/message/set_breakpoints.rb +25 -25
  52. data/lib/readapt/message/set_exception_breakpoints.rb +11 -11
  53. data/lib/readapt/message/stack_trace.rb +38 -38
  54. data/lib/readapt/message/step_in.rb +11 -11
  55. data/lib/readapt/message/step_out.rb +11 -11
  56. data/lib/readapt/message/threads.rb +18 -18
  57. data/lib/readapt/message/variables.rb +53 -53
  58. data/lib/readapt/message.rb +62 -62
  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 -20
  66. data/lib/readapt/variable.rb +0 -0
  67. data/lib/readapt/version.rb +3 -3
  68. data/lib/readapt.rb +21 -21
  69. data/readapt.gemspec +39 -39
  70. metadata +8 -7
@@ -1,211 +1,211 @@
1
- #include <math.h>
2
- #include <stdlib.h>
3
- #include <string.h>
4
-
5
- #include "lookup_table.h"
6
-
7
- static lt_long_array *copy_array(const long *value, const long size)
8
- {
9
- long i;
10
- long *items = malloc(sizeof(long) * size);
11
- lt_long_array *result;
12
-
13
- for (i = 0; i < size; i++)
14
- {
15
- items[i] = value[i];
16
- }
17
- result = malloc(sizeof(lt_long_array));
18
- result->items = (size ? items : NULL);
19
- result->size = size;
20
- return result;
21
- }
22
-
23
- /*
24
- * Initialize a new item
25
- */
26
- static lt_item *lt_new_item(char *key, const long *value, const long size)
27
- {
28
- lt_item *i = malloc(sizeof(lt_item));
29
- i->key = malloc(sizeof(char) * (strlen(key) + 1));
30
- strcpy(i->key, key);
31
- i->value = copy_array(value, size);
32
- return i;
33
- }
34
-
35
- /*
36
- * Delete the lt_item
37
- */
38
- static void lt_del_item(lt_item *i)
39
- {
40
- free(i->key);
41
- free(i->value->items);
42
- free(i);
43
- }
44
-
45
- /*
46
- * Initialize a new empty lookup table
47
- */
48
- lt_lookup_table *lt_new()
49
- {
50
- lt_lookup_table *ht = malloc(sizeof(lt_lookup_table));
51
- ht->items = NULL;
52
- ht->size = 0;
53
- return ht;
54
- }
55
-
56
- /*
57
- * Delete the lookup table
58
- */
59
- void lt_del_lookup_table(lt_lookup_table *ht)
60
- {
61
- int i;
62
- lt_item *item;
63
-
64
- // Iterate through items and delete any that are found
65
- for (i = 0; i < ht->size; i++)
66
- {
67
- item = ht->items[i];
68
- lt_del_item(item);
69
- }
70
- free(ht->items);
71
- free(ht);
72
- }
73
-
74
- static lt_long_array *lt_search_part(lt_lookup_table *ht, char *key, long cursor, long next)
75
- {
76
- int cmp;
77
-
78
- if (cursor >= ht->size)
79
- {
80
- return NULL;
81
- }
82
-
83
- cmp = strcmp(ht->items[cursor]->key, key);
84
- if (cmp == 0)
85
- {
86
- return ht->items[cursor]->value;
87
- }
88
- if (next > cursor && next < ht->size)
89
- {
90
- cmp = strcmp(ht->items[next]->key, key);
91
- if (cmp == 0)
92
- {
93
- return ht->items[next]->value;
94
- }
95
- else if (cmp < 0)
96
- {
97
- return lt_search_part(ht, key, next + 1, next + ((ht->size - next) / 2));
98
- }
99
- else
100
- {
101
- return lt_search_part(ht, key, cursor + 1, next / 2);
102
- }
103
- }
104
- return lt_search_part(ht, key, cursor + 1, next / 2);
105
- }
106
-
107
- static lt_long_array *lt_search_key(lt_lookup_table *ht, char *key)
108
- {
109
- return lt_search_part(ht, key, 0, ht->size / 2);
110
- }
111
-
112
- static void lt_delete_key(lt_lookup_table *ht, char *key)
113
- {
114
- lt_long_array *found;
115
- lt_item **tmp;
116
- long i;
117
- long cursor = 0;
118
-
119
- found = lt_search_key(ht, key);
120
- if (found)
121
- {
122
- tmp = malloc(sizeof(lt_item) * (ht->size - 1));
123
- for (i = 0; i < ht->size; i++)
124
- {
125
- if (ht->items[i]->key == key)
126
- {
127
- lt_del_item(ht->items[i]);
128
- }
129
- else
130
- {
131
- tmp[cursor] = ht->items[cursor];
132
- cursor++;
133
- }
134
- }
135
- free(ht->items);
136
- ht->items = tmp;
137
- ht->size--;
138
- }
139
- }
140
-
141
- static void lt_insert_key(lt_lookup_table *ht, char *key, const long *value, const long size)
142
- {
143
- lt_item *item;
144
- lt_item **tmp;
145
- long i;
146
- long cursor = 0;
147
- int inserted = 0;
148
- int cmp;
149
-
150
- lt_delete_key(ht, key);
151
-
152
- if (size == 0)
153
- {
154
- return;
155
- }
156
-
157
- item = lt_new_item(key, value, size);
158
- tmp = malloc(sizeof(lt_item) * (ht->size + 1));
159
-
160
- for (i = 0; i < ht->size; i++)
161
- {
162
- if (!inserted)
163
- {
164
- cmp = strcmp(item->key, ht->items[i]->key);
165
- if (cmp > 0)
166
- {
167
- tmp[cursor] = item;
168
- cursor++;
169
- inserted = 1;
170
- }
171
- tmp[cursor] = ht->items[i];
172
- cursor++;
173
- }
174
- else
175
- {
176
- tmp[cursor] = ht->items[i];
177
- cursor++;
178
- }
179
- }
180
- if (!inserted)
181
- {
182
- tmp[ht->size] = item;
183
- }
184
- free(ht->items);
185
- ht->items = tmp;
186
- ht->size++;
187
- }
188
-
189
- /*
190
- * Add an item to the lookup table
191
- */
192
- void lt_insert(lt_lookup_table *ht, char *key, const long *value, const long size)
193
- {
194
- lt_insert_key(ht, key, value, size);
195
- }
196
-
197
- /*
198
- * Get the key's value or NULL if it doesn't exist
199
- */
200
- lt_long_array *lt_search(lt_lookup_table *ht, char *key)
201
- {
202
- return lt_search_key(ht, key);
203
- }
204
-
205
- /*
206
- * Delete the key's item if it exists
207
- */
208
- void lt_delete(lt_lookup_table *ht, char *key)
209
- {
210
- lt_delete_key(ht, key);
211
- }
1
+ #include <math.h>
2
+ #include <stdlib.h>
3
+ #include <string.h>
4
+
5
+ #include "lookup_table.h"
6
+
7
+ static lt_long_array *copy_array(const long *value, const long size)
8
+ {
9
+ long i;
10
+ long *items = malloc(sizeof(long) * size);
11
+ lt_long_array *result;
12
+
13
+ for (i = 0; i < size; i++)
14
+ {
15
+ items[i] = value[i];
16
+ }
17
+ result = malloc(sizeof(lt_long_array));
18
+ result->items = (size ? items : NULL);
19
+ result->size = size;
20
+ return result;
21
+ }
22
+
23
+ /*
24
+ * Initialize a new item
25
+ */
26
+ static lt_item *lt_new_item(char *key, const long *value, const long size)
27
+ {
28
+ lt_item *i = malloc(sizeof(lt_item));
29
+ i->key = malloc(sizeof(char) * (strlen(key) + 1));
30
+ strcpy(i->key, key);
31
+ i->value = copy_array(value, size);
32
+ return i;
33
+ }
34
+
35
+ /*
36
+ * Delete the lt_item
37
+ */
38
+ static void lt_del_item(lt_item *i)
39
+ {
40
+ free(i->key);
41
+ free(i->value->items);
42
+ free(i);
43
+ }
44
+
45
+ /*
46
+ * Initialize a new empty lookup table
47
+ */
48
+ lt_lookup_table *lt_new()
49
+ {
50
+ lt_lookup_table *ht = malloc(sizeof(lt_lookup_table));
51
+ ht->items = NULL;
52
+ ht->size = 0;
53
+ return ht;
54
+ }
55
+
56
+ /*
57
+ * Delete the lookup table
58
+ */
59
+ void lt_del_lookup_table(lt_lookup_table *ht)
60
+ {
61
+ int i;
62
+ lt_item *item;
63
+
64
+ // Iterate through items and delete any that are found
65
+ for (i = 0; i < ht->size; i++)
66
+ {
67
+ item = ht->items[i];
68
+ lt_del_item(item);
69
+ }
70
+ free(ht->items);
71
+ free(ht);
72
+ }
73
+
74
+ static lt_long_array *lt_search_part(lt_lookup_table *ht, char *key, long cursor, long next)
75
+ {
76
+ int cmp;
77
+
78
+ if (cursor >= ht->size)
79
+ {
80
+ return NULL;
81
+ }
82
+
83
+ cmp = strcmp(ht->items[cursor]->key, key);
84
+ if (cmp == 0)
85
+ {
86
+ return ht->items[cursor]->value;
87
+ }
88
+ if (next > cursor && next < ht->size)
89
+ {
90
+ cmp = strcmp(ht->items[next]->key, key);
91
+ if (cmp == 0)
92
+ {
93
+ return ht->items[next]->value;
94
+ }
95
+ else if (cmp < 0)
96
+ {
97
+ return lt_search_part(ht, key, next + 1, next + ((ht->size - next) / 2));
98
+ }
99
+ else
100
+ {
101
+ return lt_search_part(ht, key, cursor + 1, next / 2);
102
+ }
103
+ }
104
+ return lt_search_part(ht, key, cursor + 1, next / 2);
105
+ }
106
+
107
+ static lt_long_array *lt_search_key(lt_lookup_table *ht, char *key)
108
+ {
109
+ return lt_search_part(ht, key, 0, ht->size / 2);
110
+ }
111
+
112
+ static void lt_delete_key(lt_lookup_table *ht, char *key)
113
+ {
114
+ lt_long_array *found;
115
+ lt_item **tmp;
116
+ long i;
117
+ long cursor = 0;
118
+
119
+ found = lt_search_key(ht, key);
120
+ if (found)
121
+ {
122
+ tmp = malloc(sizeof(lt_item) * (ht->size - 1));
123
+ for (i = 0; i < ht->size; i++)
124
+ {
125
+ if (ht->items[i]->key == key)
126
+ {
127
+ lt_del_item(ht->items[i]);
128
+ }
129
+ else
130
+ {
131
+ tmp[cursor] = ht->items[cursor];
132
+ cursor++;
133
+ }
134
+ }
135
+ free(ht->items);
136
+ ht->items = tmp;
137
+ ht->size--;
138
+ }
139
+ }
140
+
141
+ static void lt_insert_key(lt_lookup_table *ht, char *key, const long *value, const long size)
142
+ {
143
+ lt_item *item;
144
+ lt_item **tmp;
145
+ long i;
146
+ long cursor = 0;
147
+ int inserted = 0;
148
+ int cmp;
149
+
150
+ lt_delete_key(ht, key);
151
+
152
+ if (size == 0)
153
+ {
154
+ return;
155
+ }
156
+
157
+ item = lt_new_item(key, value, size);
158
+ tmp = malloc(sizeof(lt_item) * (ht->size + 1));
159
+
160
+ for (i = 0; i < ht->size; i++)
161
+ {
162
+ if (!inserted)
163
+ {
164
+ cmp = strcmp(item->key, ht->items[i]->key);
165
+ if (cmp > 0)
166
+ {
167
+ tmp[cursor] = item;
168
+ cursor++;
169
+ inserted = 1;
170
+ }
171
+ tmp[cursor] = ht->items[i];
172
+ cursor++;
173
+ }
174
+ else
175
+ {
176
+ tmp[cursor] = ht->items[i];
177
+ cursor++;
178
+ }
179
+ }
180
+ if (!inserted)
181
+ {
182
+ tmp[ht->size] = item;
183
+ }
184
+ free(ht->items);
185
+ ht->items = tmp;
186
+ ht->size++;
187
+ }
188
+
189
+ /*
190
+ * Add an item to the lookup table
191
+ */
192
+ void lt_insert(lt_lookup_table *ht, char *key, const long *value, const long size)
193
+ {
194
+ lt_insert_key(ht, key, value, size);
195
+ }
196
+
197
+ /*
198
+ * Get the key's value or NULL if it doesn't exist
199
+ */
200
+ lt_long_array *lt_search(lt_lookup_table *ht, char *key)
201
+ {
202
+ return lt_search_key(ht, key);
203
+ }
204
+
205
+ /*
206
+ * Delete the key's item if it exists
207
+ */
208
+ void lt_delete(lt_lookup_table *ht, char *key)
209
+ {
210
+ lt_delete_key(ht, key);
211
+ }
@@ -1,30 +1,30 @@
1
- #ifndef LOOKUP_TABLE_H_
2
- #define LOOKUP_TABLE_H_
3
-
4
- typedef struct lt_long_array
5
- {
6
- long *items;
7
- long size;
8
- } lt_long_array;
9
-
10
- // lt_item is an item in the lookup table
11
- typedef struct lt_item
12
- {
13
- char *key;
14
- lt_long_array *value;
15
- } lt_item;
16
-
17
- typedef struct lt_lookup_table
18
- {
19
- long size;
20
- lt_item **items;
21
- } lt_lookup_table;
22
-
23
- lt_lookup_table *lt_new();
24
- void lt_del_lookup_table(lt_lookup_table *ht);
25
-
26
- void lt_insert(lt_lookup_table *ht, char *key, const long *value, const long size);
27
- lt_long_array *lt_search(lt_lookup_table *ht, char *key);
28
- void lt_delete(lt_lookup_table *h, char *key);
29
-
30
- #endif // LOOKUP_TABLE_H_
1
+ #ifndef LOOKUP_TABLE_H_
2
+ #define LOOKUP_TABLE_H_
3
+
4
+ typedef struct lt_long_array
5
+ {
6
+ long *items;
7
+ long size;
8
+ } lt_long_array;
9
+
10
+ // lt_item is an item in the lookup table
11
+ typedef struct lt_item
12
+ {
13
+ char *key;
14
+ lt_long_array *value;
15
+ } lt_item;
16
+
17
+ typedef struct lt_lookup_table
18
+ {
19
+ long size;
20
+ lt_item **items;
21
+ } lt_lookup_table;
22
+
23
+ lt_lookup_table *lt_new();
24
+ void lt_del_lookup_table(lt_lookup_table *ht);
25
+
26
+ void lt_insert(lt_lookup_table *ht, char *key, const long *value, const long size);
27
+ lt_long_array *lt_search(lt_lookup_table *ht, char *key);
28
+ void lt_delete(lt_lookup_table *h, char *key);
29
+
30
+ #endif // LOOKUP_TABLE_H_
File without changes
File without changes
@@ -1,62 +1,62 @@
1
- #include "ruby.h"
2
- #include "ruby/debug.h"
3
- #include <ctype.h>
4
-
5
- static int isWindows;
6
-
7
- static int
8
- checkIfWindows()
9
- {
10
- VALUE regexp, result;
11
-
12
- regexp = rb_reg_new("/cygwin|mswin|mingw|bccwin|wince|emx/", 37, 0);
13
- result = rb_reg_match(regexp, rb_str_new_cstr(RUBY_PLATFORM));
14
- return result == Qnil ? 0 : 1;
15
- }
16
-
17
- void normalize_path(char *str)
18
- {
19
- long i, len;
20
-
21
- if (isWindows)
22
- {
23
- if (isalpha(str[0]))
24
- {
25
- str[0] = toupper(str[0]);
26
- }
27
- len = strlen(str);
28
- for (i = 0; i < len; i++)
29
- {
30
- if (str[i] == '\\')
31
- {
32
- str[i] = '/';
33
- }
34
- }
35
- }
36
- }
37
-
38
- char *normalize_path_new_cstr(char *str)
39
- {
40
- char *buffer;
41
-
42
- buffer = malloc((strlen(str) + 1) * sizeof(char));
43
- strcpy(buffer, str);
44
- normalize_path(buffer);
45
- return buffer;
46
- }
47
-
48
- static VALUE
49
- normalize_path_s(VALUE self, VALUE str)
50
- {
51
- char *path = normalize_path_new_cstr(StringValueCStr(str));
52
- VALUE result = rb_str_new_cstr(path);
53
- free(path);
54
- return result;
55
- }
56
-
57
- void initialize_normalize(VALUE m_Readapt)
58
- {
59
- isWindows = checkIfWindows();
60
-
61
- rb_define_singleton_method(m_Readapt, "normalize_path", normalize_path_s, 1);
62
- }
1
+ #include "ruby.h"
2
+ #include "ruby/debug.h"
3
+ #include <ctype.h>
4
+
5
+ static int isWindows;
6
+
7
+ static int
8
+ checkIfWindows()
9
+ {
10
+ VALUE regexp, result;
11
+
12
+ regexp = rb_reg_new("/cygwin|mswin|mingw|bccwin|wince|emx/", 37, 0);
13
+ result = rb_reg_match(regexp, rb_str_new_cstr(RUBY_PLATFORM));
14
+ return result == Qnil ? 0 : 1;
15
+ }
16
+
17
+ void normalize_path(char *str)
18
+ {
19
+ long i, len;
20
+
21
+ if (isWindows)
22
+ {
23
+ if (isalpha(str[0]))
24
+ {
25
+ str[0] = toupper(str[0]);
26
+ }
27
+ len = strlen(str);
28
+ for (i = 0; i < len; i++)
29
+ {
30
+ if (str[i] == '\\')
31
+ {
32
+ str[i] = '/';
33
+ }
34
+ }
35
+ }
36
+ }
37
+
38
+ char *normalize_path_new_cstr(char *str)
39
+ {
40
+ char *buffer;
41
+
42
+ buffer = malloc((strlen(str) + 1) * sizeof(char));
43
+ strcpy(buffer, str);
44
+ normalize_path(buffer);
45
+ return buffer;
46
+ }
47
+
48
+ static VALUE
49
+ normalize_path_s(VALUE self, VALUE str)
50
+ {
51
+ char *path = normalize_path_new_cstr(StringValueCStr(str));
52
+ VALUE result = rb_str_new_cstr(path);
53
+ free(path);
54
+ return result;
55
+ }
56
+
57
+ void initialize_normalize(VALUE m_Readapt)
58
+ {
59
+ isWindows = checkIfWindows();
60
+
61
+ rb_define_singleton_method(m_Readapt, "normalize_path", normalize_path_s, 1);
62
+ }
@@ -1,7 +1,7 @@
1
- #ifndef NORMALIZE_H_
2
- #define NORMALIZE_H_
3
-
4
- void initialize_normalize(VALUE);
5
- char *normalize_path_new_cstr(char *str);
6
- void normalize_path(char *str);
7
- #endif
1
+ #ifndef NORMALIZE_H_
2
+ #define NORMALIZE_H_
3
+
4
+ void initialize_normalize(VALUE);
5
+ char *normalize_path_new_cstr(char *str);
6
+ void normalize_path(char *str);
7
+ #endif
@@ -1,18 +1,18 @@
1
- #include "ruby.h"
2
- #include "ruby/debug.h"
3
- #include "monitor.h"
4
- #include "normalize.h"
5
- #include "breakpoints.h"
6
- #include "frame.h"
7
-
8
- static VALUE m_Readapt;
9
-
10
- void Init_readapt()
11
- {
12
- m_Readapt = rb_define_module("Readapt");
13
-
14
- initialize_normalize(m_Readapt);
15
- initialize_breakpoints(m_Readapt);
16
- initialize_frame(m_Readapt);
17
- initialize_monitor(m_Readapt);
18
- }
1
+ #include "ruby.h"
2
+ #include "ruby/debug.h"
3
+ #include "monitor.h"
4
+ #include "normalize.h"
5
+ #include "breakpoints.h"
6
+ #include "frame.h"
7
+
8
+ static VALUE m_Readapt;
9
+
10
+ void Init_readapt()
11
+ {
12
+ m_Readapt = rb_define_module("Readapt");
13
+
14
+ initialize_normalize(m_Readapt);
15
+ initialize_breakpoints(m_Readapt);
16
+ initialize_frame(m_Readapt);
17
+ initialize_monitor(m_Readapt);
18
+ }