Vladimir Marangozov wrote: > > Chris, could you please repeat that step by step in more detail? > I'm not sure I understand your suggestions. I think I was too quick. I thought of copying the whole code object, of course. ... > > I'd rather keep the original code object as it is, create a copy > > with inserted breakpoints and put that into the frame slot. > > You seem to suggest to duplicate the entire code object, right? > And reference the modified duplicata from the current frame? Yes. > I actually duplicate only the opcode string (that is, the co_code string > object) and I don't see the point of duplicating the entire code object. > > Keeping a reference from the current frame makes sense, but won't it > deallocate the modified version on every frame release (then redo all the > code duplication work for every frame) ? You get two options by that. 1) permanently modifying one code object to be traceable is pushing a copy of the original "behind" by means of some co_back pointer. This keeps the patched one where the original was, and makes a global debugging version. 2) Creating a copy for one frame, and putting the original in to an co_back pointer. This gives debugging just for this one frame. ... > > Then I'd redirect the code from the CALL_TRACE opcode completely > > to a user-defined function. > > What user-defined function? I don't understand that either... > Except the sys_tracefunc, what other (user-defined) function do we have here? > Is it a Python or a C function? I would suggest a Python function, of course. > > Getting rid of the extra code object would be done by this function > > when tracing is off. > > How exactly? This seems to be obvious for you, but obviously, not for me ;-) If the permanent tracing "1)" is used, just restore the code object's contents from the original in co_back, and drop co_back. In the "2)" version, just pull the co_back into the frame's code pointer and loose the reference to the copy. Occours automatically on frame release. > > It also vanishes automatically when the frame is released. > > The function or the extra code object? The extra code object. ... > I'm confused. I didn't understand your idea. Forget it, it isn't more than another brain fart :-) ciao - chris -- Christian Tismer :^) <mailto:tismer@appliedbiometrics.com> Applied Biometrics GmbH : Have a break! Take a ride on Python's Kaiserin-Augusta-Allee 101 : *Starship* http://starship.python.net 10553 Berlin : PGP key -> http://wwwkeys.pgp.net PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF we're tired of banana software - shipped green, ripens at home
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4