[Python-Dev] Set-next-statement in Python debuggers (original) (raw)
Michael Hudson mwh@python.net
08 Oct 2002 16:27:16 +0100
- Previous message: [Python-Dev] Set-next-statement in Python debuggers
- Next message: [Python-Dev] Set-next-statement in Python debuggers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
richie@entrian.com writes:
I was interested to see Armin's patch [617312] to "allow the C profile and trace functions to alter some fields of the current PyFrameObject".
I'm writing a Python debugger, and as Armin says, his patch "could also be used by advanced debuggers to allow the execution point to be modified by the user." A "Set-next-statement" feature is on my list of nice-to-have-but-hard-to-do jobs, and this patch could make it easy. (I know the blockstack presents a problem, but if it's insurmountable I'm happy to ignore that and to only allow skipping to lines in the same block - 90% of my use of the equivalent feature in MSVC is to skip back one line or forward one line.) There's one fly in the ointment - I'm trying to keep my debugger in pure Python, and Armin's patch only applies to C trace functions. If frame.flasti were writable by Python trace functions, pure Python debuggers (including pdb) could implement Set-Next-Statement. Here's a small script that demonstrates what I mean, and the one-line patch to frameobject.c that enables it: [...] For completeness, flineno should probably be writable as well, but I'm keeping the changes minimal for the purposes of discussion.
I'd prefer a different approach; make f_lasti a descriptor so you can do some sanity checking on the values (i.e. fits in the f_code.co_code, actually is an opcode boundary and sets f_lineno).
Is this a reasonable suggestion for 2.3, or is it giving people too much rope? A nasty consequence is that you can write Python code that causes Python to seg-fault, but you have to be doing some fairly advanced stuff for that to happen.
I would say that the power of a Set-next-statement feature in pdb and other debuggers is worth the price, but others may disagree...?
Hmm. Not sure. Given all the ways Armin's just found to make the interpreter crap out, one more doesn't seem that exciting -- but perhaps this is the wrong attitude...
Cheers, M.
-- I'm not sure that the ability to create routing diagrams similar to pretzels with mad cow disease is actually a marketable skill. -- Steve Levin -- http://home.xnet.com/~raven/Sysadmin/ASR.Quotes.html
- Previous message: [Python-Dev] Set-next-statement in Python debuggers
- Next message: [Python-Dev] Set-next-statement in Python debuggers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]