main icon indicating copy to clipboard operation
main copied to clipboard

Improvements for SetTrace

Open ironpythonbot opened this issue 11 years ago • 2 comments

Hi,

For debugging via SetTrace, it would be good to have a way to find the ScriptSource instance of the current code. Via TraceBackFrame, one can go to f_code.co_name which gives the source file path. However, that only works for ScriptSources which come from files. For ScriptSources passed by the host applications, or loaded via the PlatformAdaptionLayer, one can workaround this limit by using specially crafted path names - this catches import and execfile(). But code executed via eval or exec cannot be caught this way, so no line-by-line debugging is possible.

Thanks,
Markus

Work Item Details

Original CodePlex Issue: Issue 30103 Status: Proposed Reason Closed: Unassigned Assigned to: Unassigned Reported on: Feb 4, 2011 at 8:02 AM Reported by: MarkusSchaber Updated on: Jan 27 at 9:02 AM Updated by: nizarazou

ironpythonbot avatar Dec 09 '14 17:12 ironpythonbot

@markusschaber Is this still an issue?

slide avatar Oct 19 '16 10:10 slide

Yes. Low priority, I'd say, but we still use some workarounds like writing source to temporary files to allow debugging of scripts which are in-memory (or read from some other storage, like some database).

I'm not sure if and which solution cPython provides for this, but in hosted environments, when source is not always a plain .py file, it makes debugging more difficult.

markusschaber avatar Oct 19 '16 10:10 markusschaber