API to get stack frame info from generator
bjouhier at gmail.com
Sat Jun 22 14:25:34 PDT 2013
A few words for the API: I introduced two calls because I wanted to have
minimal overhead to capture the stack. So I'm only capturing the
continuation value (an integer). I'm using the other call (GetStackFrame)
to format the stack trace. The disadvantage of this approach is that I have
to keep a handle on the stack of generators in the error object. So the
generators won't be garbage collected until the error object goes away.
An alternative would be to capture the stack frame directly with
GetStackFrame(gen). The capture operation would be a little heavier but
this would lead to a simpler API.
I let you sort this out because I'm not familiar with the best practices in
2013/6/22 Erik Arvidsson <erik.arvidsson at gmail.com>
> Bruno, looks very useful. We should make sure that whatever stack API
> we propose also allows you to get the stack frame for generator.
> On Sat, Jun 22, 2013 at 11:29 AM, Brendan Eich <brendan at mozilla.com>
> > Bruno: cool, maybe we can build on this in SpiderMonkey too. Cc'ing Jason
> > and Dave.
> > Cc'ing Arv in case he is reading es-discuss only sporadically.
> > /be
> > Mark S. Miller wrote:
> >> Excellent. This looks like the right kind of low level enabler. Thanks!
> >> On Sat, Jun 22, 2013 at 3:01 AM, Bruno Jouhier <bjouhier at gmail.com
> >> <mailto:bjouhier at gmail.com>> wrote:
> >> For info, I've created a small node.js add-on that exposes a
> >> getStackFrame(generator) function:
> >> https://github.com/bjouhier/galaxy-stack.
> >> With this I could implement long stacktrace in my "galaxy" module;
> >> Temporary hack but it's there for experiments until the API gets
> >> sorted out.
> >> --
> >> Cheers,
> >> --MarkM
> >> _______________________________________________
> >> es-discuss mailing list
> >> es-discuss at mozilla.org
> >> https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss