backtracie 1.0.0 → 1.1.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: e804bb5ef00e6d7a3f9b7a0a57468026f3f58dbc36671e28d49f3a65e0cb6ad5
4
- data.tar.gz: c1c2851579f8eab2bc9fbbdd8b6efa82636d48e141f8a7ea505b9f8e5329b7ab
3
+ metadata.gz: c21fb6f1864cd78c05807151502cbd12e3dfb8a1d5517d05389e2ac29297a69b
4
+ data.tar.gz: 126edf9c0e78607a9a6029f08e8a1ae0e4d1a02496ac56a0f67aae349f65ca05
5
5
  SHA512:
6
- metadata.gz: 2bd4613237a00b0c872ba229cb0401af1ea9d9eb9ea559f3ded3a44779c6e5e6c4599a7639abac19c1e3e8069c5dc44de8d157f32dbb3bed160d3d987c8c8458
7
- data.tar.gz: 3846369e8865a9ec7d8c2589b3d1eb3737c242479ac3df8bb9b781ae64fdb0ed3d10a9da503cae7c5a2568b879251fbe5d74e67d88ca9dbfba98ac56a591a5dd
6
+ metadata.gz: fbda4c7a47305e4896ff0d39da7f5cf997f766f55e66ea5db0c7c50b2506bb103397f01f58fb2ee3f9b0ea89a975f6d1fdf5b9db91b934cca0c66e51adf96265
7
+ data.tar.gz: af7c5c55fa5339a60a10a49f69aac02ad35b5e99a14e1de33e7988178e976f382e2c8c9260924741d218c44b030058bbf07264d5a9fd1612195752b56264d21a
@@ -582,7 +582,7 @@ static void mod_to_s_singleton(VALUE klass, strbuilder_t *strout) {
582
582
  if (singleton_of == rb_cModule || singleton_of == rb_cClass) {
583
583
  // The first case. Use the id_attached symbol to get what this is the
584
584
  // singleton_class _of_.
585
- st_lookup(RCLASS_IV_TBL(klass), id__attached__, (st_data_t *)&singleton_of);
585
+ singleton_of = rb_ivar_get(klass, id__attached__);
586
586
  }
587
587
  mod_to_s(singleton_of, strout);
588
588
  }
@@ -609,9 +609,17 @@ static void mod_to_s(VALUE klass, strbuilder_t *strout) {
609
609
 
610
610
  VALUE klass_name = rb_mod_name(klass);
611
611
  if (!RTEST(rb_mod_name(klass))) {
612
- mod_to_s_anon(klass, strout);
613
- strbuilder_append(strout, "$anonymous");
614
- return;
612
+ // If I understood it correctly, a T_ICLASS represents the inclusion of a module into
613
+ // a class. In this situation, we usually want to use the module name instead.
614
+ if (RB_TYPE_P(klass, T_ICLASS)) {
615
+ VALUE included_module = RBASIC(klass)->klass;
616
+ mod_to_s(included_module, strout);
617
+ return;
618
+ } else {
619
+ mod_to_s_anon(klass, strout);
620
+ strbuilder_append(strout, "$anonymous");
621
+ return;
622
+ }
615
623
  }
616
624
 
617
625
  // Non-anonymous module/class.
@@ -673,6 +681,9 @@ static void minimal_location_method_qualifier(const minimal_location_t *loc,
673
681
  case BACKTRACIE_METHOD_QUALIFIER_CONTENTS_CME_CLASS:
674
682
  method_target = loc->method_qualifier.cme_defined_class;
675
683
  break;
684
+ default:
685
+ strbuilder_append(strout, "FIXME_SHOULD_NEVER_HAPPEN");
686
+ return;
676
687
  }
677
688
 
678
689
  mod_to_s(method_target, strout);
@@ -20,60 +20,60 @@
20
20
 
21
21
  if %w[jruby truffleruby].include?(RUBY_ENGINE)
22
22
  raise \
23
- "\n#{'-' * 80}\nSorry! This gem is unsupported on #{RUBY_ENGINE}. Since it relies on a lot of guts of MRI Ruby, " \
23
+ "\n#{"-" * 80}\nSorry! This gem is unsupported on #{RUBY_ENGINE}. Since it relies on a lot of guts of MRI Ruby, " \
24
24
  "it's impossible to make a direct port.\n" \
25
- "Perhaps a #{RUBY_ENGINE} equivalent could be created -- help is welcome! :)\n#{'-' * 80}"
25
+ "Perhaps a #{RUBY_ENGINE} equivalent could be created -- help is welcome! :)\n#{"-" * 80}"
26
26
  end
27
27
 
28
- require 'mkmf'
28
+ require "mkmf"
29
29
 
30
30
  # This warning gets really annoying when we include the Ruby mjit header file,
31
31
  # let's omit it
32
- $CFLAGS << ' ' << '-Wno-unused-function'
32
+ $CFLAGS << " " << "-Wno-unused-function"
33
33
 
34
34
  # Really dislike the "define everything at the beginning of the function" thing, sorry!
35
- $CFLAGS << ' ' << '-Wno-declaration-after-statement'
35
+ $CFLAGS << " " << "-Wno-declaration-after-statement"
36
36
 
37
37
  # If we forget to include a Ruby header, the function call may still appear to work, but then
38
38
  # cause a segfault later. Let's ensure that never happens.
39
- $CFLAGS << ' ' << '-Werror-implicit-function-declaration'
39
+ $CFLAGS << " " << "-Werror-implicit-function-declaration"
40
40
 
41
41
  # Enable us to use """modern""" C. Note that Ruby requires GNU extensions; specifically,
42
42
  # NSIG is expected to be defined in signal.h.
43
- $CFLAGS << ' ' << '-std=gnu99' if RUBY_VERSION < '2.4'
43
+ $CFLAGS << " " << "-std=gnu99" if RUBY_VERSION < "2.4"
44
44
 
45
- $CFLAGS << ' ' << '-DPRE_RB_ISEQ_TYPE' if RUBY_VERSION < '3.2'
45
+ $CFLAGS << " " << "-DPRE_RB_ISEQ_TYPE" if RUBY_VERSION < "3.2"
46
46
 
47
- $CFLAGS << ' ' << '-DPRE_GC_MARK_MOVABLE' if RUBY_VERSION < '2.7'
47
+ $CFLAGS << " " << "-DPRE_GC_MARK_MOVABLE" if RUBY_VERSION < "2.7"
48
48
 
49
49
  # Older Rubies don't have the MJIT header, see below for details
50
- $defs << '-DPRE_MJIT_RUBY' if RUBY_VERSION < '2.6'
50
+ $defs << "-DPRE_MJIT_RUBY" if RUBY_VERSION < "2.6"
51
51
 
52
- if RUBY_VERSION < '2.5'
53
- $CFLAGS << ' ' << '-DPRE_EXECUTION_CONTEXT' # Flag that there's no execution context, we need to use threads instead
54
- $CFLAGS << ' ' << '-DPRE_LOCATION_PATHOBJ'
55
- $CFLAGS << ' ' << '-Wno-attributes' # Silence a few warnings that we can't do anything about
52
+ if RUBY_VERSION < "2.5"
53
+ $CFLAGS << " " << "-DPRE_EXECUTION_CONTEXT" # Flag that there's no execution context, we need to use threads instead
54
+ $CFLAGS << " " << "-DPRE_LOCATION_PATHOBJ"
55
+ $CFLAGS << " " << "-Wno-attributes" # Silence a few warnings that we can't do anything about
56
56
  end
57
57
 
58
- if RUBY_VERSION < '2.4'
59
- $CFLAGS << ' ' << '-DPRE_VM_ENV_RENAMES' # Flag that it's a really old Ruby, and a few constants were since renamed
58
+ if RUBY_VERSION < "2.4"
59
+ $CFLAGS << " " << "-DPRE_VM_ENV_RENAMES" # Flag that it's a really old Ruby, and a few constants were since renamed
60
60
  end
61
61
 
62
- $CFLAGS << ' ' << '-DBACKTRACIE_EXPORTS'
63
- append_cflags ['-fvisibility=hidden']
62
+ $CFLAGS << " " << "-DBACKTRACIE_EXPORTS"
63
+ append_cflags ["-fvisibility=hidden"]
64
64
  create_header
65
65
 
66
- if RUBY_VERSION < '2.6'
66
+ if RUBY_VERSION < "2.6"
67
67
  # Use the debase-ruby_core_source gem to get access to Ruby internal structures (no MJIT header -- the preferred
68
68
  # option -- is available for these older Rubies)
69
69
 
70
- require 'debase/ruby_core_source'
71
- dir_config('ruby') # allow user to pass in non-standard core include directory
70
+ require "debase/ruby_core_source"
71
+ dir_config("ruby") # allow user to pass in non-standard core include directory
72
72
  unless Debase::RubyCoreSource.create_makefile_with_core(
73
- proc { ['vm_core.h', 'method.h', 'iseq.h', 'regenc.h'].map { |it| have_header(it) }.uniq == [true] },
74
- 'backtracie_native_extension'
73
+ proc { ["vm_core.h", "method.h", "iseq.h", "regenc.h"].map { |it| have_header(it) }.uniq == [true] },
74
+ "backtracie_native_extension"
75
75
  )
76
- raise 'Error during native gem setup -- `Debase::RubyCoreSource.create_makefile_with_core` failed'
76
+ raise "Error during native gem setup -- `Debase::RubyCoreSource.create_makefile_with_core` failed"
77
77
  end
78
78
 
79
79
  else
@@ -84,14 +84,14 @@ else
84
84
  # containing the exact file, so that it can be used in a #include in the C code.
85
85
  header_contents =
86
86
  File.read($extconf_h)
87
- .sub('#endif',
88
- <<~EXTCONF_H.strip
89
- #define RUBY_MJIT_HEADER "rb_mjit_min_header-#{RUBY_VERSION}.h"
87
+ .sub("#endif",
88
+ <<~EXTCONF_H.strip
89
+ #define RUBY_MJIT_HEADER "rb_mjit_min_header-#{RUBY_VERSION}.h"
90
90
 
91
- #endif
92
- EXTCONF_H
93
- )
94
- File.open($extconf_h, 'w') { |file| file.puts(header_contents) }
91
+ #endif
92
+ EXTCONF_H
93
+ )
94
+ File.open($extconf_h, "w") { |file| file.puts(header_contents) }
95
95
 
96
- create_makefile 'backtracie_native_extension'
96
+ create_makefile "backtracie_native_extension"
97
97
  end
@@ -14,7 +14,7 @@ typedef struct {
14
14
  } strbuilder_t;
15
15
 
16
16
  void strbuilder_append(strbuilder_t *str, const char *cat);
17
- void strbuilder_appendf(strbuilder_t *str, const char *fmt, ...);
17
+ void strbuilder_appendf(strbuilder_t *str, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
18
18
  void strbuilder_append_value(strbuilder_t *str, VALUE val);
19
19
  VALUE strbuilder_to_value(strbuilder_t *str);
20
20
  void strbuilder_init(strbuilder_t *str, char *buf, size_t bufsize);
@@ -19,5 +19,5 @@
19
19
  # along with backtracie. If not, see <http://www.gnu.org/licenses/>.
20
20
 
21
21
  module Backtracie
22
- VERSION = "1.0.0"
22
+ VERSION = "1.1.0"
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backtracie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivo Anjo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-17 00:00:00.000000000 Z
11
+ date: 2023-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase-ruby_core_source
@@ -59,7 +59,7 @@ homepage: https://github.com/ivoanjo/backtracie
59
59
  licenses:
60
60
  - LGPL-3.0+
61
61
  metadata: {}
62
- post_install_message:
62
+ post_install_message:
63
63
  rdoc_options: []
64
64
  require_paths:
65
65
  - lib
@@ -75,8 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubygems_version: 3.3.7
79
- signing_key:
78
+ rubygems_version: 3.4.1
79
+ signing_key:
80
80
  specification_version: 4
81
81
  summary: Ruby gem for beautiful backtraces
82
82
  test_files: []