/* +----------------------------------------------------------------------+ | HipHop for PHP | +----------------------------------------------------------------------+ | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ */ #ifndef __HPHP_EVAL_DEBUGGER_BASE_H__ #define __HPHP_EVAL_DEBUGGER_BASE_H__ #include #include #include #include namespace HPHP { namespace Eval { /////////////////////////////////////////////////////////////////////////////// // startup options for debugger client struct DebuggerClientOptions { std::string host; int port; std::string extension; StringVec cmds; std::string sandbox; std::string user; bool apiMode; std::string configFName; DebuggerClientOptions() : port(-1), apiMode(false) {} }; /////////////////////////////////////////////////////////////////////////////// // exceptions // client side exception class DebuggerClientException : public Exception {}; class DebuggerConsoleExitException : public DebuggerClientException {}; class DebuggerProtocolException : public DebuggerClientException {}; class DebuggerServerLostException : public DebuggerClientException {}; // both client and server side exception class DebuggerException : public Exception { EXCEPTION_COMMON_IMPL(DebuggerException); }; class DebuggerClientExitException : public DebuggerException { virtual const char *what() const throw() { return "Debugger client has just quit."; } EXCEPTION_COMMON_IMPL(DebuggerClientExitException); }; class DebuggerRestartException : public DebuggerException { public: DebuggerRestartException(StringVecPtr args) : m_args(args) {} ~DebuggerRestartException() throw() {} virtual const char *what() const throw() { return "Debugger restarting program or aborting web request."; } EXCEPTION_COMMON_IMPL(DebuggerRestartException); StringVecPtr m_args; }; /////////////////////////////////////////////////////////////////////////////// // utility functions enum CodeColor { CodeColorNone, CodeColorKeyword, CodeColorComment, CodeColorString, CodeColorVariable, CodeColorHtml, CodeColorTag, CodeColorDeclaration, CodeColorConstant, CodeColorLineNo }; /** * "line", starting line number, or 0 for no line number display. * "lineFocus", the line to highlight, with gray background. * highlight_code() doesn't need