readapt 0.8.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +16 -14
- data/.rspec +2 -2
- data/.travis.yml +18 -13
- data/CHANGELOG.md +80 -60
- data/Gemfile +4 -4
- data/LICENSE.txt +21 -21
- data/README.md +37 -29
- data/Rakefile +14 -14
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/exe/readapt +5 -5
- data/ext/readapt/breakpoints.c +83 -83
- data/ext/readapt/breakpoints.h +11 -11
- data/ext/readapt/extconf.rb +0 -0
- data/ext/readapt/frame.c +137 -137
- data/ext/readapt/frame.h +17 -17
- data/ext/readapt/inspector.c +51 -51
- data/ext/readapt/inspector.h +8 -8
- data/ext/readapt/{hash_table.c → lookup_table.c} +211 -211
- data/ext/readapt/lookup_table.h +30 -0
- data/ext/readapt/monitor.c +42 -5
- data/ext/readapt/monitor.h +0 -0
- data/ext/readapt/normalize.c +59 -59
- data/ext/readapt/normalize.h +7 -7
- data/ext/readapt/readapt.c +18 -18
- data/ext/readapt/stack.c +86 -86
- data/ext/readapt/stack.h +20 -20
- data/ext/readapt/threads.c +15 -11
- data/ext/readapt/threads.h +2 -2
- data/lib/readapt.rb +21 -18
- data/lib/readapt/adapter.rb +98 -138
- data/lib/readapt/breakpoint.rb +21 -20
- data/lib/readapt/data_reader.rb +62 -0
- data/lib/readapt/debugger.rb +220 -224
- data/lib/readapt/error.rb +63 -0
- data/lib/readapt/finder.rb +34 -20
- data/lib/readapt/frame.rb +40 -40
- data/lib/readapt/input.rb +7 -0
- data/lib/readapt/message.rb +62 -62
- data/lib/readapt/message/attach.rb +11 -11
- data/lib/readapt/message/base.rb +32 -32
- data/lib/readapt/message/configuration_done.rb +11 -11
- data/lib/readapt/message/continue.rb +15 -15
- data/lib/readapt/message/disconnect.rb +13 -14
- data/lib/readapt/message/evaluate.rb +18 -18
- data/lib/readapt/message/initialize.rb +13 -13
- data/lib/readapt/message/launch.rb +11 -11
- data/lib/readapt/message/next.rb +12 -12
- data/lib/readapt/message/pause.rb +11 -11
- data/lib/readapt/message/scopes.rb +26 -26
- data/lib/readapt/message/set_breakpoints.rb +25 -25
- data/lib/readapt/message/set_exception_breakpoints.rb +8 -8
- data/lib/readapt/message/stack_trace.rb +38 -38
- data/lib/readapt/message/step_in.rb +11 -11
- data/lib/readapt/message/step_out.rb +11 -11
- data/lib/readapt/message/threads.rb +18 -18
- data/lib/readapt/message/variables.rb +61 -61
- data/lib/readapt/monitor.rb +0 -0
- data/lib/readapt/output.rb +25 -0
- data/lib/readapt/references.rb +27 -0
- data/lib/readapt/server.rb +22 -0
- data/lib/readapt/shell.rb +104 -41
- data/lib/readapt/snapshot.rb +0 -0
- data/lib/readapt/thread.rb +25 -28
- data/lib/readapt/variable.rb +1 -1
- data/lib/readapt/version.rb +3 -3
- data/readapt.gemspec +39 -39
- metadata +15 -9
- data/ext/readapt/hash_table.h +0 -30
data/ext/readapt/breakpoints.h
CHANGED
@@ -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
|
data/ext/readapt/extconf.rb
CHANGED
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
|
+
}
|
data/ext/readapt/frame.h
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
#ifndef FRAME_H_
|
2
|
-
#define FRAME_H_
|
3
|
-
|
4
|
-
#include "ruby.h"
|
5
|
-
|
6
|
-
typedef struct frame_struct {
|
7
|
-
char *file;
|
8
|
-
int line;
|
9
|
-
VALUE binding;
|
10
|
-
} frame_t;
|
11
|
-
|
12
|
-
void initialize_frame(VALUE);
|
13
|
-
frame_t *frame_data_from_tracepoint(VALUE);
|
14
|
-
VALUE frame_new_from_data(frame_t *);
|
15
|
-
void frame_free(void *);
|
16
|
-
|
17
|
-
#endif
|
1
|
+
#ifndef FRAME_H_
|
2
|
+
#define FRAME_H_
|
3
|
+
|
4
|
+
#include "ruby.h"
|
5
|
+
|
6
|
+
typedef struct frame_struct {
|
7
|
+
char *file;
|
8
|
+
int line;
|
9
|
+
VALUE binding;
|
10
|
+
} frame_t;
|
11
|
+
|
12
|
+
void initialize_frame(VALUE);
|
13
|
+
frame_t *frame_data_from_tracepoint(VALUE);
|
14
|
+
VALUE frame_new_from_data(frame_t *);
|
15
|
+
void frame_free(void *);
|
16
|
+
|
17
|
+
#endif
|
data/ext/readapt/inspector.c
CHANGED
@@ -1,51 +1,51 @@
|
|
1
|
-
#include "ruby.h"
|
2
|
-
#include "ruby/debug.h"
|
3
|
-
#include "frame.h"
|
4
|
-
#include "threads.h"
|
5
|
-
#include "normalize.h"
|
6
|
-
|
7
|
-
static VALUE process_inspection(const rb_debug_inspector_t *inspector, void *ptr)
|
8
|
-
{
|
9
|
-
VALUE locations;
|
10
|
-
long i_size;
|
11
|
-
long i;
|
12
|
-
VALUE loc;
|
13
|
-
VALUE path;
|
14
|
-
int line;
|
15
|
-
VALUE bnd;
|
16
|
-
thread_reference_t *data;
|
17
|
-
frame_t *frm;
|
18
|
-
VALUE iseq;
|
19
|
-
|
20
|
-
data = ptr;
|
21
|
-
|
22
|
-
locations = rb_debug_inspector_backtrace_locations(inspector);
|
23
|
-
i_size = locations == Qnil ? 0 : RARRAY_LENINT(locations);
|
24
|
-
for (i = i_size - 1; i >= 0; i--)
|
25
|
-
{
|
26
|
-
iseq = rb_debug_inspector_frame_iseq_get(inspector, i);
|
27
|
-
if (iseq != Qnil)
|
28
|
-
{
|
29
|
-
loc = rb_ary_entry(locations, i);
|
30
|
-
path = rb_funcall(loc, rb_intern("absolute_path"), 0);
|
31
|
-
line = NUM2INT(rb_funcall(loc, rb_intern("lineno"), 0));
|
32
|
-
bnd = rb_debug_inspector_frame_binding_get(inspector, i);
|
33
|
-
|
34
|
-
frm = malloc(sizeof(frame_t));
|
35
|
-
frm->file = normalize_path_new_cstr(StringValueCStr(path));
|
36
|
-
frm->line = line;
|
37
|
-
frm->binding = bnd;
|
38
|
-
stack_push(data->frames, frm);
|
39
|
-
}
|
40
|
-
}
|
41
|
-
|
42
|
-
return Qnil;
|
43
|
-
}
|
44
|
-
|
45
|
-
/**
|
46
|
-
* Get an array of frames from the Ruby debug inspector.
|
47
|
-
*/
|
48
|
-
void inspector_inspect(thread_reference_t *data)
|
49
|
-
{
|
50
|
-
rb_debug_inspector_open(process_inspection, (void *)data);
|
51
|
-
}
|
1
|
+
#include "ruby.h"
|
2
|
+
#include "ruby/debug.h"
|
3
|
+
#include "frame.h"
|
4
|
+
#include "threads.h"
|
5
|
+
#include "normalize.h"
|
6
|
+
|
7
|
+
static VALUE process_inspection(const rb_debug_inspector_t *inspector, void *ptr)
|
8
|
+
{
|
9
|
+
VALUE locations;
|
10
|
+
long i_size;
|
11
|
+
long i;
|
12
|
+
VALUE loc;
|
13
|
+
VALUE path;
|
14
|
+
int line;
|
15
|
+
VALUE bnd;
|
16
|
+
thread_reference_t *data;
|
17
|
+
frame_t *frm;
|
18
|
+
VALUE iseq;
|
19
|
+
|
20
|
+
data = ptr;
|
21
|
+
|
22
|
+
locations = rb_debug_inspector_backtrace_locations(inspector);
|
23
|
+
i_size = locations == Qnil ? 0 : RARRAY_LENINT(locations);
|
24
|
+
for (i = i_size - 1; i >= 0; i--)
|
25
|
+
{
|
26
|
+
iseq = rb_debug_inspector_frame_iseq_get(inspector, i);
|
27
|
+
if (iseq != Qnil)
|
28
|
+
{
|
29
|
+
loc = rb_ary_entry(locations, i);
|
30
|
+
path = rb_funcall(loc, rb_intern("absolute_path"), 0);
|
31
|
+
line = NUM2INT(rb_funcall(loc, rb_intern("lineno"), 0));
|
32
|
+
bnd = rb_debug_inspector_frame_binding_get(inspector, i);
|
33
|
+
|
34
|
+
frm = malloc(sizeof(frame_t));
|
35
|
+
frm->file = normalize_path_new_cstr(StringValueCStr(path));
|
36
|
+
frm->line = line;
|
37
|
+
frm->binding = bnd;
|
38
|
+
stack_push(data->frames, frm);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
return Qnil;
|
43
|
+
}
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Get an array of frames from the Ruby debug inspector.
|
47
|
+
*/
|
48
|
+
void inspector_inspect(thread_reference_t *data)
|
49
|
+
{
|
50
|
+
rb_debug_inspector_open(process_inspection, (void *)data);
|
51
|
+
}
|
data/ext/readapt/inspector.h
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#ifndef INSPECTOR_H_
|
2
|
-
#define INSPECTOR_H_
|
3
|
-
|
4
|
-
#include "ruby.h"
|
5
|
-
|
6
|
-
void inspector_inspect(thread_reference_t *);
|
7
|
-
|
8
|
-
#endif
|
1
|
+
#ifndef INSPECTOR_H_
|
2
|
+
#define INSPECTOR_H_
|
3
|
+
|
4
|
+
#include "ruby.h"
|
5
|
+
|
6
|
+
void inspector_inspect(thread_reference_t *);
|
7
|
+
|
8
|
+
#endif
|