MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / dump_state

Method dump_state

ogsr_engine/COMMON_AI/script_engine.cpp:324–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322
323//*********************************************************************************************
324void CScriptEngine::dump_state()
325{
326 static bool reentrantGuard = false;
327 if (reentrantGuard)
328 return;
329 reentrantGuard = true;
330
331 lua_State* L = lua();
332 lua_Debug l_tDebugInfo;
333 for (int i = 0; lua_getstack(L, i, &l_tDebugInfo); ++i)
334 {
335 lua_getinfo(L, "nSlu", &l_tDebugInfo);
336
337 if (!xr_strcmp(l_tDebugInfo.what, "C"))
338 {
339 Msg("%2d : [C ] %s", i, l_tDebugInfo.name ? l_tDebugInfo.name : "");
340 }
341 else
342 {
343 string_path temp;
344 if (l_tDebugInfo.name)
345 xr_sprintf(temp, "%s(%d)", l_tDebugInfo.name, l_tDebugInfo.linedefined);
346 else
347 xr_sprintf(temp, "function <%s:%d>", l_tDebugInfo.short_src, l_tDebugInfo.linedefined);
348
349 Msg("%2d : [%3s] %s(%d) : %s", i, l_tDebugInfo.what, l_tDebugInfo.short_src, l_tDebugInfo.currentline, temp);
350 }
351
352 Msg("\tLocals:");
353 const char* name;
354 int VarID = 1;
355 while ((name = lua_getlocal(L, &l_tDebugInfo, VarID++)) != NULL)
356 {
357 LogVariable(L, name, 1);
358
359 lua_pop(L, 1); /* remove variable value */
360 }
361 m_dumpedObjList.clear();
362 Msg("\tEnd");
363 }
364 reentrantGuard = false;
365}
366
367void CScriptEngine::LogTable(lua_State* l, LPCSTR S, int level)
368{

Callers 1

ScriptCrashHandlerFunction · 0.80

Calls 7

luaFunction · 0.85
MsgFunction · 0.85
lua_getlocalFunction · 0.85
lua_getstackFunction · 0.50
lua_getinfoFunction · 0.50
xr_strcmpFunction · 0.50
clearMethod · 0.45

Tested by

no test coverage detected