Movatterモバイル変換


[0]ホーム

URL:


[Python-Dev] Why do we need Traceback Objects?

Vladimir MarangozovVladimir.Marangozov@inrialpes.fr
Fri, 7 Apr 2000 00:43:16 +0200 (CEST)


Jeremy Hylton wrote:>>   >> Vladimir Marangozov wrote:>   >> This reminds me that some time ago I made an experimental patch>   >> for removing SET_LINENO. There was the problem of generating>   >> callbacks for pdb (which I think I solved somehow but I don't>   >> remember the details). I do remember that I had to look at pdb>   >> again for some reason. Is there any interest in reviving this>   >> idea?>> I think the details are important.  The only thing the SET_LINENO> opcode does is to call a trace function if one is installed.  It's> necessary to have some way to invoke the trace function when the line> number changes (or it will be relatively difficult to execute code> line-by-line in the debugger <wink>).Looking back at the discussion and the patch I ended up with at that time,I think the callback issue was solved rather elegantly. I'm not positivethat it does not have side effects, though... For an overview of theapproach and the corresponding patch, go back to:http://www.python.org/pipermail/python-dev/1999-August/002252.htmlhttp://sirac.inrialpes.fr/~marangoz/python/lineno/What happens is that in tracing mode, a copy of the original code streamis created, a new CALL_TRACE opcode is stored in it at the addressescorresponding to each source line number, then the instruction pointeris redirected to execute the modified code string. Whenever a CALL_TRACEopcode is reached, the callback is triggered. On a successful return, the original opcode at the current address is fetched from the originalcode string, then directly goto the dispatch code.This code string duplication & conditional break-point setting occursonly when a trace function is set; in the "normal case", the interpreterexecutes a code string without SET_LINENO.--        Vladimir MARANGOZOV          |Vladimir.Marangozov@inrialpes.frhttp://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252


[8]ページ先頭

©2009-2025 Movatter.jp