readapt 0.3.3 → 0.3.4

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: 576bfe9759ad1652ed7e1f9be3275e7edf0a6e18bc168f35a97b4b30a0a9728b
4
- data.tar.gz: 77c1174abc7c9c3af32f383ad08eaa530580386c2c1bc9547d1021839ff52e6a
3
+ metadata.gz: ca110db308531d06091109f30be41eade7e691deedef85925b758510590142a1
4
+ data.tar.gz: 75527ab9f084610c45a5bd2127e45d10c805b47f64932b96468869eabcdd1faf
5
5
  SHA512:
6
- metadata.gz: f1f25315559f32d7d5e1e4577abdbefca704bfd3e40678bb830ec7ad9e01ec6bb5e10cb0056a68d2e05434651d72331d5347f8096c5bc7bbd4122a6dbdae2e99
7
- data.tar.gz: 0a8bb70abe9d5e9b8b856a2d42c27dc29e17b0e7242a20fcda56ba2977803eceb7b7e1ba69b5d8e14d91ccdc0dd4671d67021d0a05df59cc392f7344592b9d9c
6
+ metadata.gz: 3c3f6ca8d4bdce3fed59f0dafc98713ca48d85aa1a7676203c16da6ae6f43563e499942648b7022ccd546e6e9ebcdee2898dc136121e9b4bccd889dd3519ce4f
7
+ data.tar.gz: f7f7c707ae55f1ac8433e9ac682f9cd39f6c44195f4403b70f0917e9957102c87f730bb8eab20fd241774e17b290be0eab7b81308881a87fd6a24ba544803c8c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 0.3.4 - August 12, 2019
2
+ - Monitor normalizes paths.
3
+
1
4
  # 0.3.3 - August 12, 2019
2
5
  - Remove RB_NIL_P for backwards compatibility
3
6
 
@@ -1,10 +1,13 @@
1
1
  #include "ruby.h"
2
2
  #include "ruby/debug.h"
3
3
  #include "threads.h"
4
+ #include "normalize.h"
4
5
 
6
+ static VALUE readapt;
5
7
  static VALUE m_Monitor;
6
8
  static VALUE c_Snapshot;
7
9
 
10
+ static VALUE readapt;
8
11
  static VALUE tpLine;
9
12
  static VALUE tpCall;
10
13
  static VALUE tpReturn;
@@ -112,10 +115,10 @@ process_line_event(VALUE tracepoint, void *data)
112
115
  if (!firstLineEvent || threadPaused || knownBreakpoints || ptr->control != rb_intern("continue"))
113
116
  {
114
117
  tp = rb_tracearg_from_tracepoint(tracepoint);
115
- tp_file = rb_tracearg_path(tp);
118
+ tp_file = normalize_path(rb_tracearg_path(tp));
116
119
  tp_line = NUM2INT(rb_tracearg_lineno(tp));
117
120
 
118
- dapEvent = NULL;
121
+ dapEvent = rb_intern("continue");
119
122
  if (!firstLineEvent)
120
123
  {
121
124
  dapEvent = rb_intern("initialize");
@@ -136,7 +139,8 @@ process_line_event(VALUE tracepoint, void *data)
136
139
  {
137
140
  dapEvent = rb_intern("entry");
138
141
  }
139
- if (dapEvent)
142
+
143
+ if (dapEvent != rb_intern("continue"))
140
144
  {
141
145
  result = monitor_debug(tp_file, tp_line, tracepoint, ptr, dapEvent);
142
146
  if (dapEvent == rb_intern("initialize") && result == rb_intern("ready"))
@@ -146,6 +150,11 @@ process_line_event(VALUE tracepoint, void *data)
146
150
  process_line_event(tracepoint, data);
147
151
  }
148
152
  }
153
+ else
154
+ {
155
+ ptr->prev_file = Qnil;
156
+ ptr->prev_line = Qnil;
157
+ }
149
158
  }
150
159
  else
151
160
  {
@@ -304,6 +313,7 @@ monitor_know_breakpoints_s(VALUE self)
304
313
 
305
314
  void initialize_monitor(VALUE m_Readapt)
306
315
  {
316
+ readapt = m_Readapt;
307
317
  m_Monitor = rb_define_module_under(m_Readapt, "Monitor");
308
318
  c_Snapshot = rb_define_class_under(m_Readapt, "Snapshot", rb_cObject);
309
319
 
@@ -0,0 +1,54 @@
1
+ #include "ruby.h"
2
+ #include "ruby/debug.h"
3
+
4
+ static int isWindows;
5
+
6
+ static int
7
+ checkIfWindows()
8
+ {
9
+ VALUE regexp, result;
10
+
11
+ regexp = rb_reg_new("/cygwin|mswin|mingw|bccwin|wince|emx/", 37, 0);
12
+ result = rb_reg_match(regexp, rb_str_new_cstr(RUBY_PLATFORM));
13
+ return result == Qnil ? 0 : 1;
14
+ }
15
+
16
+ VALUE
17
+ normalize_path(VALUE str)
18
+ {
19
+ VALUE result;
20
+ char *buffer;
21
+ long i, len;
22
+
23
+ if (isWindows)
24
+ {
25
+ buffer = malloc((rb_str_strlen(str) + 1) * sizeof(char));
26
+ strcpy(buffer, StringValueCStr(str));
27
+ buffer[0] = toupper(buffer[0]);
28
+ len = strlen(buffer);
29
+ for (i = 2; i < len; i++)
30
+ {
31
+ if (buffer[i] == '\\')
32
+ {
33
+ buffer[i] = '/';
34
+ }
35
+ }
36
+ result = rb_str_new_cstr(buffer);
37
+ free(buffer);
38
+ return result;
39
+ }
40
+ return str;
41
+ }
42
+
43
+ static VALUE
44
+ normalize_path_s(VALUE self, VALUE str)
45
+ {
46
+ return normalize_path(str);
47
+ }
48
+
49
+ void initialize_normalize(VALUE m_Readapt)
50
+ {
51
+ isWindows = checkIfWindows();
52
+
53
+ rb_define_singleton_method(m_Readapt, "normalize_path", normalize_path_s, 1);
54
+ }
@@ -0,0 +1,2 @@
1
+ void initialize_normalize(VALUE);
2
+ VALUE normalize_path(VALUE);
@@ -1,6 +1,7 @@
1
1
  #include "ruby.h"
2
2
  #include "ruby/debug.h"
3
3
  #include "monitor.h"
4
+ #include "normalize.h"
4
5
 
5
6
  static VALUE m_Readapt;
6
7
 
@@ -8,5 +9,6 @@ void Init_readapt()
8
9
  {
9
10
  m_Readapt = rb_define_module("Readapt");
10
11
 
12
+ initialize_normalize(m_Readapt);
11
13
  initialize_monitor(m_Readapt);
12
14
  }
data/lib/readapt.rb CHANGED
@@ -17,18 +17,4 @@ require 'readapt/readapt'
17
17
  require 'readapt/shell'
18
18
 
19
19
  module Readapt
20
- class Error < StandardError; end
21
- # Your code goes here...
22
- end
23
-
24
- Readapt.module_exec do
25
- if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
26
- define_singleton_method :normalize_path do |path|
27
- path[0].upcase + path[1..-1].gsub('\\', '/')
28
- end
29
- else
30
- define_singleton_method :normalize_path do |path|
31
- path
32
- end
33
- end
34
20
  end
@@ -1,3 +1,3 @@
1
1
  module Readapt
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: readapt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
@@ -119,6 +119,8 @@ files:
119
119
  - ext/readapt/extconf.rb
120
120
  - ext/readapt/monitor.c
121
121
  - ext/readapt/monitor.h
122
+ - ext/readapt/normalize.c
123
+ - ext/readapt/normalize.h
122
124
  - ext/readapt/readapt.c
123
125
  - ext/readapt/threads.c
124
126
  - ext/readapt/threads.h