readapt 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c60f531994db02e3c7592e83854acd4ed407c72fb8cea7d917bd22a47a7e0d37
4
- data.tar.gz: 427826613e80cd2ede776dd58a4ec84aee7be8a0a507dcd1da51dac78c2035e1
3
+ metadata.gz: 540b9c4c18bdbd634b6db72f49fa456dc306f41f139f966770795f89850a130a
4
+ data.tar.gz: c0ebaf5c647ddb1c794904928902da3f8bed362562d631c25badf89acbebaef1
5
5
  SHA512:
6
- metadata.gz: 4dc1eb602525d5dff1b8ad38254285eed0c52b48c9e996164ad8f54cf525c7f6097872f835e61aee622ae203ec4bc611bb2965dc87866b07ca736ec7c42614da
7
- data.tar.gz: b0f4250aacaf718351ceabe475c73ae923b0373392247733960c61d577cf042b95084985cfe36c2412d47e96a2b732eabb601e862d9c61268a20e33005b295a3
6
+ metadata.gz: b6da35b56e5244c2f3e1071ca3899f790edbfd78291d2756f1a5b0c1ab22e746ac1e83e20ec8f899eaf6fe77a408d671f5a838c2b68fda3d4798ab10ac7b0e6a
7
+ data.tar.gz: 6a97d5f44f5b866e3b68a78a804b52ed90b2114204f9db180fe3fe7fbe49ccbb3d08567ccdd4783e565acdb0278b195fdd0676d9193c0e59b8cd73d3578a74f2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.6.2 - September 10, 2019
2
+ - Monitor processes all new threads
3
+ - Discard buggy output redirection
4
+
1
5
  # 0.6.1 - September 7, 2019
2
6
  - Ignore nilable paths in thread events
3
7
 
@@ -86,52 +86,49 @@ process_line_event(VALUE tracepoint, void *data)
86
86
  if (ref != Qnil)
87
87
  {
88
88
  ptr = thread_reference_pointer(ref);
89
- if (ptr->depth > 0)
89
+ threadPaused = (ptr->control == id_pause);
90
+ if (firstLineEvent && ptr->control == id_continue && breakpoints_files() == 0)
90
91
  {
91
- threadPaused = (ptr->control == id_pause);
92
- if (firstLineEvent && ptr->control == id_continue && breakpoints_files() == 0)
93
- {
94
- return;
95
- }
96
- tp = rb_tracearg_from_tracepoint(tracepoint);
97
- tmp = rb_tracearg_path(tp);
98
- tp_file = normalize_path_new_cstr(StringValueCStr(tmp));
99
- tp_line = NUM2LONG(rb_tracearg_lineno(tp));
100
-
101
- dapEvent = id_continue;
102
- if (!firstLineEvent)
103
- {
104
- if (strcmp(tp_file, entryFile) == 0)
105
- {
106
- firstLineEvent = 1;
107
- ptr->control = rb_intern("entry");
108
- process_line_event(tracepoint, data);
109
- }
110
- }
111
- else if (threadPaused)
112
- {
113
- dapEvent = id_pause;
114
- }
115
- else if (match_step(ptr))
116
- {
117
- dapEvent = rb_intern("step");
118
- }
119
- else if (breakpoints_match(tp_file, tp_line))
120
- {
121
- dapEvent = rb_intern("breakpoint");
122
- }
123
- else if (ptr->control == id_entry)
124
- {
125
- dapEvent = id_entry;
126
- }
92
+ return;
93
+ }
94
+ tp = rb_tracearg_from_tracepoint(tracepoint);
95
+ tmp = rb_tracearg_path(tp);
96
+ tp_file = normalize_path_new_cstr(StringValueCStr(tmp));
97
+ tp_line = NUM2LONG(rb_tracearg_lineno(tp));
127
98
 
128
- if (dapEvent != id_continue)
99
+ dapEvent = id_continue;
100
+ if (!firstLineEvent)
101
+ {
102
+ if (strcmp(tp_file, entryFile) == 0)
129
103
  {
130
- monitor_debug(tp_file, tp_line, tracepoint, ptr, dapEvent);
104
+ firstLineEvent = 1;
105
+ ptr->control = rb_intern("entry");
106
+ process_line_event(tracepoint, data);
131
107
  }
108
+ }
109
+ else if (threadPaused)
110
+ {
111
+ dapEvent = id_pause;
112
+ }
113
+ else if (match_step(ptr))
114
+ {
115
+ dapEvent = rb_intern("step");
116
+ }
117
+ else if (breakpoints_match(tp_file, tp_line))
118
+ {
119
+ dapEvent = rb_intern("breakpoint");
120
+ }
121
+ else if (ptr->control == id_entry)
122
+ {
123
+ dapEvent = id_entry;
124
+ }
132
125
 
133
- free(tp_file);
126
+ if (dapEvent != id_continue)
127
+ {
128
+ monitor_debug(tp_file, tp_line, tracepoint, ptr, dapEvent);
134
129
  }
130
+
131
+ free(tp_file);
135
132
  }
136
133
  }
137
134
 
@@ -173,23 +170,15 @@ process_thread_begin_event(VALUE tracepoint, void *data)
173
170
  here = rb_ary_pop(list);
174
171
  if (here != Qnil)
175
172
  {
176
- prev = rb_ary_pop(list);
177
- if (prev != Qnil)
178
- {
179
- ref = thread_reference(prev);
180
- if (ref != Qnil)
181
- {
182
- ref = thread_add_reference(here);
183
- ptr = thread_reference_pointer(ref);
184
- monitor_debug(
185
- "",
186
- 0,
187
- tracepoint,
188
- ptr,
189
- rb_intern("thread_begin")
190
- );
191
- }
192
- }
173
+ ref = thread_add_reference(here);
174
+ ptr = thread_reference_pointer(ref);
175
+ monitor_debug(
176
+ "",
177
+ 0,
178
+ tracepoint,
179
+ ptr,
180
+ rb_intern("thread_begin")
181
+ );
193
182
  }
194
183
  }
195
184
 
@@ -105,16 +105,16 @@ module Readapt
105
105
  # @param [Snapshot]
106
106
  # return [void]
107
107
  def debug snapshot
108
- if (snapshot.event == :thread_begin)
109
- thr = Thread.new(snapshot.thread_id)
108
+ if snapshot.event == :thread_begin || snapshot.event == :entry
109
+ @threads[snapshot.thread_id] ||= Thread.new(snapshot.thread_id)
110
+ thr = @threads[snapshot.thread_id]
110
111
  thr.control = :continue
111
- @threads[snapshot.thread_id] = thr
112
112
  send_event('thread', {
113
113
  reason: 'started',
114
114
  threadId: snapshot.thread_id
115
115
  }, true)
116
116
  snapshot.control = :continue
117
- elsif (snapshot.event == :thread_end)
117
+ elsif snapshot.event == :thread_end
118
118
  thr = thread(snapshot.thread_id)
119
119
  thr.control = :continue
120
120
  @threads.delete snapshot.thread_id
@@ -123,8 +123,8 @@ module Readapt
123
123
  threadId: snapshot.thread_id
124
124
  })
125
125
  snapshot.control = :continue
126
- elsif snapshot.event == :entry
127
- snapshot.control = :continue
126
+ # elsif snapshot.event == :entry
127
+ # snapshot.control = :continue
128
128
  else
129
129
  changed
130
130
  thread = self.thread(snapshot.thread_id)
data/lib/readapt/shell.rb CHANGED
@@ -28,18 +28,6 @@ module Readapt
28
28
  Readapt::Adapter.host debugger
29
29
  machine.prepare Backport::Server::Tcpip.new(host: options[:host], port: options[:port], adapter: Readapt::Adapter)
30
30
  STDERR.puts "Readapt Debugger #{Readapt::VERSION} is listening HOST=#{options[:host]} PORT=#{options[:port]} PID=#{Process.pid}"
31
- # Redirect STDOUT and STDERR through the adapter protocol
32
- # @todo This feature does not always work with STDERR, e.g, when
33
- # running RSpec
34
- cats = ['stdout', 'stderr']
35
- [STDOUT, STDERR].each do |io|
36
- cat = cats.shift
37
- io.instance_eval do
38
- define_singleton_method :write do |*args, &block|
39
- debugger.output args.join, cat
40
- end
41
- end
42
- end
43
31
  end
44
32
  end
45
33
  end
@@ -1,3 +1,3 @@
1
1
  module Readapt
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: readapt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-07 00:00:00.000000000 Z
11
+ date: 2019-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backport