Table of Contents
When the developer sends a http request to the Gubed StartSession script, the first thing
Gubed does is to read the original sourcecode of the script, parse it and insert call
to a debugging function called gbdGubed()
.
If the code looked like
echo "Check if we have a page"; if(isset($_REQUEST['page'])) echo $_REQUEST['page'];
it will be converted to (in memory, disk file is left untouched)
if(gbdGubed()) echo "Check if we have a page"; if(gbdGubed()) if(isset($_REQUEST['page'])) { if(gbdGubed()) echo $_REQUEST['page']; }
Second, it launches the altered script and every other statement in the script
is now a call to gbdGubed()
which returns true of false depending on wether
the line of code should be executed or not.
The gbdGubed()
function takes a few arguments, for example:
source code identifier (ie full path and filename)
current line number
currently set variables
gbdGubed()
tries to communicate with the debug client program and dies
if it fails. If the connection to the debug client is still alive, it send information
about what file and line it is executing and asks for further instructions.
The most common instruction is 'next' which tells the client to keep on
executing next instruction.
When the client receives a request from the script it updates the sourcecode view to indicate what line the script is currently at. Next, it will check if it is currently on a breakpoint, if any conditional breakpoints are true or if the developer has given any certain instructions. If there are no breakpoints and no instructions from developer, the client will tell the script either to wait for further instructions (if the developer has enabled the step mode) or keep executing (if the developer has enabled the run mode)
This will keep on until the script reaches it's end.
Throughout the whole process, the developer can give instructions to the server. Instructions include setting and clearing breakpoints, enable run or step mode, viewing variables and more.