From: sigsys@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:69878] [Ruby trunk - Bug #11335] [Open] `ruby -r debug` catchpoint problem
Date: Sun, 05 Jul 2015 11:27:25 +0000 [thread overview]
Message-ID: <redmine.issue-11335.20150705112724.fb2613035b4455cf@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-11335.20150705112724@ruby-lang.org
Issue #11335 has been reported by Math Ieu.
----------------------------------------
Bug #11335: `ruby -r debug` catchpoint problem
https://bugs.ruby-lang.org/issues/11335
* Author: Math Ieu
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.1.6p336 (2015-04-13 revision 50298) [i386-freebsd10]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
With a `test-debug.rb` like this:
~~~
raise 'test'
~~~
And starting the debugger like this:
~~~
ruby -r debug test-debug.rb
~~~
By default, the catchpoint is `StandardError`, but it doesn't work:
~~~
test-debug.rb:1:raise 'test'
(rdb:1) catch
Catchpoint StandardError.
(rdb:1) c
test-debug.rb:1:in `<main>': test (RuntimeError)
~~~
And the debugger exits without catching the exception.
But, by setting the catchpoint to `NilClass` (or one of its ancestors), then it works:
~~~
test-debug.rb:1:raise "test"
(rdb:1) catch NilClass
Set catchpoint NilClass.
(rdb:1) c
test-debug.rb:1: `' (NilClass)
from test-debug.rb:1:in `<main>'
test-debug.rb:1:raise "test"
~~~
And the debugger does not exit and allows further debugging.
By looking at `lib/debug.rb`, it looks like that the `set_trace_func` callback it sets assumes that `$!` will be set to the exception to be raised when a `'raise'` event occurs. But it is not the case, `$!` seems to always be `nil`.
--
https://bugs.ruby-lang.org/
next parent reply other threads:[~2015-07-05 11:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-11335.20150705112724@ruby-lang.org>
2015-07-05 11:27 ` sigsys [this message]
2018-12-07 8:32 ` [ruby-core:90360] [Ruby trunk Bug#11335] `ruby -r debug` catchpoint problem oleynikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.issue-11335.20150705112724.fb2613035b4455cf@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).