NuSphere Forums Forum Index
NuSphere Forums
Reply to topic

Did you know OutputDebugString() existed?
Yes
0%
 0%  [ 0 ]
No
100%
 100%  [ 7 ]
Total Votes : 7

Better docs for DebugBreak / DBGSESSID / OutputDebugString


Joined: 23 Oct 2012
Posts: 1
Reply with quote
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)
Code:
/**
 * 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):
Code:
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:
Code:
if (function_exists('OutputDebugString')) { OutputDebugString('hello'); }
View user's profileFind all posts by claarSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
thx, we'll update info about these functions in the next build.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Better docs for DebugBreak / DBGSESSID / OutputDebugString
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic