ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "hurricup (Alexandr Evstigneev)" <noreply@ruby-lang.org>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:109861] [Ruby master Bug#19003] TracePoint behavior inconsistency in 3.2.0-preview2
Date: Fri, 09 Sep 2022 09:17:45 +0000 (UTC)	[thread overview]
Message-ID: <redmine.issue-19003.20220909091744.44574@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-19003.20220909091744.44574@ruby-lang.org

Issue #19003 has been reported by hurricup (Alexandr Evstigneev).

----------------------------------------
Bug #19003: TracePoint behavior inconsistency in 3.2.0-preview2
https://bugs.ruby-lang.org/issues/19003

* Author: hurricup (Alexandr Evstigneev)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.2.0preview2 (2022-09-09 master 35cfc9a3bb) [x86_64-linux]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
This is kind of continuation of my previous report about global/local TP processing (#18730).

Sample script:
```
def foo
  return 1
end

puts RubyVM::InstructionSequence.of(method :foo).disasm

def step_over
  TracePoint.new(:line, :return, :b_return) do |tp|
    puts "Step over hits by #{tp.event} at #{tp.lineno}"
    step_over
    tp.disable
  end.enable(target: RubyVM::InstructionSequence.of(method :foo), target_thread: Thread.current)
end

TracePoint.new(:line, :return, :b_return) do |tp|
  if tp.lineno == 2
    puts "Step into hits by #{tp.event} at #{tp.lineno}"
    step_over
    tp.disable
  end
end.enable(target_thread: Thread.current)

a = foo
```

In ruby 3.1.2 we have expected behavior. Output:
```
== disasm: #<ISeq:foo@/home/hurricup/Projects/ruby-debugger/jb-debase-30/test_sample.rb:1 (1,0)-(3,3)> (catch: FALSE)
0000 putobject_INT2FIX_1_                                             (   2)[LiCa]
0001 leave                                                            (   3)[Re]
Step into hits by line at 2
Step over hits by return at 3
```

In ruby 3.2.0-preview2 - not so much. Output:
```
== disasm: #<ISeq:foo@/home/hurricup/Projects/ruby-debugger/jb-debase-30/test_sample.rb:1 (1,0)-(3,3)> (catch: false)
0000 putobject_INT2FIX_1_                                             (   2)[LiCa]
0001 leave                                                            (   3)[Re]
Step into hits by line at 2
Step over hits by line at 2
Step over hits by return at 3
```



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

       reply	other threads:[~2022-09-09  9:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09  9:17 hurricup (Alexandr Evstigneev) [this message]
2022-09-16 17:58 ` [ruby-core:109921] [Ruby master Bug#19003] TracePoint behavior inconsistency in 3.2.0-preview2 jeremyevans0 (Jeremy Evans)
2022-09-17  5:06 ` [ruby-core:109934] " hurricup (Alexandr Evstigneev)
2022-11-29  6:11 ` [ruby-core:111047] " hurricup (Alexandr Evstigneev)
2022-12-01  8:08 ` [ruby-core:111115] " ko1 (Koichi Sasada)

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-19003.20220909091744.44574@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).