stack_trace 0.3.0 → 0.4.0

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: 62cea37e30a1a5cddfef34c91b25a5411b4a5edc017743179f4097a2a9682c43
4
- data.tar.gz: c06b33ab71d5c66dd4593952201eddbdfc85fec53fde5f321fc1d9a563d3f54e
3
+ metadata.gz: ac9e909692657f9e1b0cd9fc6475faf494458954513aa2e659e9faeacfb3d51b
4
+ data.tar.gz: d4819f5e40ef2d81cc5cc539247916ed16416eed9400f63007fe85edc8c9c4cf
5
5
  SHA512:
6
- metadata.gz: e1f0daca22d85120157d4252b7a63d0035a882bad2f3f4b14312734ca65af30d9c8b2c0f6057d573bb27d4ab3494b19e333c090230ec2d39da4b0743b7bd6d4a
7
- data.tar.gz: 33500c08305ce31b29049e3bab8fbcefbbc5a1a60ce4dd08ba0bd65efd23a7da9bbbf169993908e6b7e67d970db99fd2bd8aad9c67cbab6a2eaf84df6ae0ee99
6
+ metadata.gz: 072443043f5910dfd02ded927653a23abacefede4f17fd87155521275818b0b90aa769544c30e9f06b5c46c24193e9bac12f711ae39c4f887340d435402f40c2
7
+ data.tar.gz: d3a5c0ae3803776ea0ad504c825c75ca0d9a70d5153a22133f809633631f824a7540fe7dd72c76c9e4eece214bb578d04765445f39089adadc6076abbe7af10a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stack_trace (0.3.0)
4
+ stack_trace (0.4.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require "rake/extensiontask"
6
6
 
7
7
  RSpec::Core::RakeTask.new(:spec)
8
8
 
9
- task default: :spec
9
+ task default: [:compile, :spec]
10
10
 
11
11
  Rake::ExtensionTask.new "stack_trace" do |ext|
12
12
  ext.lib_dir = "lib/stack_trace/ext"
@@ -20,7 +20,8 @@ void free_trace(Trace *trace) {
20
20
  }
21
21
 
22
22
  void process_obsolote_event(Event *event) {
23
- // free_trace(event->trace);
23
+ // Free this trace as there is no reference to it anymore!
24
+ free_trace(event->trace);
24
25
  }
25
26
 
26
27
  void set_check_proc(VALUE proc) {
@@ -118,10 +119,14 @@ VALUE to_ruby_hash(Trace *trace) {
118
119
  }
119
120
 
120
121
  VALUE rb_get_current_trace(VALUE _self) {
122
+ VALUE main_module = rb_const_get(rb_cObject, rb_intern("StackTrace"));
123
+ VALUE tracePoint = rb_iv_get(main_module, "@trace_point");
124
+ VALUE is_tracepoint_enabled = rb_funcall(tracePoint, rb_intern("enabled?"), 0);
125
+
126
+ if(RTEST(is_tracepoint_enabled)) rb_raise(rb_eRuntimeError, "Trace is active!");
127
+
121
128
  Trace *trace = get_current_trace_without_gvl();
122
129
  VALUE ruby_hash = to_ruby_hash(trace);
123
130
 
124
- free_trace(trace);
125
-
126
131
  return ruby_hash;
127
132
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StackTrace
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
data/lib/stack_trace.rb CHANGED
@@ -24,6 +24,8 @@ module StackTrace
24
24
  end
25
25
 
26
26
  def trace(&block)
27
+ return block.call if trace_point.enabled?
28
+
27
29
  start_trace # This creates the wrapper span
28
30
 
29
31
  trace_point.enable do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stack_trace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehmet Emin INAC
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-05 00:00:00.000000000 Z
11
+ date: 2023-04-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: StackTrace
14
14
  email: