debase 0.2.3.beta5 → 0.2.5.beta2

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
- SHA1:
3
- metadata.gz: 682d6984f0e5b33479f3c5138c7af974e59597cf
4
- data.tar.gz: ed9e19b600656cbd66f46c29673c1f557db8e51b
2
+ SHA256:
3
+ metadata.gz: f72fc7418f0d2523e9994f16a2a9a42192cca366056373fe14bc1757d01eb5f1
4
+ data.tar.gz: c4c75cfc0116c4f9aa5a3a8d031e13f04c296d2045079e8d4c77a6b289f02c49
5
5
  SHA512:
6
- metadata.gz: c128d2bfbc14ba0078f5605fbd9b2213eb77fcee710621efb9938d86923b1159707ea743a322e89f6b084089b7c6d1d1b3aec59acbd786578a8b6a0f2a739db6
7
- data.tar.gz: df4677f7266bdee7fe11fbb9157544a01233c65707dcb312927962591897a9187a412a976d8e98686a53645228313077c769f91a5e5b519ff72f9716b80aaae5
6
+ metadata.gz: 90bbed3a6fd7bde7e68cc204d0fbdf22dbc0c3df1dedd24437960ab565deb52f5675a33ef00df0f8f89ca5f6134f9561d4cd0ff51b3391c1b9aa8d96e7497190
7
+ data.tar.gz: 5591bc6a7f129ca7599387d54dcc98a7ce1cc76a69457e6b8a03080c033cd235afd5c6c8eb5c54e3b7a7f66e087122837f8429d8e38d0d2473c92eb86ea15df2
@@ -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
 
@@ -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
@@ -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
@@ -147,6 +147,7 @@ context_create(VALUE thread, VALUE cDebugThread) {
147
147
  context->stack_size = 0;
148
148
  locations = rb_funcall(thread, rb_intern("backtrace_locations"), 1, INT2FIX(1));
149
149
  context->calced_stack_size = locations != Qnil ? RARRAY_LENINT(locations) : 0;
150
+ context->init_stack_size = -1;
150
151
 
151
152
  context->stack = NULL;
152
153
  context->thnum = ++thnum_current;
@@ -154,6 +155,8 @@ context_create(VALUE thread, VALUE cDebugThread) {
154
155
  context->flags = 0;
155
156
  context->last_file = NULL;
156
157
  context->last_line = -1;
158
+ context->hit_user_code = 0;
159
+ context->script_finished = 0;
157
160
  context->stop_frame = -1;
158
161
  context->thread_pause = 0;
159
162
  context->stop_reason = CTX_STOP_NONE;
@@ -303,6 +303,8 @@ remove_pause_flag(VALUE thread, VALUE context_object, VALUE ignored)
303
303
  static void
304
304
  call_at_line(debug_context_t *context, char *file, int line, VALUE context_object)
305
305
  {
306
+ context->hit_user_code = 1;
307
+
306
308
  rb_hash_foreach(contexts, remove_pause_flag, 0);
307
309
  CTX_FL_UNSET(context, CTX_FL_STEPPED);
308
310
  CTX_FL_UNSET(context, CTX_FL_FORCE_MOVE);
@@ -311,6 +313,35 @@ call_at_line(debug_context_t *context, char *file, int line, VALUE context_objec
311
313
  rb_funcall(context_object, idAtLine, 2, rb_str_new2(file), INT2FIX(line));
312
314
  }
313
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
+
314
345
  static void
315
346
  process_line_event(VALUE trace_point, void *data)
316
347
  {
@@ -340,6 +371,11 @@ process_line_event(VALUE trace_point, void *data)
340
371
  update_stack_size(context);
341
372
  print_event(tp, context);
342
373
 
374
+ if(context->init_stack_size == -1) {
375
+ context->stack_size = count_stack_size();
376
+ context->init_stack_size = context->stack_size;
377
+ }
378
+
343
379
  if (context->thread_pause) {
344
380
  context->stop_next = 1;
345
381
  context->dest_frame = -1;
@@ -375,13 +411,18 @@ process_line_event(VALUE trace_point, void *data)
375
411
  breakpoint = breakpoint_find(breakpoints, path, lineno, trace_point);
376
412
  if (context->stop_next == 0 || context->stop_line == 0 || breakpoint != Qnil) {
377
413
  rb_ensure(start_inspector, context_object, stop_inspector, Qnil);
378
- context->stop_reason = CTX_STOP_STEP;
379
- if (breakpoint != Qnil) {
380
- context->stop_reason = CTX_STOP_BREAKPOINT;
381
- rb_funcall(context_object, idAtBreakpoint, 1, breakpoint);
414
+ if(context->stack_size <= context->init_stack_size && context->hit_user_code) {
415
+ context->script_finished = 1;
416
+ }
417
+ if(!context->script_finished) {
418
+ context->stop_reason = CTX_STOP_STEP;
419
+ if (breakpoint != Qnil) {
420
+ context->stop_reason = CTX_STOP_BREAKPOINT;
421
+ rb_funcall(context_object, idAtBreakpoint, 1, breakpoint);
422
+ }
423
+ reset_stepping_stop_points(context);
424
+ call_at_line(context, file, line, context_object);
382
425
  }
383
- reset_stepping_stop_points(context);
384
- call_at_line(context, file, line, context_object);
385
426
  }
386
427
  }
387
428
  cleanup(context);
@@ -553,7 +594,9 @@ Debase_debug_load(int argc, VALUE *argv, VALUE self)
553
594
  rb_load_protect(file, 0, &state);
554
595
  if (0 != state)
555
596
  {
556
- return rb_errinfo();
597
+ VALUE error_info = rb_errinfo();
598
+ rb_set_errinfo(Qnil);
599
+ return error_info;
557
600
  }
558
601
  return Qnil;
559
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 */
@@ -60,6 +70,9 @@ typedef struct debug_context {
60
70
 
61
71
  char *last_file;
62
72
  int last_line;
73
+ int init_stack_size;
74
+ int script_finished;
75
+ int hit_user_code;
63
76
  } debug_context_t;
64
77
 
65
78
  typedef struct
@@ -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.3.beta5" unless defined? VERSION
2
+ VERSION = "0.2.5.beta2" unless defined? VERSION
3
3
  end
@@ -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')
@@ -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.3.beta5
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-01-29 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: {}
@@ -136,8 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
138
  - !ruby/object:Gem::Version
137
139
  version: 1.3.1
138
140
  requirements: []
139
- rubyforge_project: debase
140
- rubygems_version: 2.6.10
141
+ rubygems_version: 3.1.4
141
142
  signing_key:
142
143
  specification_version: 4
143
144
  summary: debase is a fast implementation of the standard Ruby debugger debug.rb for