2 --------------------------- Abort Command ---------------------------
4 [a]bort aborts current PHP code input
7 You will have to type this command on a new line, while you're typing
8 ad-hoc PHP code to evaluate. In other words, it only works when you see
9 continuation prompt like ">>>>".
12 --------------------------- Break Command ---------------------------
14 [b]reak breaks at current line of code
15 [b]reak {exp} breaks at matching location
17 [b]reak [o]nce {above} breaks just once then disables it
19 [b]reak {above} if {php} breaks if condition meets
20 [b]reak {above} && {php} breaks and evaluates an expression
22 [b]reak [l]ist lists all breakpoints
23 [b]reak [c]lear {index} clears the n-th breakpoint on list
24 [b]reak [c]lear [a]ll clears all breakpoints
25 [b]reak [c]lear clears current breakpoint
26 [b]reak [t]oggle {index} toggles the n-th breakpoint on list
27 [b]reak [t]oggle [a]ll toggles all breakpoints
28 [b]reak [t]oggle toggles current breakpoint
29 [b]reak [e]nable {index} enables the n-th breakpoint on list
30 [b]reak [e]nable [a]ll enables all breakpoints
31 [b]reak [e]nable enables current breakpoint
32 [b]reak [d]isable {index} disables the n-th breakpoint on list
33 [b]reak [d]isable [a]ll disables all breakpoints
34 [b]reak [d]isable disables current breakpoint
37 -------------------------- Where to break? --------------------------
39 There are many ways to specify a source file location to set a breakpoint,
40 but it's ONE single string without whitespaces. The format looks like this,
42 file location: {file}:{line}
43 function call: {func}()
44 method invoke: {cls}::{method}()
52 ------------------------ Special Breakpoints ------------------------
54 There are special breakpoints what can only be set by names:
60 They represent different time points of a web request. 'start' is at the
61 beginning of a web request, when no PHP file is invoked yet, but query
62 string and server variables are already prepared. 'end' is at the end of
63 a web request, but BEFORE post-send processing (psp). 'psp' is at END of
64 psp, not beginning. To set a breakpoint at the beginning of psp, use
65 'end', because end of a request is the same as beginning of psp.
67 -------------- Conditional Breakpoints and Watchpoints --------------
69 Every breakpoint can specify a condition, which is an arbitrary PHP expression
70 that will be evaluated to TRUE or FALSE. When TRUE, it will break. When FALSE,
71 it will continue without break. "&&" is similar to "if", except it will always
72 break, regardless what the expression returns. This is useful to watch
73 variables at breakpoints. For example,
75 b mypage.php:123 && print $a
77 So every time it breaks at mypage.php line 123, it will print out $a.
79 -------------------------- Call chains -------------------------------
81 Function/method call breakpoints can be qualified with the names of
82 functions or methods that must be calling the right most function/method
83 name for execution to stop at the breakpoint. These calls need not be
84 direct calls. The syntax looks like this:
86 where call is either a {func} or {cls}::{method} and zero or more
87 "{call}=>" clauses can be specified.
89 --------------------- Breakpoint States and List ---------------------
91 Every breakpoint has 3 states: ALWAYS, ONCE, DISABLED. Without keyword "once",
92 a breakpoint is in ALWAYS state. ONCE breakpoints will turn into DISABLED after
93 it's hit once. DISABLED breakpoints will not break, but they are kept in the
94 list, so one can run 'b l' command and 'b t' command to toggle their states.
96 Use '[b]reak [l]ist' command to view indices of different breakpoints. Then use
97 those indices to clear or toggle their states. This list of breakpoints and
98 their states will remain the same when switching to different machines,
99 sandboxes and threads.
101 -------------------------- Hard Breakpoints --------------------------
103 From within PHP code, you can place a function call hphpd_break() to embed a
104 breakpoint. You may also specify a condition as the function's parameter, so it
105 breaks when the condition is met. Please read about this function for more
106 details with '[i]nfo hphpd_break'.
108 -------------------------- Continue Command --------------------------
110 [c]ontinue continues program execution
114 Use this command at break to resume program execution. Specify a count
115 to repeat the same command many times.
118 ---------------------------- Down Command ----------------------------
120 [d]own {num=1} moves to inner frames (callees) on stacktrace
123 Use this command to walk down on stacktrace to find out inner callees of
124 current frame. By default it moves down by one level. Specify a number
125 to move down several levels a time.
128 ------------------------- Exception Command -------------------------
130 [e]xception {cls} breaks if class of exception throws
131 [e]xception breaks if class of exception throws
133 [e]xception error breaks on errors, warnings and notices
134 [e]xception breaks only if url also matches
137 [e]xception breaks at matching regex pattern
139 [e]xception breaks just once then disables it
142 [e]xception breaks if condition meets
144 [e]xception breaks and evaluates an expression
148 Exception command is similar to '[b]reak' command, except it's used to
149 specify how to break on (or catch) a throw of an exception. Program
150 stops right before the exception is about to throw. Resuming program
151 execution will continue to throw the exception as is.
153 Only a class name can be specified with an optional namespace. All
154 exceptions of the class or its sub-classes will be matched. To specify a
155 perfect match without sub-classing test, use '[e]xception [r]egex
156 ^{exact class name}$', although regex can match in a lot more different
159 An exception breakpoint can be listed, cleared or toggled with '[b]reak'
163 --------------------------- Frame Command ---------------------------
165 [f]rame {index} jumps to one particular frame
168 Use '[w]here' command to find out the frame number. Use 'f 0' to jump
169 back to the most recent frame or the innermost frame. Use 'f 999' or
170 some big number to jump to the outermost frame.
173 --------------------------- Global Command ---------------------------
175 [g]lobal lists all global variables
176 [g]lobal {text} full-text search global variables
179 This will print names and values of all global variables, if {text} is
180 not speified. Otherwise, it will print global variables that contain the
181 text in their names or values. The search is case-insensitive and
185 ---------------------------- Help Command ----------------------------
187 [h]elp [s]tart displays material for getting started
188 [h]elp [t]utorial changing tutorial modes
192 Please read "Getting Started" material with '[h]elp [s]tart' for first
193 time use to get yourself familiar with basics.
195 Tutorial mode displays extra information when something didn't work as
196 you expected. "auto" mode will display the same information just once.
197 "on" mode will display it as long as you run into the same situation.
198 "off" mode completely turns off all tutorial texts.
200 To get detailed information of a command, type '{cmd} [h]elp' or '{cmd}
201 ?' or 'help {cmd}' or '? {cmd}'.
204 ---------------------------- Info Command ----------------------------
206 info displays current function's info
207 info {cls} displays declaration of this class
208 info {function} displays declaration of this function
209 info displays declaration of this method
211 info displays declaration of this constant
213 info displays declaration of this property
217 Use this command to display declaration of a symbol.
220 -------------------------- Constant Command --------------------------
222 [k]onstant lists all constants
223 [k]onstant {text} full-text search constants
226 This will print names and values of all constants, if {text} is not
227 specified. Otherwise, it will print names and values of all constants
228 that contain the text in their names or values. The search is
229 case-insensitive and string-based.
232 ---------------------------- List Command ----------------------------
234 list displays current block of source code
235 list {line} displays code around specified line
236 list displays specified block of source code
238 list {line1}- displays code starting with the line
239 list -{line2} displays code ending with the line
240 list {file} displays beginning lines of the file
241 list displays code around specified file:line
243 list displays specified block in the file
245 list {file}:{l1}- displays specified block in the file
246 list {file}:-{l2} displays specified block in the file
247 list {directory} sets PHP source root directory
250 Use list command to display PHP source code. In remote debugging, this
251 is displaying source code on server side. When server side cannot find
252 the file, it will fall back to local files.
254 Hit return to display more lines of code after current display.
256 When a directory name is specified, this will be set to root directory
257 for resolving relative paths of PHP files. Files with absolute paths
258 will not be affected by this setting. This directory will be stored in
259 configuration file for future sessions as well.
262 -------------------------- Machine Command ---------------------------
264 [m]achine debugging remote server natively
266 [m]achine debugging remote server natively
269 [m]achine [r]pc debugging remote server with RPC
271 [m]achine [r]pc debugging remote server with RPC
273 [m]achine disconnect, debug only local script
275 [m]achine [l]ist list all sandboxes
276 [m]achine attach to a sandbox
278 [m]achine attach to my sandbox by name
281 [m]achine attach to a sandbox by user and name
284 [m]achine force attach to a sandbox (see below)
290 Use this command to switch between different machines or sandboxes.
292 If command prompt says "hphpd", all evaluation of PHP code happens
293 locally within the debugger. This is the mode when debugger is started
294 without a remote server name. No user libraries are pre-loaded in this
297 When connecting to a remote server, it will automatically attach to
298 "default" sandbox under current user. If "default" sandbox does not
299 exist, it will attach to a random sandbox under current user. In sandbox
300 mode, a file specified in server's configuration of
301 "Eval.Debugger.StartupDocument" is pre-loaded.
303 If there is no sandbox available, it will create a "dummy" sandbox and
306 When your sandbox is not available, please hit it at least once from
307 your browser. Then run '[m]achine [l]ist' command again.
309 If another debugger client is already attached to your sandbox you can
310 use the '[f]orce' option to '[m]achine [a]ttach'. This will disconnect
311 the other client and force your client to connect.
313 If a HipHop server has RPC port open, one can also debug the server in a
314 very special RPC mode. In this mode, one can type in PHP scripts to run,
315 but all functions will be executed on server through RPC. Because states
316 are still maintained locally and only functions are executed remotely,
317 it may not work with functions or scripts that depend on global
318 variables or low-level raw resource pointers. As a simple rule,
319 stateless functions will work just fine. This is true to objects and
320 method calls as well, except classes will have to be loaded on client
321 side by '=include("file-containing-the-class.php")'.
324 ---------------------------- Next Command ----------------------------
326 [n]ext {count=1} steps over lines of code
329 Use this command at break to step over lines of code. Specify a count to
330 step over more than one line of code.
333 ---------------------------- Out Command ----------------------------
335 [o]ut {count=1} steps out function calls
338 Use this command at break to step out function calls. Specify a count to
339 step out more than one level of function calls.
342 --------------------------- Print Command ---------------------------
344 [p]rint {php} prints result of PHP code
345 [p]rint r {php} prints result of PHP code, (print_r)
346 [p]rint v {php} prints result of PHP code, (var_dump)
347 [p]rint x {php} prints hex encoded string or number
348 [p]rint [h]ex prints hex encoded string or number
350 [p]rint [o]ct prints octal encoded string or number
352 [p]rint [d]ec prints as signed integer
354 [p]rint prints as unsigned integer
356 [p]rint [t]ime converts between time and timestamp
359 [p]rint [a]lways adds a watch expression at break
361 [p]rint [l]ist lists watch expressions
362 [p]rint [c]lear clears a watch expression
364 [p]rint [c]lear clears all watch expressions
368 Prints result of an expression in certain format. If '[a]lways' is
369 specified, the expression will be added to a watch list. At every break,
370 either at a breakpoint or caused by step commands, these expressions
371 will be evaluated and printed out.
374 ---------------------------- Quit Command ----------------------------
376 [q]uit quits this program
379 After you type this command, you will not see me anymore.
382 ---------------------------- Run Command ----------------------------
384 [r]un restarts program
385 [r]un {file} starts a new program
389 Aborts current execution and restarts program with specified arguments.
390 If no arguments are specified, it will reuse the PHP file and old
391 arguments. If arguments are to be changed, please include file name,
392 even if it is the same, as the first one.
394 In server mode, this command will simply abort current page handling
395 without restarting anything.
398 ---------------------------- Set Command ----------------------------
400 set bac on/off on makes debugger bypass access checks on class members
401 set lf path/off turn logging on and specify log file
402 set pl level if level > 0, only print out object trees to that depth
403 set cc count display at most count characters when doing = command
404 set ss on/off on makes the debugger take small steps (not entire lines)
405 set sa on/off on makes where command display argument values
406 set mcl limit display at most limit source lines at breakpoints
408 Use this command to change default settings. The new values are persisted into
409 the configuration file that normally can be found at ~/.hphpd.ini.
411 Level, count and limit can be <= 0, in which case they are unlimited.
413 ---------------------------- Step Command ----------------------------
415 [s]tep {count=1} steps into lines of code
418 Use this command at break to step into lines of code. Specify a count to
422 --------------------------- Thread Command ---------------------------
424 [t]hread displays current thread's information
425 [t]hread [l]ist lists all threads at break
426 [t]hread {index} switches to the specified thread
427 [t]hread [n]ormal breaks all threads
428 [t]hread [s]ticky only send command to current thread
429 [t]hread only break current thread
433 Use '[t]hread' alone to display information of current thread.
435 When a thread is at break, you may specify how other threads should
436 behave if they also happen to hit some breakpoints. Normally, other
437 threads will also break, and they will interrupt debugger session with
438 their breakpoints. So breaks from different threads may interleave. If
439 '[t]hread [s]ticky' is specified, all other threads will wait until
440 current thread is finished. This will help debugging to focus on just
441 one thread without losing breaks from other threads. If there is no need
442 to hold up any other threads, use '[t]hread [e]xclusive'. Then other
443 threads will not break at all. This mode is useful for live debugging a
444 production server, without interrupting many threads at a time. Use
445 '[t]hread [n]ormal' to change thread mode back to normal.
447 Some debugging commands will automatically turn thread mode to sticky.
448 These include continue, step, next or out commands with a counter of
449 more than 1. Or a jump command. These commands imply non-interruption
450 from another thread. The mode will remain even after these commands
451 until '[t]hread [n]ormal' is issued.
452 When multple threads hit breakpoints at the same time, use '[t]hread
453 [l]ist' command to display their indices, which can be used to switch
454 between them with '[t]hread {index}'.
457 ----------------------------- Up Command -----------------------------
459 [u]p {num=1} moves to outer frames (callers) on stacktrace
462 Use this command to walk up on stacktrace to find out outer callers of
463 current frame. By default it moves up by one level. Specify a number to
464 move up several levels a time.
467 -------------------------- Variable Command --------------------------
469 [v]ariable lists all local variables on stack
470 [v]ariable {text} full-text search local variables
473 This will print names and values of all variables that are currently
474 accessible by simple names. Use '[w]here', '[u]p {num}', '[d]own {num}',
475 '[f]rame {index}' commands to choose a different frame to view variables
476 at different level of the stack.
478 Specify some free text to print local variables that contain the text
479 either in their names or values. The search is case-insensitive and
483 --------------------------- Where Command ---------------------------
485 [w]here displays current stacktrace
486 [w]here {num} displays number of innermost frames
487 [w]here -{num} displays number of outermost frames
490 Use '[u]p {num}' or '[d]own {num}' to walk up or down the stacktrace.
491 Use '[f]rame {index}' to jump to one particular frame. At any frame, use
492 '[v]ariable' command to display all local variables.
495 -------------------------- Extended Command --------------------------
497 x {cmd} {arg1} invoke specified command
499 x{cmd} {arg1} invoke specified command
508 Type 'x [h]elp|? {cmd} to read their usages.
510 ---------------------------- Zend Command ----------------------------
512 [z]end running the most recent code snippet in Zend PHP
515 This is mainly for comparing results from PHP vs. HipHop. After you type
516 in some PHP code, it will be evaluated immediately in HipHop. Then you
517 can type '[z]end' command to re-run the same script in Zend PHP. Please
518 note that only the most recent block of code you manually typed in was
519 evaluated, not any earlier ones, nor the ones from a PHP file.
522 --------------------------- Macro Command ---------------------------
524 & [s]tart starts recording of default macro
525 & [s]tart {name} starts recording of a named macro
526 & [e]nd stops and saves recorded macro
527 & [r]eplay replays default macro
528 & [r]eplay {name} replays a named macro
529 & [l]ist lists all macros
530 & [c]lear {index} deletes a macro
533 Macro command allows you to record a series of debugger command, so you
534 can replay later by its name. When name is not specified, it will use
535 "default" as the name.
537 There is also a special macro "startup" that will be replayed every time
538 when debugger is just started. Use startup macro to load certain PHP
539 files or perform certain debugging environment setup.
541 The space between & and command is not needed. '&s' works as well.
544 --------------------------- Shell Command ---------------------------
546 ! {cmd} {arg1} {arg2} ... remotely executes shell command
548 Executes the shell command on connected machine.
550 The space between ! and command is not needed. '!ls' works as well.