From: John L. <jr...@us...> - 2007-11-28 22:55:07
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv28670/wxLua/modules/wxluadebug/include Modified Files: wxldebug.h Log Message: Use wxSIGKILL to kill debuggee process since wxSIGTERM doesn't work in MSW Made wxLuaCheckStack class work a little nicer for easier debugging in C++ Made wxluaT_insert(L, idx) not pop the value that it refs since it may not be the one at the top of the stack. Use wxLuaDebugData::GetTypeValue in wxLuaDebugTarget and other code cleanup in wxLuaDebugTarget Index: wxldebug.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/include/wxldebug.h,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** wxldebug.h 28 Nov 2007 00:20:50 -0000 1.42 --- wxldebug.h 28 Nov 2007 22:55:01 -0000 1.43 *************** *** 65,69 **** void SetFlag(int flag) { m_flag = flag; } void SetFlagBit(int bit, bool set) { m_flag = WXLUA_SETBIT(m_flag, bit, set); } ! void SetReference(int lua_ref) { m_lua_ref = lua_ref; } // only if you're wxluaT_removed it // Get a human readable string for debugging --- 65,69 ---- void SetFlag(int flag) { m_flag = flag; } void SetFlagBit(int bit, bool set) { m_flag = WXLUA_SETBIT(m_flag, bit, set); } ! void SetReference(int lua_ref) { m_lua_ref = lua_ref; } // only if you've wxluaT_removed it // Get a human readable string for debugging *************** *** 99,103 **** // ---------------------------------------------------------------------------- ! // an invalid wxLuaState for comparison (like wxNullBitmap) extern WXDLLIMPEXP_DATA_WXLUADEBUG(wxLuaDebugData) wxNullLuaDebugData; --- 99,103 ---- // ---------------------------------------------------------------------------- ! // an invalid wxLuaDebugData for comparison (like wxNullBitmap) extern WXDLLIMPEXP_DATA_WXLUADEBUG(wxLuaDebugData) wxNullLuaDebugData; *************** *** 124,137 **** void Add(wxLuaDebugItem* item); // fill this with the stack entries for the wxLuaState // returns the number of stack entries added int EnumerateStack(const wxLuaState& wxlState); ! // fill this with the locals from a particular stack entry, if an item is a // table then add a reference to it in the references array ! int EnumerateStackEntry(const wxLuaState& wxlState, int stackRef, wxArrayInt& references); // fill this with the name and value of items in a table at the given reference, // if the table has a sub table then add a reference to it to the references array int EnumerateTable(const wxLuaState& wxlState, int nRef, int nEntry, wxArrayInt& references); // These functions are static to allow them to be used in other places to // give a consistent feel to the display of Lua values. --- 124,140 ---- void Add(wxLuaDebugItem* item); + //------------------------------------------------------------------------- + // fill this with the stack entries for the wxLuaState // returns the number of stack entries added int EnumerateStack(const wxLuaState& wxlState); ! // fill this with the locals from a particular stack frame, if an item on the stack is a // table then add a reference to it in the references array ! int EnumerateStackEntry(const wxLuaState& wxlState, int stack_frame, wxArrayInt& references); // fill this with the name and value of items in a table at the given reference, // if the table has a sub table then add a reference to it to the references array int EnumerateTable(const wxLuaState& wxlState, int nRef, int nEntry, wxArrayInt& references); + //------------------------------------------------------------------------- // These functions are static to allow them to be used in other places to // give a consistent feel to the display of Lua values. *************** *** 155,158 **** --- 158,164 ---- wxLuaDebugData Copy() const; + // Ref this table if it hasn't been refed already, returns ref # or LUA_NOREF if not refed + int RefTable(lua_State* L, int stack_idx, int* flag_type, wxArrayInt& references); + // Sorting function for the wxLuaDebugItemArray, sorts by name static int SortFunction(wxLuaDebugItem *elem1, wxLuaDebugItem *elem2 ); *************** *** 173,177 **** // ---------------------------------------------------------------------------- ! // wxLuaCheckStack - dumps the contents of the lua_State // ---------------------------------------------------------------------------- --- 179,183 ---- // ---------------------------------------------------------------------------- ! // wxLuaCheckStack - Dump the contents of the lua_State for debugging // ---------------------------------------------------------------------------- *************** *** 179,198 **** { public: ! wxLuaCheckStack(lua_State* L, const wxString &msg); ~wxLuaCheckStack(); ! void TestStack(const wxString &msg); ! void DumpGlobals(); ! void DumpTable(const wxString &tableName); ! void DumpTable(int index, const wxString& tablename, wxSortedArrayString& tableArray, int indent); ! void DumpStack(); void OutputMsg(const wxString& msg) const; ! private: lua_State* m_luaState; wxString m_msg; int m_top; }; --- 185,224 ---- { public: ! // Create a instance, remembers lua_gettop(), 'msg' can be used to add ! // information about where or why this was created. ! // If 'print_to_console' then all functions below that return a string will also ! // print to the console as well. ! wxLuaCheckStack(lua_State* L, const wxString &msg = wxEmptyString, bool print_to_console = true); ! // Prints out the starting top and ending top if 'print_to_console' in constructor ~wxLuaCheckStack(); ! // Returns a string comparing the starting and current lua_gettop() with additional msg ! wxString TestStack(const wxString &msg = wxEmptyString); ! // Returns a string of the current items on the stack with their types. ! wxString DumpStack(const wxString& msg = wxEmptyString); ! ! // Returns a string of all of the global variables and subtables with additional msg. ! wxString DumpGlobals(const wxString& msg = wxEmptyString); ! // Dump the table and it's subtables from the globals index with additional msg. ! // The name may be of the form "table1.subtable2.subtable3..." ! wxString DumpTable(const wxString& tableName, const wxString& msg = wxEmptyString); ! // Dump the table and it's subtables at the stack_idx with additional msg. ! wxString DumpTable(int stack_idx, const wxString& msg = wxEmptyString); ! ! // Dump the contents of the table at the stack_idx to a string. 'tablename' and 'msg' are ! // for informational messages, 'tableArray' is used to avoid recursion and should be empty ! // for the initial call, and 'indent' is used to track indentation level for each subtable. ! wxString DumpTable(int stack_idx, const wxString& tablename, const wxString& msg, wxSortedArrayString& tableArray, int indent); + // Print a message to the console if 'print_to_console' in constructor. void OutputMsg(const wxString& msg) const; ! // implementation ! lua_State* m_luaState; wxString m_msg; int m_top; + bool m_print_to_console; }; |