From: os97673@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:70514] [Ruby trunk - Feature #11348] TracePoint API needs events for fiber's switching
Date: Fri, 21 Aug 2015 12:42:20 +0000 [thread overview]
Message-ID: <redmine.journal-53916.20150821124219.8bc93eb07ad13e5d@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-11348.20150713140158@ruby-lang.org
Issue #11348 has been updated by Oleg Sukhodolsky.
Koichi Sasada wrote:
> I agree to add 'switching' events so I try to commit it.
>
> Could you try it and could you tell me "what" is not enough?
I'm on vacation right now will play with ruby-head early next week.
----------------------------------------
Feature #11348: TracePoint API needs events for fiber's switching
https://bugs.ruby-lang.org/issues/11348#change-53916
* Author: Oleg Sukhodolsky
* Status: Feedback
* Priority: Normal
* Assignee: Koichi Sasada
----------------------------------------
as discussed in https://github.com/deivid-rodriguez/byebug/issues/153 current implementation of byebug/debase has problem with stepping when Enumarator/Fiber is used. The problem is that Fiber completely replaces stack (w/o any events) while the gems assume that any stack modification has corresponding call/return event.
It would be nice to receive events for Fiber's switching (at least) to be able to track stack for every fiber independently.
Also I think it would be nice to discuss the API before adding it because different set of event will allow to implement different debugger's capabilities.
E.g. plain :fiber-changed (event about every fiber switch) will only allow us to handle every fiber independently (like threads are handled) while debugger's user may expect that step into on enumerator.next will step into enumerator's code and step out from that code should go to the place where enumerator.next has been called.
So, perhaps we should have different events for Fiber#resume and Fiber#yield, but I'm not sure and would like to here other opinions.
Here are two tests which can be used to play with (one for Enumerator, another for Fiber)
~~~ruby
triangular_numbers = Enumerator.new do |yielder|
number = 0
count = 1
loop do
number += count
count += 1
yielder.yield number
end
end
print triangular_numbers.next, " "
5.times do
print triangular_numbers.next, " "
end
~~~
~~~ruby
fiber = Fiber.new do
number = 0
count = 1
loop do
number += count
count += 1
Fiber.yield number
end
end
print fiber.resume, " "
5.times do
print fiber.resume, " "
end
~~~
--
https://bugs.ruby-lang.org/
next prev parent reply other threads:[~2015-08-21 12:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-11348.20150713140158@ruby-lang.org>
2015-07-13 14:02 ` [ruby-core:69955] [Ruby trunk - Feature #11348] [Open] TracePoint API needs events for fiber's switching os97673
2015-08-10 1:39 ` [ruby-core:70289] [Ruby trunk - Feature #11348] [Assigned] " nagachika00
2015-08-21 9:56 ` [ruby-core:70506] [Ruby trunk - Feature #11348] [Feedback] " ko1
2015-08-21 12:42 ` os97673 [this message]
2015-08-25 13:08 ` [ruby-core:70591] [Ruby trunk - Feature #11348] " os97673
2015-09-01 8:57 ` [ruby-core:70642] " ko1
2015-09-01 9:12 ` [ruby-core:70645] " os97673
2015-09-01 9:53 ` [ruby-core:70648] " SASADA Koichi
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.journal-53916.20150821124219.8bc93eb07ad13e5d@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).