debase 0.1.7 → 0.1.8

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
  SHA1:
3
- metadata.gz: e77983a3d540de1c69aa61922cf0f21f95590b0b
4
- data.tar.gz: c303699055b54148fadbdd8d665f54d00f9da647
3
+ metadata.gz: 6b8071801790f34bce830bdd5a2bb8b57108df2e
4
+ data.tar.gz: 6cd1dd3915b8fcb14dc46672f7f9322bde458595
5
5
  SHA512:
6
- metadata.gz: bf02a4e0e01ce775481bce9e8c043c183471a2cf96adba5989a17855c7af9472b6fd4938bd30af346d9bbf21d4d036d20442a52a94b72742ad0352d6e1fec93a
7
- data.tar.gz: 3df6a9a730ed9200dab40b1c0b63d0266117c10adcd9b8c17c51393e8921d43cc34e6b119fc900ddc2469cdde513a540e1738744055f5a102c70e6489a02147c
6
+ metadata.gz: e123a89bfd5e489a8d4fa32e96073db799d7282c4ee19cda94b55a4f997a862f8acc883bc8d747abe3a937edb77bea18a084194328434d7985d3bef2c6e39d9c
7
+ data.tar.gz: 7dd979b629f781e3a25a2eca95935788f1ad4d089c34d4692472feaa01cbdc8f63c8b5011848f9a2a644228513ed43f080cca4b157b7d078a1709df71de19d11
@@ -1,22 +1,27 @@
1
- = debase
1
+ [gem]: https://rubygems.org/gems/debase
2
+ [travis]: https://travis-ci.org/denofevil/debase
2
3
 
3
- == Overview
4
+ # debase
5
+ [![Gem Version](https://badge.fury.io/rb/debase.png)][gem]
6
+ [![Build Status](https://secure.travis-ci.org/denofevil/debase.png)][travis]
7
+
8
+ ## Overview
4
9
 
5
10
  debase is a fast implementation of the standard debugger debug.rb for
6
11
  Ruby 2.0.0. The faster execution speed and 2.0.0 compatibility is achieved
7
12
  by utilizing a TracePoint mechanism in the Ruby C API.
8
13
 
9
- == Requirements
14
+ ## Requirements
10
15
 
11
16
  debase requires Ruby 2.0.0 or higher.
12
17
 
13
- == Install
18
+ ## Install
14
19
 
15
20
  debase is provided as a RubyGem. To install:
16
21
 
17
22
  <tt>gem install debase</tt>
18
23
 
19
- == License
24
+ ## License
20
25
 
21
26
  debase contains parts of the code from ruby-debug-base gem.
22
27
  See MIT_LICENSE and LICENSE for license information.
@@ -24,7 +24,7 @@ Context_thnum(VALUE self) {
24
24
  }
25
25
 
26
26
  static inline void
27
- fill_frame(debug_frame_t *frame, char* file, int line, VALUE binding, VALUE self)
27
+ fill_frame(debug_frame_t *frame, const char* file, int line, VALUE binding, VALUE self)
28
28
  {
29
29
  frame->file = file;
30
30
  frame->line = line;
@@ -39,7 +39,7 @@ fill_stack(debug_context_t *context, const rb_debug_inspector_t *inspector) {
39
39
  VALUE location;
40
40
  VALUE path;
41
41
  VALUE lineno;
42
- char *file;
42
+ const char *file;
43
43
  int line;
44
44
  int stack_size;
45
45
  int i;
@@ -5,7 +5,7 @@ static VALUE mDebase; /* Ruby Debase Module object */
5
5
  static VALUE cContext;
6
6
  static VALUE cDebugThread;
7
7
 
8
- static VALUE debug = Qfalse;
8
+ static VALUE verbose = Qfalse;
9
9
  static VALUE locker = Qnil;
10
10
  static VALUE contexts;
11
11
  static VALUE catchpoints;
@@ -37,7 +37,7 @@ Debase_thread_context(VALUE self, VALUE thread)
37
37
  static VALUE
38
38
  Debase_current_context(VALUE self)
39
39
  {
40
- return Debase_thread_context(self, rb_thread_current());
40
+ return Debase_thread_context(self, rb_thread_current());
41
41
  }
42
42
 
43
43
  static int
@@ -133,7 +133,7 @@ print_event(rb_trace_point_t *tp, debug_context_t *context)
133
133
  VALUE rb_cl_name;
134
134
  const char *defined_class;
135
135
 
136
- if (debug == Qtrue) {
136
+ if (verbose == Qtrue) {
137
137
  path = rb_tracearg_path(tp);
138
138
  line = rb_tracearg_lineno(tp);
139
139
  event = rb_tracearg_event(tp);
@@ -473,6 +473,32 @@ Debase_started(VALUE self)
473
473
  {
474
474
  return catchpoints != Qnil ? Qtrue : Qfalse;
475
475
  }
476
+
477
+ /*
478
+ * call-seq:
479
+ * Debase.verbose? -> bool
480
+ *
481
+ * Returns +true+ if verbose output of TracePoint API events is enabled.
482
+ */
483
+ static VALUE
484
+ Debase_verbose(VALUE self)
485
+ {
486
+ return verbose;
487
+ }
488
+
489
+ /*
490
+ * call-seq:
491
+ * Debase.verbose = bool
492
+ *
493
+ * Enable verbose output of every TracePoint API events, useful for debugging debase.
494
+ */
495
+ static VALUE
496
+ Debase_set_verbose(VALUE self, VALUE value)
497
+ {
498
+ verbose = RTEST(value) ? Qtrue : Qfalse;
499
+ return value;
500
+ }
501
+
476
502
  /*
477
503
  * Document-class: Debase
478
504
  *
@@ -493,6 +519,8 @@ Init_debase_internals()
493
519
  rb_define_module_function(mDebase, "breakpoints", Debase_breakpoints, 0);
494
520
  rb_define_module_function(mDebase, "catchpoints", Debase_catchpoints, 0);
495
521
  rb_define_module_function(mDebase, "started?", Debase_started, 0);
522
+ rb_define_module_function(mDebase, "verbose?", Debase_verbose, 0);
523
+ rb_define_module_function(mDebase, "verbose=", Debase_set_verbose, 1);
496
524
 
497
525
  idAlive = rb_intern("alive?");
498
526
  idAtLine = rb_intern("at_line");
@@ -33,7 +33,7 @@ typedef enum {CTX_STOP_NONE, CTX_STOP_STEP, CTX_STOP_BREAKPOINT, CTX_STOP_CATCHP
33
33
  typedef struct debug_frame_t
34
34
  {
35
35
  struct debug_frame_t *prev;
36
- char *file;
36
+ const char *file;
37
37
  int line;
38
38
  VALUE binding;
39
39
  VALUE self;
@@ -5,12 +5,14 @@ module Debase
5
5
  binding = frame_binding(frame_no)
6
6
  locals = eval("local_variables", binding)
7
7
  if locals.respond_to?(:each)
8
- locals.each {|local| result[local.to_s] = eval(local.to_s, binding)}
8
+ locals.each do |local|
9
+ result[local.to_s] = safe_eval(local.to_s, binding)
10
+ end
9
11
  else
10
- result[locals.to_s] = eval(locals.to_s, binding)
12
+ result[locals.to_s] = safe_eval(locals.to_s, binding)
11
13
  end
12
14
  result
13
- end
15
+ end
14
16
 
15
17
  def frame_class(frame_no=0)
16
18
  frame_self(frame_no).class
@@ -44,5 +46,16 @@ module Debase
44
46
  def at_return(file, line)
45
47
  handler.at_return(self, file, line)
46
48
  end
49
+
50
+ private
51
+
52
+ def safe_eval(expr, binding)
53
+ begin
54
+ eval(expr, binding)
55
+ rescue => e
56
+ "*Evaluation error: '#{e}'"
57
+ end
58
+ end
59
+
47
60
  end
48
61
  end
@@ -1,3 +1,3 @@
1
1
  module Debase
2
- VERSION = "0.1.7" unless defined? VERSION
2
+ VERSION = "0.1.8" unless defined? VERSION
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis Ushakov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-08 00:00:00.000000000 Z
11
+ date: 2015-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase-ruby_core_source
@@ -69,7 +69,7 @@ files:
69
69
  - Gemfile
70
70
  - LICENSE
71
71
  - MIT_LICENSE
72
- - README
72
+ - README.md
73
73
  - Rakefile
74
74
  - debase.gemspec
75
75
  - ext/breakpoint.c