File: DebuggingServer.h

package info (click to toggle)
0ad 0.0.17-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 51,248 kB
  • ctags: 46,933
  • sloc: cpp: 223,208; ansic: 31,240; python: 16,343; perl: 4,083; sh: 1,011; makefile: 915; xml: 733; java: 621; ruby: 229; erlang: 53; sql: 40
file content (153 lines) | stat: -rw-r--r-- 6,633 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/* Copyright (C) 2013 Wildfire Games.
 * This file is part of 0 A.D.
 *
 * 0 A.D. is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * 0 A.D. is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
 */

// JS debugger temporarily disabled during the SpiderMonkey upgrade (check trac ticket #2348 for details)

//#ifndef INCLUDED_DEBUGGINGSERVER
//#define INCLUDED_DEBUGGINGSERVER
//
//#include "third_party/mongoose/mongoose.h"
//#include "ScriptInterface.h"
//
//#include "lib/external_libraries/libsdl.h"
//
//class CBreakPoint;
//class CThreadDebugger;
//
//enum DBGCMD { DBG_CMD_NONE=0, DBG_CMD_CONTINUE, DBG_CMD_SINGLESTEP, DBG_CMD_STEPINTO, DBG_CMD_STEPOUT };
//enum STACK_INFO { STACK_INFO_LOCALS=0, STACK_INFO_THIS, STACK_INFO_GLOBALOBJECT };
//
//class CDebuggingServer
//{
//public:
//	CDebuggingServer();
//	~CDebuggingServer();
//	
//	/** @brief Register a new ScriptInerface for debugging the scripts it executes
//	 *
//	 * @param name A name for the ScriptInterface (will be sent to the debugging client an probably displayed to the user)
//	 * @param pScriptInterface A pointer to the ScriptInterface. This pointer must stay valid until UnRegisterScriptInterface ist called!
//	 */
//	void RegisterScriptinterface(std::string name, ScriptInterface* pScriptInterface);
//	
//	/** @brief Unregister a ScriptInerface that was previously registered using RegisterScriptinterface. 
//	 *
//	 * @param pScriptInterface A pointer to the ScriptInterface
//	 */
//	void UnRegisterScriptinterface(ScriptInterface* pScriptInterface);
//
//	
//	// Mongoose callback when request comes from a client 
//	void* MgDebuggingServerCallback(mg_event event, struct mg_connection *conn, const struct mg_request_info *request_info);	
//	
//	/** @brief Aquire exclusive read and write access to the list of breakpoints.
//	 *
//	 * @param breakPoints A pointer to the list storing all breakpoints.
//	 *
//	 * @return  A number you need to pass to ReleaseBreakPointAccess().
//	 *
//	 * Make sure to call ReleaseBreakPointAccess after you don't need access any longer.
//	 * Using this function you get exclusive access and other threads won't be able to access the breakpoints until you call ReleaseBreakPointAccess!
//	 */
//	double AquireBreakPointAccess(std::list<CBreakPoint>** breakPoints);
//	
//	/** @brief See AquireBreakPointAccess(). You must not access the pointer returend by AquireBreakPointAccess() any longer after you call this function.
//	 * 	
//	 * @param breakPointsLockID The number you got when aquiring the access. It's used to make sure that this function never gets
//	 *          used by the wrong thread.        
//	 */	
//	void ReleaseBreakPointAccess(double breakPointsLockID);
//	
//	
//	/// Called from multiple Mongoose threads and multiple ScriptInterface threads
//	bool GetBreakRequestedByThread();
//	bool GetBreakRequestedByUser();
//	// Should other threads be stopped as soon as possible after a breakpoint is triggered in a thread
//	bool GetSettingSimultaneousThreadBreak();
//	// Should the debugger break on any JS-Exception? If set to false, it will only break when the exceptions text is "Breakpoint".
//	bool GetSettingBreakOnException();
//	void SetBreakRequestedByThread(bool Enabled);
//	void SetBreakRequestedByUser(bool Enabled);
//	
//private:
//	static const char* header400;
//
//	/// Webserver helper function (can be called by multiple mongooser threads)
//	bool GetWebArgs(struct mg_connection *conn, const struct mg_request_info* request_info, std::string argName, uint& arg);
//	bool GetWebArgs(struct mg_connection *conn, const struct mg_request_info* request_info, std::string argName, std::string& arg);
//	
//	/// Functions that are made available via http (can be called by multiple mongoose threads)
//	void GetThreadDebuggerStatus(std::stringstream& response);
//	void ToggleBreakPoint(std::string filename, uint line);
//	void GetAllCallstacks(std::stringstream& response);
//	void GetStackFrameData(std::stringstream& response, uint nestingLevel, uint threadDebuggerID, STACK_INFO stackInfoKind);
//	bool SetNextDbgCmd(uint threadDebuggerID, DBGCMD dbgCmd);
//	void SetSettingSimultaneousThreadBreak(bool Enabled);
//	void SetSettingBreakOnException(bool Enabled);
//	
//	/** @brief Returns a list of the full vfs paths to all files with the extension .js found in the vfs root
//	 * 
//	 *  @param response This will contain the list as JSON array.
//	 */
//	void EnumVfsJSFiles(std::stringstream& response);
//	
//	/** @brief Get the content of a .js file loaded into vfs
//	 *
//	 * @param filename A full vfs path (as returned by EnumVfsJSFiles).
//	 * @param response This will contain the contents of the requested file.
//	 */
//	void GetFile(std::string filename, std::stringstream& response);
//	
//	/// Shared between multiple mongoose threads
//	
//
//	bool m_SettingSimultaneousThreadBreak;
//	bool m_SettingBreakOnException;
//	
//	/// Shared between multiple scriptinterface threads
//	uint m_LastThreadDebuggerID;
//	
//	/// Shared between multiple scriptinerface threads and multiple mongoose threads
//	std::list<CThreadDebugger*> m_ThreadDebuggers;
//	
//	// The CThreadDebuggers will check this value and break the thread if it's true.
//	// This only works for JS code, so C++ code will not break until it executes JS-code again.
//	bool m_BreakRequestedByThread;
//	bool m_BreakRequestedByUser;
//	
//	// The breakpoint is uniquely identified using filename an line-number.
//	// Since the filename is the whole vfs path it should really be unique.
//	std::list<CBreakPoint> m_BreakPoints;
//	
//	/// Used for controlling access to m_BreakPoints
//	SDL_sem* m_BreakPointsSem;
//	double m_BreakPointsLockID;
//	
//	/// Mutexes used to ensure thread-safety. Currently we just use one Mutex (m_Mutex) and if we detect possible sources
//	/// of deadlocks, we use the second mutex for some members to avoid it.
//	CMutex m_Mutex;
//	CMutex m_Mutex1;
//	
//	/// Not important for this class' thread-safety
//	void EnableHTTP();
//	mg_context* m_MgContext;
//};
//
//extern CDebuggingServer* g_DebuggingServer;
//
//
//#endif // INCLUDED_DEBUGGINGSERVER