ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:107971] [Ruby master Bug#18646] Inconsistent behavior for the targeted TracePoints in ruby 2.6-2.7 and 3+
@ 2022-03-18  9:34 hurricup (Alexandr Evstigneev)
  2022-03-18 11:28 ` [ruby-core:107973] " hurricup (Alexandr Evstigneev)
  2022-03-18 13:02 ` [ruby-core:107974] " Eregon (Benoit Daloze)
  0 siblings, 2 replies; 3+ messages in thread
From: hurricup (Alexandr Evstigneev) @ 2022-03-18  9:34 UTC (permalink / raw
  To: ruby-core

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

----------------------------------------
Bug #18646: Inconsistent behavior for the targeted TracePoints in ruby 2.6-2.7 and 3+
https://bugs.ruby-lang.org/issues/18646

* Author: hurricup (Alexandr Evstigneev)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Ruby 2.6 introduced the API for targeted tracepoints.
But for some reason, before ruby 3.0, tracepoints looks exclusive per iseq. 

Consider an example:
```
def somemethod
  puts 1
  puts 2
  puts 3
end

tp1 = TracePoint.new(:line) { |tp| puts 'This is tp1'}
tp2 = TracePoint.new(:line) { |tp| puts 'This is tp2'}

method_iseq = RubyVM::InstructionSequence.of(method :somemethod)
tp1.enable(target: method_iseq, target_line: 2)
tp2.enable(target: method_iseq, target_line: 4)
somemethod

```

Ruby 2.6-2.7 prints :
```
1
2
This is tp2
3
```
And this is unexpected, because we have 2 tracepoints and expecting both to work. But actually, only last enabled does.

Ruby 3+ work as expected:
```
This is tp1
1
2
This is tp2
3
```
Would be really nice to have consistent 3+ behavior everywhere



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:107973] [Ruby master Bug#18646] Inconsistent behavior for the targeted TracePoints in ruby 2.6-2.7 and 3+
  2022-03-18  9:34 [ruby-core:107971] [Ruby master Bug#18646] Inconsistent behavior for the targeted TracePoints in ruby 2.6-2.7 and 3+ hurricup (Alexandr Evstigneev)
@ 2022-03-18 11:28 ` hurricup (Alexandr Evstigneev)
  2022-03-18 13:02 ` [ruby-core:107974] " Eregon (Benoit Daloze)
  1 sibling, 0 replies; 3+ messages in thread
From: hurricup (Alexandr Evstigneev) @ 2022-03-18 11:28 UTC (permalink / raw
  To: ruby-core

Issue #18646 has been updated by hurricup (Alexandr Evstigneev).


Looks like this was fixed in https://bugs.ruby-lang.org/issues/17302
Any plans to backport to 2.6/2.7?

----------------------------------------
Bug #18646: Inconsistent behavior for the targeted TracePoints in ruby 2.6-2.7 and 3+
https://bugs.ruby-lang.org/issues/18646#change-96920

* Author: hurricup (Alexandr Evstigneev)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Ruby 2.6 introduced the API for targeted tracepoints.
But for some reason, before ruby 3.0, tracepoints looks exclusive per iseq. 

Consider an example:
```
def somemethod
  puts 1
  puts 2
  puts 3
end

tp1 = TracePoint.new(:line) { |tp| puts 'This is tp1'}
tp2 = TracePoint.new(:line) { |tp| puts 'This is tp2'}

method_iseq = RubyVM::InstructionSequence.of(method :somemethod)
tp1.enable(target: method_iseq, target_line: 2)
tp2.enable(target: method_iseq, target_line: 4)
somemethod

```

Ruby 2.6-2.7 prints :
```
1
2
This is tp2
3
```
And this is unexpected, because we have 2 tracepoints and expecting both to work. But actually, only last enabled does.

Ruby 3+ work as expected:
```
This is tp1
1
2
This is tp2
3
```
Would be really nice to have consistent 3+ behavior everywhere



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:107974] [Ruby master Bug#18646] Inconsistent behavior for the targeted TracePoints in ruby 2.6-2.7 and 3+
  2022-03-18  9:34 [ruby-core:107971] [Ruby master Bug#18646] Inconsistent behavior for the targeted TracePoints in ruby 2.6-2.7 and 3+ hurricup (Alexandr Evstigneev)
  2022-03-18 11:28 ` [ruby-core:107973] " hurricup (Alexandr Evstigneev)
@ 2022-03-18 13:02 ` Eregon (Benoit Daloze)
  1 sibling, 0 replies; 3+ messages in thread
From: Eregon (Benoit Daloze) @ 2022-03-18 13:02 UTC (permalink / raw
  To: ruby-core

Issue #18646 has been updated by Eregon (Benoit Daloze).

Status changed from Open to Closed

I've set the backport field for https://bugs.ruby-lang.org/issues/17302.
For 2.6 it's unlikely given it's soon EOL.
In any it's up to branch maintainers.

I'll close this since everything is tracked by the backport field now.

----------------------------------------
Bug #18646: Inconsistent behavior for the targeted TracePoints in ruby 2.6-2.7 and 3+
https://bugs.ruby-lang.org/issues/18646#change-96924

* Author: hurricup (Alexandr Evstigneev)
* Status: Closed
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Ruby 2.6 introduced the API for targeted tracepoints.
But for some reason, before ruby 3.0, tracepoints looks exclusive per iseq. 

Consider an example:
```
def somemethod
  puts 1
  puts 2
  puts 3
end

tp1 = TracePoint.new(:line) { |tp| puts 'This is tp1'}
tp2 = TracePoint.new(:line) { |tp| puts 'This is tp2'}

method_iseq = RubyVM::InstructionSequence.of(method :somemethod)
tp1.enable(target: method_iseq, target_line: 2)
tp2.enable(target: method_iseq, target_line: 4)
somemethod

```

Ruby 2.6-2.7 prints :
```
1
2
This is tp2
3
```
And this is unexpected, because we have 2 tracepoints and expecting both to work. But actually, only last enabled does.

Ruby 3+ work as expected:
```
This is tp1
1
2
This is tp2
3
```
Would be really nice to have consistent 3+ behavior everywhere



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-18 13:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-18  9:34 [ruby-core:107971] [Ruby master Bug#18646] Inconsistent behavior for the targeted TracePoints in ruby 2.6-2.7 and 3+ hurricup (Alexandr Evstigneev)
2022-03-18 11:28 ` [ruby-core:107973] " hurricup (Alexandr Evstigneev)
2022-03-18 13:02 ` [ruby-core:107974] " Eregon (Benoit Daloze)

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