[IronPython] Accessing call stack
dinov at exchange.microsoft.com
Thu Sep 20 18:01:00 CEST 2007
Unfortunately there's no good way to do this. We have logic in PythonEngine to filter stack frames but it's only exposed for doing this on exceptions, not on arbitrary stack traces. And unfortunately v2.0 is in about the same shape - all of its support revolves around exceptions too and it's filtering is probably even less useful than v1.x's for these purposes.
I've opened up a feature request to add this because it does seem like something that will be fundamentally needed (especially as more languages run on the DLR) and it's pretty basic functionality. The bug tracking it is here: http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=12876
Unfortunately it may not be entirely simple because DynamicMethod's have no debugging info (and that's what much of the code gets generated as) but we should be able to do something here.
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Anders M. Mikkelsen
Sent: Thursday, September 20, 2007 3:54 AM
To: Discussion of IronPython
Subject: [IronPython] Accessing call stack
Is there any way of accessing the python call stack in IronPython.
I'we tried using System.Diagnostics.StackTrace but most calls
on the clr call stack seem to be ironpython 'internals':
'''General logging function'''
print "%s: %s" % (StackTrace(1).GetFrame(0).GetMethod().Name, msg)
I could search the stack trace for actual python functions (I guess) as
their clr name seem to end in $fN; but I'm guessing that there must be
an easier way?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users