php source level debugger.

From: Date: Mon, 20 Nov 2000 21:50:42 +0000
Subject: php source level debugger.
Groups: php.general 
Request: Send a blank email to php-general+get-26336@lists.php.net to get a copy of this message
I believe I have figured out a general way to do PHP 4 source level debugging using a web browser. The project is way beyond my time budget for the next few months. I would be willing to help to some extent. The key is the ability to eval() a string as PHP code. To make this work, the debugger code would execute the target php code one line at a time. The debugger would need to have its variables given names that would not conflict with the target variables. The target code must be syntactically correct, or the eval() would bomb. I suppose an error trap routine would be able to catch and describe the line in question so the user would be able to find out which of his lines caused the problem. Another problem would be remembering the stat of variables between each web page invocation. If we force some conditions on the writer of the target code, such as causing the names of all the target variables to be listed in an array (or we do that automatically as we come across the variables, which implies a small parser), then the state of those variables can be saved (serialized) as we get out of the executed code, and restored just before we execute a statement. Function calls are the worst problem, if we need to step into them, and step out of them again. I suspect that the function would need to be emulated. Rather than actually doing a function call, the function could be turned into a variable name (for when you have the form $result = functioncall() ) and a pseudo stack could be used to record the entry into the function call. Fortunately, function calls must be defined before using, so we would know which calls were actual user functions. Another problem is functions like array_walk(). Those would probably have to be debugged piecemeal and simply trusted to work. [My brain just hit a brick wall on that one.] Breakpoints could be set in the code by using a line counter or a SourceDebugBreak(); call that calls into the debugger. Comments or flames welcome. If this is the wrong list for this, please point me to the right one bug

« previous php.general (#26336) next »