Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include the method owner in backtraces #9605

Merged
merged 3 commits into from Feb 15, 2024

Conversation

mame
Copy link
Member

@mame mame commented Jan 19, 2024

$ cat test.rb
def toplevel = raise

class Foo
  def self.class_meth = toplevel

  def instance_meth = Foo.class_meth
end

obj = Foo.new

def obj.singleton_meth = instance_meth

obj.singleton_meth

$ ./miniruby test.rb
test.rb:1:in `Object#toplevel': unhandled exception
        from test.rb:4:in `Foo.class_meth'
        from test.rb:6:in `Foo#instance_meth'
        from test.rb:11:in `singleton_meth'
        from test.rb:13:in `<main>'

https://bugs.ruby-lang.org/issues/19117

@mame mame force-pushed the method-owner-in-backtrace branch 4 times, most recently from 738f7fe to 578bee3 Compare January 19, 2024 08:45
@ko1 ko1 added the Playground Experimental: Post link to try Ruby with PR changes label Feb 14, 2024
Copy link

github-actions bot commented Feb 14, 2024

Try on Playground: https://ruby.github.io/play-ruby?run=7913922561
This is an automated comment by pr-playground.yml workflow.

@mame mame force-pushed the method-owner-in-backtrace branch 3 times, most recently from 00149f7 to 5db8acb Compare February 15, 2024 09:14
Instead of having iseq and cfunc separately, this change lets
Thread::Backtrace::Location have them together as
rb_callable_method_entry_t.

This is a refactoring, but also a preparation for implementing
[Feature #19117].
```
test.rb:1:in 'Object#toplevel_meth': unhandled exception
        from test.rb:4:in 'Foo.class_meth'
        from test.rb:6:in 'Foo#instance_meth'
        from test.rb:11:in 'singleton_meth'
        from test.rb:13:in '<main>'
```

[Feature #19117]
@mame mame marked this pull request as ready for review February 15, 2024 09:43
@mame mame enabled auto-merge (rebase) February 15, 2024 09:43
@mame mame merged commit 8f2c231 into ruby:master Feb 15, 2024
102 checks passed
@mame mame deleted the method-owner-in-backtrace branch February 15, 2024 10:26
st0012 added a commit to ruby/irb that referenced this pull request Feb 15, 2024
ruby/ruby#9605 changes the start quote from
"`" to "'", which causes the tests to fail. This commit relaxes the
assertions to allow for both types of quotes.
st0012 added a commit to ruby/irb that referenced this pull request Feb 15, 2024
ruby/ruby#9605 changes both quotes and format for
exception messages. So we need to update the assertions in the tests.
tompng pushed a commit to ruby/irb that referenced this pull request Feb 15, 2024
ruby/ruby#9605 changes both quotes and format for
exception messages. So we need to update the assertions in the tests.
st0012 added a commit to ruby/irb that referenced this pull request Feb 16, 2024
With ruby/ruby#9605, backtrace in Ruby head
now has a new format. This commit updates the check for binding.irb
to work with Ruby head.
st0012 added a commit to ruby/irb that referenced this pull request Feb 16, 2024
* Update binding.irb check for Ruby head

With ruby/ruby#9605, backtrace in Ruby head
now has a new format. This commit updates the check for binding.irb
to work with Ruby head.

* Do not include a backtick in error messages and backtraces

[Feature #16495]

---------

Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
matzbot pushed a commit that referenced this pull request Feb 19, 2024
(ruby/irb#874)

#9605 changes both quotes and format for
exception messages. So we need to update the assertions in the tests.

ruby/irb@9359d4b51d
matzbot pushed a commit that referenced this pull request Feb 19, 2024
(ruby/irb#876)

* Update binding.irb check for Ruby head

With #9605, backtrace in Ruby head
now has a new format. This commit updates the check for binding.irb
to work with Ruby head.

* Do not include a backtick in error messages and backtraces

[Feature #16495]

---------

ruby/irb@ebffd3d976

Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
kachick added a commit to kachick/ruby-ulid that referenced this pull request Feb 19, 2024
kachick added a commit to kachick/ruby-ulid that referenced this pull request Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Playground Experimental: Post link to try Ruby with PR changes
2 participants