diff options
Diffstat (limited to 'src/uscxml/debug/DebuggerServlet.h')
-rw-r--r-- | src/uscxml/debug/DebuggerServlet.h | 69 |
1 files changed, 47 insertions, 22 deletions
diff --git a/src/uscxml/debug/DebuggerServlet.h b/src/uscxml/debug/DebuggerServlet.h index 5cd0be9..ae5178f 100644 --- a/src/uscxml/debug/DebuggerServlet.h +++ b/src/uscxml/debug/DebuggerServlet.h @@ -22,6 +22,7 @@ #include "uscxml/Common.h" #include "getopt.h" +#include <glog/logging.h> #include "uscxml/server/HTTPServer.h" #include "uscxml/Interpreter.h" @@ -31,8 +32,25 @@ namespace uscxml { -class USCXML_API DebuggerServlet : public Debugger, public HTTPServlet { +class USCXML_API DebuggerServlet : public Debugger, public HTTPServlet, public google::LogSink { public: + class LogMessage : public Data { + public: + LogMessage(google::LogSeverity severity, const char* full_filename, + const char* base_filename, int line, + const struct ::tm* tm_time, + std::string message, std::string formatted) { + + compound["severity"] = severity; + compound["fullFilename"] = Data(full_filename, Data::VERBATIM); + compound["baseFilename"] = Data(base_filename, Data::VERBATIM); + compound["line"] = line; + compound["message"] = Data(message, Data::VERBATIM); + compound["time"] = Data(mktime((struct ::tm*)tm_time), Data::INTERPRETED); + compound["formatted"] = Data(formatted, Data::VERBATIM); + } + }; + virtual ~DebuggerServlet() {} // from Debugger @@ -46,36 +64,43 @@ public: _url = url; } - void pushData(Data pushData); + void pushData(boost::shared_ptr<DebugSession> session, Data pushData); void returnData(const HTTPServer::Request& request, Data replyData); - void hitBreakpoint(const Interpreter& interpreter, - Data data); - - void processDebugEval(const HTTPServer::Request& request); - void processDebugPrepare(const HTTPServer::Request& request); - void processDebugStart(const HTTPServer::Request& request); - void processDebugStop(const HTTPServer::Request& request); - void processDebugStep(const HTTPServer::Request& request); - void processDebugResume(const HTTPServer::Request& request); - void processDebugPause(const HTTPServer::Request& request); + void processDisconnect(const HTTPServer::Request& request); void processConnect(const HTTPServer::Request& request); void processListSessions(const HTTPServer::Request& request); - void processDisconnect(const HTTPServer::Request& request); - void processAddBreakPoint(const HTTPServer::Request& request); - void processRemoveBreakPoint(const HTTPServer::Request& request); - void processPoll(const HTTPServer::Request& request); + +// void processDebugPrepare(const HTTPServer::Request& request); +// void processDebugAttach(const HTTPServer::Request& request); +// void processDebugStart(const HTTPServer::Request& request); +// void processDebugStop(const HTTPServer::Request& request); + +// void processDebugEval(const HTTPServer::Request& request); +// void processDebugStart(const HTTPServer::Request& request); +// void processDebugStop(const HTTPServer::Request& request); +// void processDebugStep(const HTTPServer::Request& request); +// void processDebugResume(const HTTPServer::Request& request); +// void processDebugPause(const HTTPServer::Request& request); +// void processAddBreakPoint(const HTTPServer::Request& request); +// void processRemoveBreakPoint(const HTTPServer::Request& request); +// void processPoll(const HTTPServer::Request& request); + // Logsink + virtual void send(google::LogSeverity severity, const char* full_filename, + const char* base_filename, int line, + const struct ::tm* tm_time, + const char* message, size_t message_len); + protected: - void serverPushData(); + void serverPushData(boost::shared_ptr<DebugSession>); - Interpreter _interpreter; - std::string _sessionId; std::string _url; - HTTPServer::Request _clientConn; - tthread::condition_variable _resumeCond; + std::map<boost::shared_ptr<DebugSession>, HTTPServer::Request> _clientConns; + std::map<boost::shared_ptr<DebugSession>, concurrency::BlockingQueue<Data> > _sendQueues; + std::map<std::string, boost::shared_ptr<DebugSession> > _sessionForId; + tthread::recursive_mutex _mutex; - concurrency::BlockingQueue<Data> _sendQueue; }; } |