readapt 1.4.1 → 1.4.3

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 +97 -91
  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 +2 -2
  23. data/ext/readapt/monitor.h +0 -0
  24. data/ext/readapt/normalize.c +62 -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 +0 -0
  30. data/ext/readapt/threads.h +0 -0
  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 -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.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 -20
  66. data/lib/readapt/variable.rb +0 -0
  67. data/lib/readapt/version.rb +3 -3
  68. data/readapt.gemspec +39 -39
  69. metadata +6 -6
@@ -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_
@@ -51,7 +51,7 @@ monitor_debug(const char *file, const long line, VALUE tracepoint, thread_refere
51
51
 
52
52
  // Disable garbage collection to avoid segfaults in Frame#frame_binding
53
53
  gc_disabled = rb_gc_disable();
54
- thread_reference_build_frames(ptr);
54
+ thread_reference_build_frames(ptr);
55
55
  snapshot = rb_funcall(c_Snapshot, rb_intern("new"), 4,
56
56
  INT2NUM(ptr->id),
57
57
  rb_str_new_cstr(file),
@@ -103,7 +103,7 @@ process_line_event(VALUE tracepoint, void *data)
103
103
  tp_file = StringValueCStr(tmp);
104
104
  normalize_path(tp_file);
105
105
  tmp = rb_tracearg_lineno(arg);
106
- tp_line = NUM2INT(tmp);
106
+ tp_line = NUM2LONG(tmp);
107
107
 
108
108
  dapEvent = id_continue;
109
109
  if (!firstLineEvent)
File without changes
@@ -1,59 +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
- str[0] = toupper(str[0]);
24
- len = strlen(str);
25
- for (i = 2; i < len; i++)
26
- {
27
- if (str[i] == '\\')
28
- {
29
- str[i] = '/';
30
- }
31
- }
32
- }
33
- }
34
-
35
- char *normalize_path_new_cstr(char *str)
36
- {
37
- char *buffer;
38
-
39
- buffer = malloc((strlen(str) + 1) * sizeof(char));
40
- strcpy(buffer, str);
41
- normalize_path(buffer);
42
- return buffer;
43
- }
44
-
45
- static VALUE
46
- normalize_path_s(VALUE self, VALUE str)
47
- {
48
- char *path = normalize_path_new_cstr(StringValueCStr(str));
49
- VALUE result = rb_str_new_cstr(path);
50
- free(path);
51
- return result;
52
- }
53
-
54
- void initialize_normalize(VALUE m_Readapt)
55
- {
56
- isWindows = checkIfWindows();
57
-
58
- rb_define_singleton_method(m_Readapt, "normalize_path", normalize_path_s, 1);
59
- }
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
+ }
data/ext/readapt/stack.c CHANGED
@@ -1,86 +1,86 @@
1
- #include <stdlib.h>
2
- #include "stack.h"
3
-
4
- #define STACK_CAPACITY 20
5
-
6
- /**
7
- * Allocate a stack. The `elem_size` is the expected size of each element,
8
- * e.g., `sizeof(some_struct)`. The optional `free_func` argument is a pointer
9
- * to a function that will be called when an element is popped off the stack.
10
- */
11
- readapt_stack_t *stack_alloc(size_t elem_size, void (*free_func)(void *))
12
- {
13
- readapt_stack_t *s = malloc(sizeof(readapt_stack_t));
14
- s->elem_size = elem_size;
15
- s->free_func = free_func;
16
- s->size = 0;
17
- s->capacity = 0;
18
- return s;
19
- }
20
-
21
- /**
22
- * Add an element to the end of the stack
23
- */
24
- void stack_push(readapt_stack_t *stack, void *element)
25
- {
26
- if (stack->size == stack->capacity)
27
- {
28
- if (stack->capacity == 0)
29
- {
30
- stack->capacity = STACK_CAPACITY;
31
- stack->elements = malloc(stack->elem_size * stack->capacity);
32
- }
33
- else
34
- {
35
- stack->capacity += STACK_CAPACITY;
36
- stack->elements = realloc(stack->elements, stack->elem_size * stack->capacity);
37
- }
38
- }
39
- stack->elements[stack->size] = element;
40
- stack->size++;
41
- }
42
-
43
- /**
44
- * Get a pointer to the last element in the stack.
45
- */
46
- void *stack_peek(readapt_stack_t *stack)
47
- {
48
- return stack->size == 0 ? NULL : stack->elements[stack->size - 1];
49
- }
50
-
51
- /**
52
- * Pop the last element off the stack and pass it to free_func.
53
- */
54
- void stack_pop(readapt_stack_t *stack)
55
- {
56
- void *e;
57
-
58
- if (stack->size > 0)
59
- {
60
- e = stack->elements[stack->size - 1];
61
- if (stack->free_func)
62
- {
63
- stack->free_func(e);
64
- }
65
- // stack->elements[stack->size - 1] = NULL;
66
- stack->size--;
67
- }
68
- }
69
-
70
- /**
71
- * Free the stack from memory. If it still contains any elements, pass them to
72
- * free_func.
73
- */
74
- void stack_free(readapt_stack_t *stack)
75
- {
76
- int i;
77
-
78
- if (stack->free_func)
79
- {
80
- for (i = 0; i < stack->size; i++)
81
- {
82
- stack->free_func(stack->elements[i]);
83
- }
84
- }
85
- free(stack);
86
- }
1
+ #include <stdlib.h>
2
+ #include "stack.h"
3
+
4
+ #define STACK_CAPACITY 20
5
+
6
+ /**
7
+ * Allocate a stack. The `elem_size` is the expected size of each element,
8
+ * e.g., `sizeof(some_struct)`. The optional `free_func` argument is a pointer
9
+ * to a function that will be called when an element is popped off the stack.
10
+ */
11
+ readapt_stack_t *stack_alloc(size_t elem_size, void (*free_func)(void *))
12
+ {
13
+ readapt_stack_t *s = malloc(sizeof(readapt_stack_t));
14
+ s->elem_size = elem_size;
15
+ s->free_func = free_func;
16
+ s->size = 0;
17
+ s->capacity = 0;
18
+ return s;
19
+ }
20
+
21
+ /**
22
+ * Add an element to the end of the stack
23
+ */
24
+ void stack_push(readapt_stack_t *stack, void *element)
25
+ {
26
+ if (stack->size == stack->capacity)
27
+ {
28
+ if (stack->capacity == 0)
29
+ {
30
+ stack->capacity = STACK_CAPACITY;
31
+ stack->elements = malloc(stack->elem_size * stack->capacity);
32
+ }
33
+ else
34
+ {
35
+ stack->capacity += STACK_CAPACITY;
36
+ stack->elements = realloc(stack->elements, stack->elem_size * stack->capacity);
37
+ }
38
+ }
39
+ stack->elements[stack->size] = element;
40
+ stack->size++;
41
+ }
42
+
43
+ /**
44
+ * Get a pointer to the last element in the stack.
45
+ */
46
+ void *stack_peek(readapt_stack_t *stack)
47
+ {
48
+ return stack->size == 0 ? NULL : stack->elements[stack->size - 1];
49
+ }
50
+
51
+ /**
52
+ * Pop the last element off the stack and pass it to free_func.
53
+ */
54
+ void stack_pop(readapt_stack_t *stack)
55
+ {
56
+ void *e;
57
+
58
+ if (stack->size > 0)
59
+ {
60
+ e = stack->elements[stack->size - 1];
61
+ if (stack->free_func)
62
+ {
63
+ stack->free_func(e);
64
+ }
65
+ // stack->elements[stack->size - 1] = NULL;
66
+ stack->size--;
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Free the stack from memory. If it still contains any elements, pass them to
72
+ * free_func.
73
+ */
74
+ void stack_free(readapt_stack_t *stack)
75
+ {
76
+ int i;
77
+
78
+ if (stack->free_func)
79
+ {
80
+ for (i = 0; i < stack->size; i++)
81
+ {
82
+ stack->free_func(stack->elements[i]);
83
+ }
84
+ }
85
+ free(stack);
86
+ }
data/ext/readapt/stack.h CHANGED
@@ -1,20 +1,20 @@
1
- #ifndef STACK_H_
2
- #define STACK_H_
3
-
4
- #include "stddef.h"
5
-
6
- typedef struct readapt_stack_struct {
7
- int size;
8
- size_t elem_size;
9
- void (*free_func)(void *);
10
- int capacity;
11
- void **elements;
12
- } readapt_stack_t;
13
-
14
- readapt_stack_t *stack_alloc(size_t elem_size, void(*free_func)(void*));
15
- void stack_push(readapt_stack_t *stack, void *element);
16
- void *stack_peek(readapt_stack_t *stack);
17
- void stack_pop(readapt_stack_t *stack);
18
- void stack_free(readapt_stack_t *stack);
19
-
20
- #endif
1
+ #ifndef STACK_H_
2
+ #define STACK_H_
3
+
4
+ #include "stddef.h"
5
+
6
+ typedef struct readapt_stack_struct {
7
+ int size;
8
+ size_t elem_size;
9
+ void (*free_func)(void *);
10
+ int capacity;
11
+ void **elements;
12
+ } readapt_stack_t;
13
+
14
+ readapt_stack_t *stack_alloc(size_t elem_size, void(*free_func)(void*));
15
+ void stack_push(readapt_stack_t *stack, void *element);
16
+ void *stack_peek(readapt_stack_t *stack);
17
+ void stack_pop(readapt_stack_t *stack);
18
+ void stack_free(readapt_stack_t *stack);
19
+
20
+ #endif