23 LuaDebugger(lua_State *L,
bool debugEnable,
int instLimit,
size_t heapSize);
40 void pcall(
int narg,
int nret,
bool autoBreak);
42 bool help(
const wchar_t *
usage,
const std::vector<std::wstring> &args);
43 bool conf(
const wchar_t *usage,
const std::vector<std::wstring> &args);
44 bool mem(
const wchar_t *usage,
const std::vector<std::wstring> &args);
45 bool bt(
const wchar_t *usage,
const std::vector<std::wstring> &args);
46 bool fr(
const wchar_t *usage,
const std::vector<std::wstring> &args);
47 bool src(
const wchar_t *usage,
const std::vector<std::wstring> &args);
48 bool eval(
const wchar_t *usage,
const std::vector<std::wstring> &args);
49 bool watch(
const wchar_t *usage,
const std::vector<std::wstring> &args);
50 bool c(
const wchar_t *usage,
const std::vector<std::wstring> &args);
51 bool s(
const wchar_t *usage,
const std::vector<std::wstring> &args);
52 bool n(
const wchar_t *usage,
const std::vector<std::wstring> &args);
53 bool out(
const wchar_t *usage,
const std::vector<std::wstring> &args);
54 bool bp(
const wchar_t *usage,
const std::vector<std::wstring> &args);
57 struct ChunkDebugInfo {
59 std::string chunkName;
61 std::vector<std::string> srcLines;
63 std::vector<uint8_t> validLines;
65 std::vector<uint8_t> breakPoints;
68 ChunkDebugInfo() =
default;
69 ChunkDebugInfo(
const ChunkDebugInfo &) =
delete;
70 ChunkDebugInfo &
operator=(
const ChunkDebugInfo &) =
delete;
71 ChunkDebugInfo(ChunkDebugInfo &&) =
default;
72 ChunkDebugInfo &
operator=(ChunkDebugInfo &&) =
default;
75 enum class DebugState {
81 static const int DefSrcLines = 21;
82 static const int DefTableDepth = 3;
89 std::unordered_map<std::string, ChunkDebugInfo> m_debugInfo;
90 std::string m_fileNameStr;
91 DebugState m_debugState = DebugState::CONT;
93 int m_currentFrame = 0;
94 std::vector<std::string> m_watchList;
96 void hook(lua_Debug *ar);
97 void hookNonDebug(lua_Debug *ar);
98 void hookDebug(lua_Debug *ar);
100 static int msghandler(lua_State *L);
101 static void hookRaw(lua_State *L, lua_Debug *ar);
104 void summaryOnBreak(lua_Debug *ar);
105 void printSrcLines(
const std::string &name,
int line,
int range,
int execLine = -1);
106 void printLocalAndUpvalue(lua_Debug *ar,
int maxDepth,
bool skipNoName);
107 void pushLocalEnv(lua_Debug *ar,
int frameNo);
108 void printEval(
const std::string &expr);
109 void printWatchList();
bool c(const wchar_t *usage, const std::vector< std::wstring > &args)
lua_State * getLuaState() const
Get Lua state.
bool fr(const wchar_t *usage, const std::vector< std::wstring > &args)
bool out(const wchar_t *usage, const std::vector< std::wstring > &args)
bool help(const wchar_t *usage, const std::vector< std::wstring > &args)
bool src(const wchar_t *usage, const std::vector< std::wstring > &args)
noncopyable & operator=(const noncopyable &)=delete
void loadDebugInfo(const char *name, const char *src, size_t size)
Load debug info from chunk name and source string.
bool watch(const wchar_t *usage, const std::vector< std::wstring > &args)
bool conf(const wchar_t *usage, const std::vector< std::wstring > &args)
bool bp(const wchar_t *usage, const std::vector< std::wstring > &args)
bool s(const wchar_t *usage, const std::vector< std::wstring > &args)
LuaDebugger(lua_State *L, bool debugEnable, int instLimit, size_t heapSize)
Constructor.
bool mem(const wchar_t *usage, const std::vector< std::wstring > &args)
bool eval(const wchar_t *usage, const std::vector< std::wstring > &args)
void pcall(int narg, int nret, bool autoBreak)
Prepare and call lua_pcall().
bool bt(const wchar_t *usage, const std::vector< std::wstring > &args)
bool n(const wchar_t *usage, const std::vector< std::wstring > &args)