readapt 1.3.0 → 1.4.0

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 -18
  5. data/CHANGELOG.md +87 -83
  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 +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 +228 -220
  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 -13
  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 -8
  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 +25 -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 +7 -7
@@ -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,59 +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
- 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
+ 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,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