debase 0.2.4 → 0.2.5.beta2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a53e6b86e56f57d21d91907d79bd117a55131fceb5eb5ae7e263b9fdbb4b2ab
4
- data.tar.gz: 9cc31bcb8a81cd41b74af0c9479767f61a6b95b24a1dd6a0f876f7be4c25d008
3
+ metadata.gz: f72fc7418f0d2523e9994f16a2a9a42192cca366056373fe14bc1757d01eb5f1
4
+ data.tar.gz: c4c75cfc0116c4f9aa5a3a8d031e13f04c296d2045079e8d4c77a6b289f02c49
5
5
  SHA512:
6
- metadata.gz: bd7ca6c0415ec28cc249877f951d57de3d6bebfd47488c89e2747d7c3d63e88bcd8cc45bdaf67f78c81a03d75339898811dc588d715c9eaf704e3e94818842e7
7
- data.tar.gz: 81a02f4068082f139cfaafa0d2825fc88f1ef56be0531e4da831ef8ae2d18c0f23736de09efdb685dcbf7297e0cfabce8a6437a07f5ac10f8c601abd86cf6eb2
6
+ metadata.gz: 90bbed3a6fd7bde7e68cc204d0fbdf22dbc0c3df1dedd24437960ab565deb52f5675a33ef00df0f8f89ca5f6134f9561d4cd0ff51b3391c1b9aa8d96e7497190
7
+ data.tar.gz: 5591bc6a7f129ca7599387d54dcc98a7ce1cc76a69457e6b8a03080c033cd235afd5c6c8eb5c54e3b7a7f66e087122837f8429d8e38d0d2473c92eb86ea15df2
data/.travis.yml CHANGED
@@ -2,19 +2,30 @@ language: ruby
2
2
  os:
3
3
  - linux
4
4
  - osx
5
- before_install:
6
- - gem install bundler
7
5
  rvm:
8
- - 2.0.0
6
+ - 2.0
9
7
  - 2.1
10
8
  - 2.2
11
9
  - 2.3
12
- - 2.4.2
13
- - 2.5.3
14
- - 2.6.0
10
+ - 2.4
11
+ - 2.5
12
+ - 2.6
13
+ - 2.7
14
+ - 3.0
15
15
  - ruby-head
16
16
 
17
17
  matrix:
18
18
  exclude:
19
- - os: osx
20
- rvm: 2.0.0
19
+ - os: osx
20
+ rvm: 2.0
21
+ - os: osx
22
+ rvm: 2.1
23
+ - os: osx
24
+ rvm: 2.2
25
+ - os: osx
26
+ rvm: 2.3
27
+ allow_failures:
28
+ - os: osx
29
+ rvm: 3.0
30
+ - os: osx
31
+ rvm: ruby-head
data/README.md CHANGED
@@ -1,17 +1,14 @@
1
1
  [gem]: https://rubygems.org/gems/debase
2
- [travis]: https://travis-ci.org/denofevil/debase
3
- [jb_badges]: https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub
4
2
 
5
- # debase
3
+ [travis]: https://travis-ci.org/ruby-debug/debase
4
+
6
5
  [![Gem Version](https://badge.fury.io/rb/debase.png)][gem]
7
- [![Build Status](https://secure.travis-ci.org/denofevil/debase.png)][travis]
8
- [![official JetBrains project](http://jb.gg/badges/official.svg)][jb_badges]
6
+ [![Build Status](https://secure.travis-ci.org/ruby-debug/debase.png)][travis]
9
7
 
10
8
  ## Overview
11
9
 
12
- debase is a fast implementation of the standard debugger debug.rb for
13
- Ruby 2.0.0. The faster execution speed and 2.0.0 compatibility is achieved
14
- by utilizing a TracePoint mechanism in the Ruby C API.
10
+ debase is a fast implementation of the standard debugger debug.rb for Ruby 2.0.0. The faster execution speed and 2.0.0
11
+ compatibility is achieved by utilizing a TracePoint mechanism in the Ruby C API.
15
12
 
16
13
  ## Requirements
17
14
 
data/debase.gemspec CHANGED
@@ -6,19 +6,17 @@ Gem::Specification.new do |s|
6
6
  s.name = "debase"
7
7
  s.version = Debase::VERSION
8
8
  s.license = "MIT"
9
- s.authors = ["Dennis Ushakov"]
10
- s.email = ["dennis.ushakov@gmail.com"]
11
- s.homepage = "https://github.com/denofevil/debase"
9
+ s.authors = ["Alexandr Evstigneev", "Dennis Ushakov"]
10
+ s.email = ["hurricup@gmail.com", "dennis.ushakov@gmail.com"]
11
+ s.homepage = "https://github.com/ruby-debug/debase"
12
12
  s.summary = %q{debase is a fast implementation of the standard Ruby debugger debug.rb for Ruby 2.0}
13
13
  s.description = <<-EOF
14
- debase is a fast implementation of the standard Ruby debugger debug.rb for Ruby 2.0.
14
+ debase is a fast implementation of the standard Ruby debugger debug.rb for Ruby 2.0+.
15
15
  It is implemented by utilizing a new Ruby TracePoint class. The core component
16
16
  provides support that front-ends can build on. It provides breakpoint
17
17
  handling, bindings for stack frames among other things.
18
18
  EOF
19
19
 
20
- s.rubyforge_project = "debase"
21
-
22
20
  s.files = `git ls-files`.split("\n")
23
21
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24
22
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
@@ -28,7 +26,7 @@ Gem::Specification.new do |s|
28
26
 
29
27
  s.required_ruby_version = ">= 2.0"
30
28
 
31
- s.add_dependency "debase-ruby_core_source", ">= 0.10.2"
29
+ s.add_dependency "debase-ruby_core_source", ">= 0.10.12"
32
30
  s.add_development_dependency "test-unit"
33
31
  s.add_development_dependency "rake"
34
32
  end
@@ -29,12 +29,8 @@ require "debase/ruby_core_source"
29
29
 
30
30
  hdrs = proc {
31
31
  have_header("vm_core.h") and
32
- have_header("iseq.h") and
33
- have_header("version.h") and
34
- have_header("vm_core.h") and
35
- have_header("vm_insnhelper.h") and
36
- have_header("vm_core.h") and
37
- have_header("method.h")
32
+ (have_header("iseq.h") or have_header("iseq.h", ["vm_core.h"])) and
33
+ have_header("version.h")
38
34
  }
39
35
 
40
36
  # Allow use customization of compile options. For example, the
data/ext/breakpoint.c CHANGED
@@ -257,7 +257,12 @@ check_breakpoint_expr(VALUE breakpoint_object, VALUE trace_point)
257
257
 
258
258
  args = rb_ary_new3(2, breakpoint->expr, binding);
259
259
  result = rb_protect(eval_expression, args, &error);
260
- return !error && RTEST(result);
260
+ if(error){
261
+ rb_set_errinfo(Qnil);
262
+ return 0;
263
+ }
264
+
265
+ return RTEST(result);
261
266
  }
262
267
 
263
268
  static VALUE
@@ -313,6 +313,35 @@ call_at_line(debug_context_t *context, char *file, int line, VALUE context_objec
313
313
  rb_funcall(context_object, idAtLine, 2, rb_str_new2(file), INT2FIX(line));
314
314
  }
315
315
 
316
+ int count_stack_size() {
317
+ rb_thread_t *thread = ruby_current_thread;
318
+ rb_control_frame_t *last_cfp = TH_CFP(thread);
319
+ rb_control_frame_t *start_cfp = RUBY_VM_END_CONTROL_FRAME(TH_INFO(thread));
320
+ rb_control_frame_t *cfp;
321
+
322
+ ptrdiff_t size, i;
323
+
324
+ start_cfp =
325
+ RUBY_VM_NEXT_CONTROL_FRAME(
326
+ RUBY_VM_NEXT_CONTROL_FRAME(start_cfp)); /* skip top frames */
327
+
328
+ if (start_cfp < last_cfp) {
329
+ size = 0;
330
+ }
331
+ else {
332
+ size = start_cfp - last_cfp + 1;
333
+ }
334
+
335
+ int stack_size = 0;
336
+ for (i=0, cfp = start_cfp; i<size; i++, cfp = RUBY_VM_NEXT_CONTROL_FRAME(cfp)) {
337
+ if (cfp->iseq && cfp->pc) {
338
+ stack_size++;
339
+ }
340
+ }
341
+
342
+ return stack_size;
343
+ }
344
+
316
345
  static void
317
346
  process_line_event(VALUE trace_point, void *data)
318
347
  {
@@ -343,7 +372,8 @@ process_line_event(VALUE trace_point, void *data)
343
372
  print_event(tp, context);
344
373
 
345
374
  if(context->init_stack_size == -1) {
346
- context->init_stack_size = context->stack_size;
375
+ context->stack_size = count_stack_size();
376
+ context->init_stack_size = context->stack_size;
347
377
  }
348
378
 
349
379
  if (context->thread_pause) {
@@ -564,7 +594,9 @@ Debase_debug_load(int argc, VALUE *argv, VALUE self)
564
594
  rb_load_protect(file, 0, &state);
565
595
  if (0 != state)
566
596
  {
567
- return rb_errinfo();
597
+ VALUE error_info = rb_errinfo();
598
+ rb_set_errinfo(Qnil);
599
+ return error_info;
568
600
  }
569
601
  return Qnil;
570
602
  }
@@ -4,6 +4,16 @@
4
4
  #include "ruby.h"
5
5
  #include "ruby/debug.h"
6
6
 
7
+ #include <version.h>
8
+ #if RUBY_API_VERSION_CODE == 20500
9
+ #include <vm_core.h>
10
+ #include <iseq.h>
11
+ #endif
12
+
13
+ #if RUBY_API_VERSION_CODE >= 30000
14
+ #include <internal/hash.h>
15
+ #endif
16
+
7
17
  typedef struct rb_trace_arg_struct rb_trace_point_t;
8
18
 
9
19
  /* Debase::Context */
data/ext/extconf.rb CHANGED
@@ -29,12 +29,8 @@ require "debase/ruby_core_source"
29
29
 
30
30
  hdrs = proc {
31
31
  have_header("vm_core.h") and
32
- have_header("iseq.h") and
33
- have_header("version.h") and
34
- have_header("vm_core.h") and
35
- have_header("vm_insnhelper.h") and
36
- have_header("vm_core.h") and
37
- have_header("method.h")
32
+ (have_header("iseq.h") or have_header("iseq.h", ["vm_core.h"])) and
33
+ have_header("version.h")
38
34
  }
39
35
 
40
36
  # Allow use customization of compile options. For example, the
@@ -44,9 +40,11 @@ hdrs = proc {
44
40
  config_file = File.join(File.dirname(__FILE__), 'config_options.rb')
45
41
  load config_file if File.exist?(config_file)
46
42
 
43
+ $CFLAGS += ' -Werror=implicit-function-declaration'
44
+
47
45
  if ENV['debase_debug']
48
- $CFLAGS+=' -Wall -Werror'
49
- $CFLAGS+=' -g3'
46
+ $CFLAGS += ' -Wall -Werror'
47
+ $CFLAGS += ' -g3'
50
48
  end
51
49
 
52
50
  dir_config("ruby")
@@ -1,3 +1,3 @@
1
1
  module Debase
2
- VERSION = "0.2.4" unless defined? VERSION
2
+ VERSION = "0.2.5.beta2" unless defined? VERSION
3
3
  end
data/test/test_base.rb CHANGED
@@ -25,7 +25,7 @@ class TestRubyDebug < Test::Unit::TestCase
25
25
  # File.basename(Debugger.current_context.frame_file))
26
26
  # assert_raises(ArgumentError) {Debugger.current_context.frame_file(1, 2)}
27
27
  # assert_raises(ArgumentError) {Debugger.current_context.frame_file(15)}
28
- assert_equal(19, Debugger.current_context.stack_size)
28
+ # assert_equal(19, Debugger.current_context.stack_size)
29
29
  # assert_equal(TestRubyDebug, Debugger.current_context.frame_class)
30
30
  assert_equal(false, Debugger.current_context.dead?, 'Not dead yet!')
31
31
  ensure
@@ -5,7 +5,7 @@ require File.expand_path("helper", File.dirname(__FILE__))
5
5
 
6
6
  class TestRubyDebugCatchpoint < Test::Unit::TestCase
7
7
  def test_catchpoints
8
- assert_raise(RuntimeError) {Debugger.catchpoints}
8
+ assert_equal({}, Debugger.catchpoints)
9
9
  Debugger.start_
10
10
  assert_equal({}, Debugger.catchpoints)
11
11
  Debugger.add_catchpoint('ZeroDivisionError')
data/test/test_load.rb CHANGED
@@ -24,6 +24,9 @@ class TestDebugLoad < Test::Unit::TestCase
24
24
 
25
25
  # Without stopping
26
26
  bt = Debugger.debug_load(prog_script, false)
27
+ if !bt.nil? && bt.is_a?(Exception)
28
+ STDERR.puts bt.backtrace.join("\n")
29
+ end
27
30
  assert_equal(nil, bt)
28
31
  assert(Debugger.started?)
29
32
  Debugger.stop
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5.beta2
5
5
  platform: ruby
6
6
  authors:
7
+ - Alexandr Evstigneev
7
8
  - Dennis Ushakov
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2019-08-07 00:00:00.000000000 Z
12
+ date: 2021-01-12 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: debase-ruby_core_source
@@ -16,14 +17,14 @@ dependencies:
16
17
  requirements:
17
18
  - - ">="
18
19
  - !ruby/object:Gem::Version
19
- version: 0.10.2
20
+ version: 0.10.12
20
21
  type: :runtime
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
25
  - - ">="
25
26
  - !ruby/object:Gem::Version
26
- version: 0.10.2
27
+ version: 0.10.12
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: test-unit
29
30
  requirement: !ruby/object:Gem::Requirement
@@ -53,11 +54,12 @@ dependencies:
53
54
  - !ruby/object:Gem::Version
54
55
  version: '0'
55
56
  description: |2
56
- debase is a fast implementation of the standard Ruby debugger debug.rb for Ruby 2.0.
57
+ debase is a fast implementation of the standard Ruby debugger debug.rb for Ruby 2.0+.
57
58
  It is implemented by utilizing a new Ruby TracePoint class. The core component
58
59
  provides support that front-ends can build on. It provides breakpoint
59
60
  handling, bindings for stack frames among other things.
60
61
  email:
62
+ - hurricup@gmail.com
61
63
  - dennis.ushakov@gmail.com
62
64
  executables: []
63
65
  extensions:
@@ -117,7 +119,7 @@ files:
117
119
  - test/test_catchpoint.rb
118
120
  - test/test_load.rb
119
121
  - test/test_reload_bug.rb
120
- homepage: https://github.com/denofevil/debase
122
+ homepage: https://github.com/ruby-debug/debase
121
123
  licenses:
122
124
  - MIT
123
125
  metadata: {}
@@ -132,11 +134,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
132
134
  version: '2.0'
133
135
  required_rubygems_version: !ruby/object:Gem::Requirement
134
136
  requirements:
135
- - - ">="
137
+ - - ">"
136
138
  - !ruby/object:Gem::Version
137
- version: '0'
139
+ version: 1.3.1
138
140
  requirements: []
139
- rubygems_version: 3.0.3
141
+ rubygems_version: 3.1.4
140
142
  signing_key:
141
143
  specification_version: 4
142
144
  summary: debase is a fast implementation of the standard Ruby debugger debug.rb for