MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / Attach

Method Attach

emmy_debugger/src/debugger/emmy_debugger.cpp:58–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void Debugger::Attach() {
59 if (!running)
60 return;
61
62 // execute helper code
63 if (!manager->helperCode.empty()) {
64 ExecuteOnLuaThread([this](lua_State *L) {
65 const int t = lua_gettop(L);
66 // 判断是不是主lua_state
67 int ret = lua_pushthread(L);
68 if (ret == 1) {
69 const int r = luaL_loadstring(L, manager->helperCode.c_str());
70 if (r == LUA_OK) {
71 if (lua_pcall(L, 0, 0, 0) != LUA_OK) {
72 std::string msg = lua_tostring(L, -1);
73 printf("msg: %s", msg.c_str());
74 }
75 }
76 }
77 lua_settop(L, t);
78 });
79 }
80}
81
82void Debugger::Detach() {
83 // states.clear();

Callers

nothing calls this directly

Calls 6

lua_gettopFunction · 0.50
lua_pushthreadFunction · 0.50
luaL_loadstringFunction · 0.50
lua_pcallFunction · 0.50
lua_settopFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected