Sprinkled liberally throughout this forum are cries for information on DebugBreak / DBGSESSID / OutputDebugString, usually helpfully answered by dmitri or plugnplay.
I suggest making one authoritative place for all of this information. Almost everything is already available between these two pages:
The biggest omission is OutputDebugString() is not documented anywhere. It'd be nice if these pages could be combined into a one-stop-shop for debugging info.
If anyone finds it useful, here's some "programmer's perspective" documentation; hopefully I got everything right:
PhpED's debugger module provides two debugging functions, OutputDebugString($s) and DebugBreak($DBGSESSID)
/**
* Output a debug string to PhpED's log window
*
* @param $s The string to output.
*/
function OutputDebugString($s);
/**
* Invoke a breakpoint to the current or given debugging session
*
* Examples:
* // Invoke a breakpoint at the current line
* DebugBreak();
*
* // Specify everything
* DebugBreak('1@clienthost:7869;s=0,d=1,p=0,c=1');
*
* @param $DBGSESSID A string of the form nnn[@host][:port][;{flags}]
* nnn: dbg session ID (any positive number or zero). If the session
* exists, its stored values will override the defaults given below.
* default: -1
* NOTE: negative values prohibit debug session and drop debug cookie
* host: The ip address or hostname of the debugger listener. Set to the
* keyword "clienthost" to use the value of $_SERVER['REMOTE_ADDR'].
* default: clienthost
* port: The port of the debugger listener.
* default: 7869
* flags: set of the following flags delimited with commas:
* s=n - skip n HTTP requests before the actual session should
* run, default 0
* d={0|1} - start debugger, default 1
* p={0|1} - start profiler, default 0
* c={0|1} - enable/disable debugger session, default 1
*/
function DebugBreak($DBGSESSID='-1'); |
To turn remote debugging on in web page/session, set DBGSESSID as a GET variable with d=1, c=1:
Example: example.com/?DBGSESSID=2@clienthost:7869;d=1,p=0,c=1
To turn debugging off in web page/session, set DBGSESSID as a GET variable with d=0,c=0:
Example: example.com/?DBGSESSID=2@clienthost:7869;d=0,p=0,c=0
Best practices for setting a breakpoint in remote code (useful when local breakpoints aren't working/possible):
if (function_exists('DebugBreak') &&
$_SERVER['REMOTE_ADDR'] == '192.168.1.1' /* debug listener IP */)
{
DebugBreak("1@clienthost:7869;d=1,p=0,c=1");
}
|
Send things to PhpEd's log tab:
if (function_exists('OutputDebugString')) { OutputDebugString('hello'); } |