diff --git a/source/scriptinterface/DebuggingServer.h b/source/scriptinterface/DebuggingServer.h index a62c331dc0..b5ccb14759 100644 --- a/source/scriptinterface/DebuggingServer.h +++ b/source/scriptinterface/DebuggingServer.h @@ -15,137 +15,139 @@ * along with 0 A.D. If not, see . */ -#ifndef INCLUDED_DEBUGGINGSERVER -#define INCLUDED_DEBUGGINGSERVER +// JS debugger temporarily disabled during the SpiderMonkey upgrade (check trac ticket #2348 for details) -#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** 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 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 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 +//#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** 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 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 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 diff --git a/source/scriptinterface/ScriptInterface.cpp b/source/scriptinterface/ScriptInterface.cpp index f694d8bd4a..924092b5ac 100644 --- a/source/scriptinterface/ScriptInterface.cpp +++ b/source/scriptinterface/ScriptInterface.cpp @@ -18,7 +18,7 @@ #include "precompiled.h" #include "ScriptInterface.h" -#include "DebuggingServer.h" +// #include "DebuggingServer.h" // JS debugger temporarily disabled during the SpiderMonkey upgrade (check trac ticket #2348 for details) #include "ScriptStats.h" #include "AutoRooters.h" diff --git a/source/scriptinterface/ThreadDebugger.h b/source/scriptinterface/ThreadDebugger.h index ac148e7c53..7e8a2dc798 100644 --- a/source/scriptinterface/ThreadDebugger.h +++ b/source/scriptinterface/ThreadDebugger.h @@ -15,169 +15,171 @@ * along with 0 A.D. If not, see . */ -#ifndef INCLUDED_THREADDEBUGGER -#define INCLUDED_THREADDEBUGGER + // JS debugger temporarily disabled during the SpiderMonkey upgrade (check trac ticket #2348 for details) -#include "DebuggingServer.h" -#include "ScriptInterface.h" -#include "scriptinterface/ScriptExtraHeaders.h" - -// These Breakpoint classes are not implemented threadsafe. The class using the Breakpoints is responsible to make sure that -// only one thread accesses the Breakpoint at a time -class CBreakPoint -{ -public: - CBreakPoint() : m_UserLine(0) { } - - uint m_UserLine; - std::string m_Filename; -}; - -// Only use this with one ScriptInterface/CThreadDebugger! -class CActiveBreakPoint : public CBreakPoint -{ -public: - CActiveBreakPoint() - : m_ActualLine(m_UserLine) - , m_Script(NULL) - , m_Pc(NULL) - , m_ToRemove(false) - { } - - CActiveBreakPoint(CBreakPoint breakPoint) - : CBreakPoint(breakPoint) // using default copy constructor - , m_ActualLine(m_UserLine) - , m_Script(NULL) - , m_Pc(NULL) - , m_ToRemove(false) - { } - - uint m_ActualLine; - JSScript* m_Script; - jsbytecode* m_Pc; - bool m_ToRemove; -}; - -enum BREAK_SRC { BREAK_SRC_TRAP, BREAK_SRC_INTERRUP, BREAK_SRC_EXCEPTION }; - -struct ThreadDebugger_impl; - -class CThreadDebugger -{ -public: - CThreadDebugger(); - ~CThreadDebugger(); - - /** @brief Initialize the object (required before using the object!). - * - * @param id A unique identifier greater than 0 for the object inside its CDebuggingServer object. - * @param name A name that will be can be displayed by the UI to identify the thread. - * @param pScriptInterface Pointer to a scriptinterface. All Hooks, breakpoint traps etc. will be registered in this - * scriptinterface and will be called by the thread this scriptinterface is running in. - * @param pDebuggingServer Pointer to the DebuggingServer object this Object should belong to. - * - * @return Return value. - */ - void Initialize(uint id, std::string name, ScriptInterface* pScriptInterface, CDebuggingServer* pDebuggingServer); - - - // A bunch of hooks used to get information from spidermonkey. - // These hooks are used internally only but have to be public because they need to be accessible from the global hook functions. - // Spidermonkey requires function pointers as hooks, which only works if the functions are global or static (not part of an object). - // These global functions in ThreadDebugger.cpp are just wrappers for the following member functions. - - /** Simply calls BreakHandler with BREAK_SRC_TRAP */ - JSTrapStatus TrapHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, jsval closure); - /** Hook to capture exceptions and breakpoints in code (throw "Breakpoint";) */ - JSTrapStatus ThrowHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval); - /** All other hooks call this one if the execution should be paused. It puts the program in a wait-loop and - * waits for weak-up events (continue, step etc.). */ - JSTrapStatus BreakHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, jsval closure, BREAK_SRC breakSrc); - JSTrapStatus StepHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure); - JSTrapStatus StepIntoHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure); - JSTrapStatus StepOutHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure); - /** This is an interrup-hook that can be called multiple times per line of code and is used to break into the execution - * without previously setting a breakpoint and to break other threads when one thread triggers a breakpoint */ - JSTrapStatus CheckForBreakRequestHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure); - /** The callback function which gets executed for each new script that gets loaded and each function inside a script. - * We use it for "Execute-Hooks" and "Call-Hooks" in terms of Spidermonkey. - * This hook actually sets the traps (Breakpoints) "on the fly" that have been defined by the user previously. - */ - void ExecuteHook(JSContext *cx, const char *filename, unsigned lineno, JSScript *script, JSFunction *fun, void *callerdata); - /** This hook is used to update the mapping between filename plus line-numbers and jsbytecode pointers */ - void NewScriptHook(JSContext *cx, const char *filename, unsigned lineno, JSScript *script, JSFunction *fun, void *callerdata); - /** This hook makes sure that invalid mappings between filename plus line-number and jsbytecode points get deleted */ - void DestroyScriptHook(JSContext *cx, JSScript *script); - - - void ClearTrap(CActiveBreakPoint* activeBreakPoint); - - /** @brief Checks if a mapping for the specified filename and line number exists in this CThreadDebugger's context - */ - bool CheckIfMappingPresent(std::string filename, uint line); - - /** @brief Checks if a mapping exists for each breakpoint in the list of breakpoints that aren't set yet. - * If there is a mapping, it removes the breakpoint from the list of unset breakpoints (from CDebuggingServer), - * adds it to the list of active breakpoints (CThreadDebugger) and sets a trap. - * Threading: m_Mutex is locked in this call - */ - void SetAllNewTraps(); - - /** @brief Sets a new trap and stores the information in the CActiveBreakPoint pointer - * Make sure that a mapping exists before calling this function - * Threading: Locking m_Mutex is required by the callee - */ - void SetNewTrap(CActiveBreakPoint* activeBreakPoint, std::string filename, uint line); - - /** @brief Toggle a breakpoint if it's active in this threadDebugger object. - * Threading: Locking m_Mutex is required by the callee - * - * @param filename full vfs path to the script filename - * @param userLine linenumber where the USER set the breakpoint (UserLine) - * - * @return true if the breakpoint's state was changed - */ - bool ToggleBreakPoint(std::string filename, uint userLine); - - - void GetCallstack(std::stringstream& response); - void GetStackFrameData(std::stringstream& response, uint nestingLevel, STACK_INFO stackInfoKind); - - /** @brief Compares the object's associated scriptinterface with the pointer passed as parameter. - * @return true if equal - */ - bool CompareScriptInterfacePtr(ScriptInterface* pScriptInterface) const; - - // Getter/Setters for members that need to be threadsafe - std::string GetBreakFileName(); - bool GetIsInBreak(); - uint GetLastBreakLine(); - std::string GetName(); - uint GetID(); - void ContinueExecution(); - void SetNextDbgCmd(DBGCMD dbgCmd); - DBGCMD GetNextDbgCmd(); - // The callee is responsible for locking m_Mutex - void AddStackInfoRequest(STACK_INFO requestType, uint nestingLevel, SDL_sem* semaphore); - - -private: - // Getters/Setters for members that need to be threadsafe - void SetBreakFileName(std::string breakFileName); - void SetLastBreakLine(uint breakLine); - void SetIsInBreak(bool isInBreak); - - // Other threadsafe functions - void SaveCallstack(); - - /// Used only in the scriptinterface's thread. - void ClearTrapsToRemove(); - bool CurrentFrameIsChildOf(JSStackFrame* pParentFrame); - void ReturnActiveBreakPoints(jsbytecode* pBytecode); - void SaveStackFrameData(STACK_INFO stackInfo, uint nestingLevel); - std::string StringifyCyclicJSON(jsval obj, bool indent); - - std::auto_ptr m; -}; - -#endif // INCLUDED_THREADDEBUGGER +//#ifndef INCLUDED_THREADDEBUGGER +//#define INCLUDED_THREADDEBUGGER +// +//#include "DebuggingServer.h" +//#include "ScriptInterface.h" +//#include "scriptinterface/ScriptExtraHeaders.h" +// +//// These Breakpoint classes are not implemented threadsafe. The class using the Breakpoints is responsible to make sure that +//// only one thread accesses the Breakpoint at a time +//class CBreakPoint +//{ +//public: +// CBreakPoint() : m_UserLine(0) { } +// +// uint m_UserLine; +// std::string m_Filename; +//}; +// +//// Only use this with one ScriptInterface/CThreadDebugger! +//class CActiveBreakPoint : public CBreakPoint +//{ +//public: +// CActiveBreakPoint() +// : m_ActualLine(m_UserLine) +// , m_Script(NULL) +// , m_Pc(NULL) +// , m_ToRemove(false) +// { } +// +// CActiveBreakPoint(CBreakPoint breakPoint) +// : CBreakPoint(breakPoint) // using default copy constructor +// , m_ActualLine(m_UserLine) +// , m_Script(NULL) +// , m_Pc(NULL) +// , m_ToRemove(false) +// { } +// +// uint m_ActualLine; +// JSScript* m_Script; +// jsbytecode* m_Pc; +// bool m_ToRemove; +//}; +// +//enum BREAK_SRC { BREAK_SRC_TRAP, BREAK_SRC_INTERRUP, BREAK_SRC_EXCEPTION }; +// +//struct ThreadDebugger_impl; +// +//class CThreadDebugger +//{ +//public: +// CThreadDebugger(); +// ~CThreadDebugger(); +// +// /** @brief Initialize the object (required before using the object!). +// * +// * @param id A unique identifier greater than 0 for the object inside its CDebuggingServer object. +// * @param name A name that will be can be displayed by the UI to identify the thread. +// * @param pScriptInterface Pointer to a scriptinterface. All Hooks, breakpoint traps etc. will be registered in this +// * scriptinterface and will be called by the thread this scriptinterface is running in. +// * @param pDebuggingServer Pointer to the DebuggingServer object this Object should belong to. +// * +// * @return Return value. +// */ +// void Initialize(uint id, std::string name, ScriptInterface* pScriptInterface, CDebuggingServer* pDebuggingServer); +// +// +// // A bunch of hooks used to get information from spidermonkey. +// // These hooks are used internally only but have to be public because they need to be accessible from the global hook functions. +// // Spidermonkey requires function pointers as hooks, which only works if the functions are global or static (not part of an object). +// // These global functions in ThreadDebugger.cpp are just wrappers for the following member functions. +// +// /** Simply calls BreakHandler with BREAK_SRC_TRAP */ +// JSTrapStatus TrapHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, jsval closure); +// /** Hook to capture exceptions and breakpoints in code (throw "Breakpoint";) */ +// JSTrapStatus ThrowHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval); +// /** All other hooks call this one if the execution should be paused. It puts the program in a wait-loop and +// * waits for weak-up events (continue, step etc.). */ +// JSTrapStatus BreakHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, jsval closure, BREAK_SRC breakSrc); +// JSTrapStatus StepHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure); +// JSTrapStatus StepIntoHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure); +// JSTrapStatus StepOutHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure); +// /** This is an interrup-hook that can be called multiple times per line of code and is used to break into the execution +// * without previously setting a breakpoint and to break other threads when one thread triggers a breakpoint */ +// JSTrapStatus CheckForBreakRequestHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure); +// /** The callback function which gets executed for each new script that gets loaded and each function inside a script. +// * We use it for "Execute-Hooks" and "Call-Hooks" in terms of Spidermonkey. +// * This hook actually sets the traps (Breakpoints) "on the fly" that have been defined by the user previously. +// */ +// void ExecuteHook(JSContext *cx, const char *filename, unsigned lineno, JSScript *script, JSFunction *fun, void *callerdata); +// /** This hook is used to update the mapping between filename plus line-numbers and jsbytecode pointers */ +// void NewScriptHook(JSContext *cx, const char *filename, unsigned lineno, JSScript *script, JSFunction *fun, void *callerdata); +// /** This hook makes sure that invalid mappings between filename plus line-number and jsbytecode points get deleted */ +// void DestroyScriptHook(JSContext *cx, JSScript *script); +// +// +// void ClearTrap(CActiveBreakPoint* activeBreakPoint); +// +// /** @brief Checks if a mapping for the specified filename and line number exists in this CThreadDebugger's context +// */ +// bool CheckIfMappingPresent(std::string filename, uint line); +// +// /** @brief Checks if a mapping exists for each breakpoint in the list of breakpoints that aren't set yet. +// * If there is a mapping, it removes the breakpoint from the list of unset breakpoints (from CDebuggingServer), +// * adds it to the list of active breakpoints (CThreadDebugger) and sets a trap. +// * Threading: m_Mutex is locked in this call +// */ +// void SetAllNewTraps(); +// +// /** @brief Sets a new trap and stores the information in the CActiveBreakPoint pointer +// * Make sure that a mapping exists before calling this function +// * Threading: Locking m_Mutex is required by the callee +// */ +// void SetNewTrap(CActiveBreakPoint* activeBreakPoint, std::string filename, uint line); +// +// /** @brief Toggle a breakpoint if it's active in this threadDebugger object. +// * Threading: Locking m_Mutex is required by the callee +// * +// * @param filename full vfs path to the script filename +// * @param userLine linenumber where the USER set the breakpoint (UserLine) +// * +// * @return true if the breakpoint's state was changed +// */ +// bool ToggleBreakPoint(std::string filename, uint userLine); +// +// +// void GetCallstack(std::stringstream& response); +// void GetStackFrameData(std::stringstream& response, uint nestingLevel, STACK_INFO stackInfoKind); +// +// /** @brief Compares the object's associated scriptinterface with the pointer passed as parameter. +// * @return true if equal +// */ +// bool CompareScriptInterfacePtr(ScriptInterface* pScriptInterface) const; +// +// // Getter/Setters for members that need to be threadsafe +// std::string GetBreakFileName(); +// bool GetIsInBreak(); +// uint GetLastBreakLine(); +// std::string GetName(); +// uint GetID(); +// void ContinueExecution(); +// void SetNextDbgCmd(DBGCMD dbgCmd); +// DBGCMD GetNextDbgCmd(); +// // The callee is responsible for locking m_Mutex +// void AddStackInfoRequest(STACK_INFO requestType, uint nestingLevel, SDL_sem* semaphore); +// +// +//private: +// // Getters/Setters for members that need to be threadsafe +// void SetBreakFileName(std::string breakFileName); +// void SetLastBreakLine(uint breakLine); +// void SetIsInBreak(bool isInBreak); +// +// // Other threadsafe functions +// void SaveCallstack(); +// +// /// Used only in the scriptinterface's thread. +// void ClearTrapsToRemove(); +// bool CurrentFrameIsChildOf(JSStackFrame* pParentFrame); +// void ReturnActiveBreakPoints(jsbytecode* pBytecode); +// void SaveStackFrameData(STACK_INFO stackInfo, uint nestingLevel); +// std::string StringifyCyclicJSON(jsval obj, bool indent); +// +// std::auto_ptr m; +//}; +// +//#endif // INCLUDED_THREADDEBUGGER