OS | CI status |
---|---|
MAC & Linux | |
Windows |
emmylua / emmyluadebugger Goto Github PK
View Code? Open in Web Editor NEWEmmyLua Debugger
EmmyLua Debugger
你好,
最近在学习emmy_core的源代码,看到下面的行:
EmmyLuaDebugger/emmy_core/emmy_debugger.cpp
Line 729 in c37ede5
请问为什么这里的unlock没有对应的lock?这样会出问题吗?
运行环境: openresy,web请求到a入口文件,测试发现跨文件无法断点到b文件。
再次测试: 以lua.exe脚本方式执行到a入口文件,测试发现能正常断点到b文件。
反馈:openresty等web服务类似的机制,是否不支持目前的debug?????
各位大佬能否完善一下!!
mobdebug uses the metamethod __serialize
to allow returning of custom data when debugging. This is very useful for inspecting values returned from closures:
local function buildGreeter(name)
local mt = {
__serialize = function(t)
return {
name = name,
greeting = t.sayHello()
}
end
}
local Greeter = {}
function Greeter.sayHello()
return "Hello, "..name
end
return setmetatable(Greeter, mt)
end
local greeter = buildGreeter("Emmy")
print(greeter.sayHello())
mobdebug would show me:
{
greeting = "Hello, Emmy",
name = "Emmy"
}
EmmyLuaDebugger gives me:
{
sayHello = {function}
}
Using __serialize
for backward compatibility would be great, but any functionality that achieves this end would very useful.
在SocketClientTransporter::Connect
和SocketServerTransporter::Listen
这两处都是先尝试用uv_ip6_addr
把host
按IPv6来解析, 但是解析成功与否应该用uv_ip6_addr
的返回值来判断, 不应该用family
域来判断, 因为uv_ip6_addr
内会先把family
域赋值为AF_INET6
I am attempting to enable remote debugging of my custom Kong plugin, which is developed in Lua language inside the Pongo framework. To achieve this, I've integrated the EmyLuaDebugger plugin for IntelliJ IDEA and added the necessary debug code inside my Lua script. Additionally, I have exposed the ports for remote debugging from within the Docker container and included the emmy_core.so file inside the container.
However, I am encountering an issue where the debugger successfully connects but then immediately disconnects. Consequently, the breakpoint is not triggered, and I am unable to debug the code effectively. I discovered in a blog post that this behavior might be due to the path not being correctly resolved inside the Docker container.
Expected Behavior:
The debugger should connect successfully, stop at the breakpoints set in the Lua code, and allow for effective debugging of the custom Kong plugin.
Actual Behavior:
The debugger connects but immediately disconnects, and breakpoints are not triggered.
Additional Information:
Any assistance in resolving this issue and properly setting up the fixPath function would be greatly appreciated.
cc: @CppCXY
我正在把这个库集成到 xmake-repo 仓库,但是 windows 上有点问题
然后 windows 版本编译带 lua 源码,链接不过。。
/usr/local/bin/cmake -DEMMY_USE_LUA_SOURCE=ON -DEMMY_LUA_VERSION=54 -DCMAKE_BUILD_TYPE=Release -DC
MAKE_INSTALL_PREFIX=/Users/ruki/.xmake/packages/e/emmylua_debugger/1.6.2/5ac9d51f3ee84cc7b5f692eef
acc4ac1 -DCMAKE_INSTALL_LIBDIR:PATH=lib -G "Unix Makefiles" -DCMAKE_POSITION_INDEPENDENT_CODE=ON /
Users/ruki/.xmake/cache/packages/2308/e/emmylua_debugger/1.6.2/source
我看 link 了,"..\third-party\lua-5.4.0\Release\lua54.lib"
Link:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\Release\emmy_core.dll" /INCREMENTAL:NO /NOLOGO ..\emmy_debugger\Release\emmy_debugger.lib "..\third-party\lua-5.4.0\Release\lua54.lib" "..\third-party\libuv-1.29.0\Release\uv_a.lib" advapi32.lib iphlpapi.lib psapi.lib shell32.lib user32.lib userenv.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:"C:/Users/runneradmin/AppData/Local/.xmake/cache/packages/2308/e/emmylua_debugger/1.6.2/source/build_a7aa4ee1/emmy_core/Release/emmy_core.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/runneradmin/AppData/Local/.xmake/cache/packages/2308/e/emmylua_debugger/1.6.2/source/build_a7aa4ee1/emmy_core/Release/emmy_core.lib" /MACHINE:X64 /machine:x64 /DLL emmy_core.dir\Release\emmy_core.obj
Creating library C:/Users/runneradmin/AppData/Local/.xmake/cache/packages/2308/e/emmylua_debugger/1.6.2/source/build_a7aa4ee1/emmy_core/Release/emmy_core.lib and object C:/Users/runneradmin/AppData/Local/.xmake/cache/packages/2308/e/emmylua_debugger/1.6.2/source/build_a7aa4ee1/emmy_core/Release/emmy_core.exp
21>emmy_debugger.lib(emmy_debugger_manager.obj) : error LNK2001: unresolved external symbol __imp_lua_settop [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_core.obj : error LNK2001: unresolved external symbol __imp_lua_settop [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(emmy_debugger_lib.obj) : error LNK2001: unresolved external symbol __imp_lua_settop [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(extension_point.obj) : error LNK2001: unresolved external symbol __imp_lua_settop [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(emmy_debugger.obj) : error LNK2001: unresolved external symbol __imp_lua_settop [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_core.obj : error LNK2019: unresolved external symbol __imp_lua_pushvalue referenced in function luaopen_emmy_core [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(emmy_debugger_lib.obj) : error LNK2001: unresolved external symbol __imp_lua_pushvalue [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(extension_point.obj) : error LNK2001: unresolved external symbol __imp_lua_pushvalue [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(emmy_debugger.obj) : error LNK2001: unresolved external symbol __imp_lua_pushvalue [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(emmy_debugger.obj) : error LNK2001: unresolved external symbol __imp_lua_pushstring [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_core.obj : error LNK2001: unresolved external symbol __imp_lua_pushstring [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(emmy_debugger_lib.obj) : error LNK2001: unresolved external symbol __imp_lua_pushstring [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(emmy_facade.obj) : error LNK2001: unresolved external symbol __imp_lua_pushstring [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(extension_point.obj) : error LNK2001: unresolved external symbol __imp_lua_pushstring [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_core.obj : error LNK2019: unresolved external symbol __imp_lua_rawgeti referenced in function luaopen_emmy_core [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(extension_point.obj) : error LNK2001: unresolved external symbol __imp_lua_rawgeti [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_core.obj : error LNK2019: unresolved external symbol __imp_lua_createtable referenced in function luaopen_emmy_core [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(emmy_debugger_lib.obj) : error LNK2001: unresolved external symbol __imp_lua_createtable [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(extension_point.obj) : error LNK2001: unresolved external symbol __imp_lua_createtable [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(emmy_debugger.obj) : error LNK2001: unresolved external symbol __imp_lua_createtable [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_core.obj : error LNK2019: unresolved external symbol __imp_lua_rawset referenced in function luaopen_emmy_core [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_debugger.lib(extension_point.obj) : error LNK2001: unresolved external symbol __imp_lua_rawset [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
21>emmy_core.obj : error LNK2019: unresolved external symbol __imp_luaL_setfuncs referenced in function luaopen_emmy_core [C:\Users\runneradmin\AppData\Local\.xmake\cache\packages\2308\e\emmylua_debugger\1.6.2\source\build_a7aa4ee1\emmy_core\emmy_core.vcxproj]
https://github.com/xmake-io/xmake-repo/actions/runs/5965497990/job/16183068683?pr=2495
tcpListen() 中 Destroy() 释放 Transporter 导致 Debug 链接被中断,需要重新发起请求才能 Connected
ejoy2d lua调试。不论使用vscode插件调试还是idea插件调试都是直接crash。好像ejoy2d使用的是32位的lua,不知道是不是这个原因。ejoy2d 我用的是github最新的那个,os是win10 64.
在调试中取消断点的Suspend execution后,进入断点时仍会在对应位置阻塞,但ide由于未勾选阻塞选项,因此状态仍未执行中,无法恢复执行,只能断开调试来恢复运行。
void EmmyFacade::OnAddBreakPointReq(const rapidjson::Document& document) {
if (document.HasMember("clear")) {
const auto all = document["clear"].GetBool();
if (all) {
Debugger::Get()->RemoveAllBreakpoints();
}
}
.....
为什么 OnAddBreakPointReq 会先 RemoveAll ? vscode 下会发生只有一个 breakpoint 起作用的情况。
package.cpath = package.cpath .. ';/Users/xxx/Library/Application Support/IdeaIC2019.2/EmmyLua/classes/debugger/emmy/mac/?.so'
local dbg = require('emmy_core')
dbg.tcpListen('localhost', 9966)
LuaException: c# exception in LoadFromCustomLoaders:System.IO.FileNotFoundException: Could not find file "xxx/Lua/emmy_core.lua"
是因为存customLoader吗
name | version |
---|---|
IDEA version | [e.g. IC2018.2 EAP, CL2018.1.2] IDEA 2020.2.3 |
EmmyLua version | [e.g. v1.3.4.157-IDEA202] v1.3.4.157-IDEA202 |
OS | [e.g. Windows 10] Windows 10 |
…
…
(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)
…
我们写如下这样一个函数,使用两层pcall调用:
function test1()
local a = 1
local b = 2
end
function test2()
local x = 1;
test1()
local y = 2
end
function test3()
pcall(test2)
end
pcall(test3)
断点打在test2()
函数中,在使用step over功能时,会进入到test0
函数
之所以发现这个问题是因为我们使用 Lua Busted作为单元测试的工具,但是在调试测试用例的时候无法进行单步调试。
Lua版本:
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
操作系统:
13.0.1 (22A400) M1 arm
Emmy版本
[EMMY] version: 1.4.1
我在windows下编译,只有编译lua54,且不勾选EMMY_USE_LUA_SOURCE的情况下才能勾选成功。在使用lua51或者luajit的情况下直接无论哪种情况都失败了。
Tried using the new debugger copied the code, and seems that require('emmy_core') results in true and not an object.
package.cpath = package.cpath .. ';C:/Users/emelrad12/AppData/Roaming/JetBrains/IntelliJIdea2020.3/plugins/intellij-emmylua/classes/debugger/emmy/windows/x64/?.dll'
local dbg = require('emmy_core')
dbg.tcpConnect('localhost', 9966) --Here error
Hello.
I try to use debug in InlelliJIdea. Looks like it works, but with some issues, if i set the breakpoint on the specific line and start local Debug, the debuger engine starts from the first code line.
Follow I try to use remote debug for nginx. InlelliJIdea says that session connected, but does not stop on breakpoint.
I think that the source of problem is the question - why debuger does not go to the specific breakpoint directly? I tried different versions of InlelliJIdea 2018 and 2019. The same behavior.
想问一下require(emmy_core)返回true,并没有注册函数,这会是什么原因导致的呢。是编译luajit需要一些特别的设置吗
环境: mac osx & xlua
EmmyFacade::TcpListen这个方法mac上没有办法调试 这个先不说
问题:EmmyFacade::TcpConnect方法最近新改的添加了一个连接出错后然后报一个luaerror 调用。 这里如果ide不开开启debug然后就会一个error
int LuaError(lua_State* L) {
std::string msg = lua_tostring(L, 1);
msg = "[Emmy]" + msg;
lua_getglobal(L, "error");
lua_pushstring(L, msg.c_str());
lua_call(L, 1, 0);
return 0;
}
然后unity启动就不能向下运行了, 因为ide很多情况下不会一直开着的debug的,所以想问这里是不是可以直接改成打印 然后不影响程序向下运行。如下
const auto suc = c->Connect(host, port, err);
if (suc) {
WaitIDE(true);
} else {
lua_pushcfunction(L, LuaPrint);
lua_pushstring(L, err.c_str());
lua_call(L, 1, 0);
}
顺便问下 ide里面直接打断点现在是不是不能用,现在只能用强制 breakHere()方法来打断点调试。
emmy_debugger.cpp 450行左右,会在lua_next遍历表的过程中对一个LUA_TNUMBER的key执行lua_tostring操作,但是我看lua官方手册这种操作会引起报错,我这边碰见这个报错就会导致断点失效了。
name | version |
---|---|
IDEA version | 2019.3 |
EmmyLua version | 1.3.0.134 |
OS | Windows 10 |
breakpoints don‘t work
…
(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)
…
有两个文件:
a.lua 入口文件:
package.cpath = package.cpath .. 'openresty/lualib/?.so'
dbg = require('emmy_core')
dbg.tcpConnect('10.254.254.1', 9966)
local a = 1111
local test = require('b')
local b = test.sync() ---调用b文件方法
print(b)
b.lua 文件:
local test = {}
function test.sync()
dbg.breakHere()
local data = 1234
return data
end
return test
运行环境: openresy,web请求到a入口文件,测试发现跨文件无法断点到b文件。
再次测试: 以lua.exe脚本方式执行到a入口文件,测试发现能正常断点到b文件。
反馈:openresty等web服务类似的机制,是否不支持目前的debug?????
各位大佬能否完善一下!!
在Debugger connect IDE模式下
如果IDE没有开启 直接启动程序
则会卡顿一段时间才会继续执行
这个时间能不能自己配置
时间过了自动放弃连接IDE
在使用use_source的lua51版本的时候发现emmy_hook中定义了_lua_pcallk,但这个只会在lua5.2之后出现lua51和luajit均会失败。
有两个文件:
a.lua 入口文件:
package.cpath = package.cpath .. '/openresty/lualib/?.so'
dbg = require('emmy_core')
dbg.tcpConnect('10.254.254.1', 9966)
local a = 1111
local test = require('b')
local data = test.sync() ---调用b文件方法
print(data)
b.lua 文件:
local b = {}
function b.sync()
dbg.breakHere()
local data = 1234
return data
end
return b
运行环境: openresy,web请求到a入口文件,测试发现跨文件无法断点到b文件。
再次测试: 以lua.exe脚本方式执行到a入口文件,测试发现能正常断点到b文件。
反馈:openresty等web服务类似的机制,是否不支持目前的debug?????
各位大佬能否完善一下!!
可以命中断点,但不能正常单步调试
从这个提交之后就不行了
lua5.1
struct lua_Debug {
int event;
const char name; / (n) */
const char namewhat; / (n) global',
local', field',
method' */
const char what; / (S) Lua',
C', main',
tail' */
const char source; / (S) /
int currentline; / (l) /
int nups; / (u) number of upvalues /
int linedefined; / (S) /
int lastlinedefined; / (S) /
char short_src[LUA_IDSIZE]; / (S) /
/ private part /
int i_ci; / active function */
};
lua5.2
struct lua_Debug {
int event;
const char name; / (n) */
const char namewhat; / (n) 'global', 'local', 'field', 'method' */
const char what; / (S) 'Lua', 'C', 'main', 'tail' */
const char source; / (S) /
int currentline; / (l) /
int linedefined; / (S) /
int lastlinedefined; / (S) /
unsigned char nups; / (u) number of upvalues /
unsigned char nparams;/ (u) number of parameters /
char isvararg; / (u) /
char istailcall; / (t) /
char short_src[LUA_IDSIZE]; / (S) /
/ private part */
struct CallInfo i_ci; / active function */
};
lua5.3
struct lua_Debug {
int event;
const char name; / (n) */
const char namewhat; / (n) 'global', 'local', 'field', 'method' */
const char what; / (S) 'Lua', 'C', 'main', 'tail' */
const char source; / (S) /
int currentline; / (l) /
int linedefined; / (S) /
int lastlinedefined; / (S) /
unsigned char nups; / (u) number of upvalues /
unsigned char nparams;/ (u) number of parameters /
char isvararg; / (u) /
char istailcall; / (t) /
char short_src[LUA_IDSIZE]; / (S) /
/ private part */
struct CallInfo i_ci; / active function */
};
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.