Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging on Mac? #58

Closed
andrewstarks opened this issue Apr 16, 2020 · 6 comments
Closed

Debugging on Mac? #58

andrewstarks opened this issue Apr 16, 2020 · 6 comments

Comments

@andrewstarks
Copy link

Out of the box, debugging does not appear to work and documentation is very light. The two configurations that I'm currently trying (I've tried many others):

                {
            "type": "emmylua_launch",
            "request": "launch",
            "name": "Attach by launch program",
            "program": "${workspaceFolder}/lua",
            "captureStd": true,
            "captureOutputDebugString": false,
            "workingDir": "",
            "arguments": []
        },

        {
            "type": "emmylua_new",
            "request": "launch",
            "name": "EmmyLua New Debug",
            "host": "localhost",
            "port": 9966,
            "ext": [
                ".lua",
                ".lua.txt",
                ".lua.bytes"
            ],
            "ideConnectDebugger": true
        }

(I have lua in the workspaceFolder)

emmylua_launch Starts, and says Launch program with x64 debugger. in the DEBUG CONSOLE menu, and then does nothing. Debugging does not start.

emmylua_new

Brings up an error "Error: connect ECONNREFUSED 127.0.0.1.:9966"

Adding this to the file i'm debugging has no effect.

package.cpath = package.cpath .. ";/Users/andrewstarks/.vscode/extensions/tangzx.emmylua-0.3.28/debugger/emmy/mac/emmy_core.dylib"
local dbg = require("emmy_core")
dbg.tcpListen("localhost", 9966)

Is debugging supported on the Mac? If not, it would be good to include a warning on the Readme file, and a suggestion on a workaround (another package?)

Thank you!

Adding
It may be that attaching to an external process through mobdebug (or some other socket based method) is the right way, but this fails with

@tangzx
Copy link
Member

tangzx commented Apr 19, 2020

emmylua_new supports Windows/Mac/Linux platform.

step1: insert that code to main file

package.cpath = package.cpath .. ";/Users/andrewstarks/.vscode/extensions/tangzx.emmylua-0.3.28/debugger/emmy/mac/emmy_core.dylib"
local dbg = require("emmy_core")
dbg.tcpListen("localhost", 9966)

step2: launch lua application, make sure the inserted code is executed and no error.
step3: launch debugger in the vscode side, it should work

@xbpiao
Copy link

xbpiao commented Jan 26, 2021

emmylua_new supports Windows/Mac/Linux platform.

step1: insert that code to main file

package.cpath = package.cpath .. ";/Users/andrewstarks/.vscode/extensions/tangzx.emmylua-0.3.28/debugger/emmy/mac/emmy_core.dylib"
local dbg = require("emmy_core")
dbg.tcpListen("localhost", 9966)

step2: launch lua application, make sure the inserted code is executed and no error.
step3: launch debugger in the vscode side, it should work

debug crash in UE4.26

@xbpiao
Copy link

xbpiao commented Feb 9, 2021

emmylua_new supports Windows/Mac/Linux platform.
step1: insert that code to main file

package.cpath = package.cpath .. ";/Users/andrewstarks/.vscode/extensions/tangzx.emmylua-0.3.28/debugger/emmy/mac/emmy_core.dylib"
local dbg = require("emmy_core")
dbg.tcpListen("localhost", 9966)

step2: launch lua application, make sure the inserted code is executed and no error.
step3: launch debugger in the vscode side, it should work

debug crash in UE4.26

recompile EmmyLuaDebugger it work!

@hemmerling
Copy link

hemmerling commented Jun 30, 2021

This is not about Mac, but I have same & similar problems with Windows10-64bit and Debian Linux-64bit.

My updated code which is suggested to be included in the lua application, it differs between Windows & Linux, so does not cover MacOSX.

( I see that MacOSX libraries have the extension ".dylib" - ok, Debian Linux libraries have the extension ".so" :-), but thats it ).

if (package.config:sub(1,1) == "\")
then
-- "C:\Users<user>" - CMD => %homedrive%%homepath%, PowerShell => $home
--package.cpath = package.cpath .. "C:\Users\Administrator\.vscode\extensions\tangzx.emmylua-0.3.49\debugger\emmy\windows\x64\?.dll"
package.cpath = package.cpath .. "C:\Users\Administrator\.vscode\extensions\tangzx.emmylua-0.3.49\debugger\emmy\windows\x86\?.dll"
else
package.cpath = package.cpath .. ";~/.vscode/extensions/tangzx.emmylua-0.3.49/debugger/emmy/linux/?.so"
end
print(package.cpath)
local dbg = require("emmy_core")
dbg.tcpListen("localhost", 9966)

I installed the plugin by VSC store, not by GitHub
If there is any update in GitHub, please upload new version to VSC plugin store.

a)
The "x64" statement does not work, it breaks by
%1 is not a valid Win32 application.
The "x86" statement works.
So I can run the application in Terminal mode ( "Terminal / Run Task" ).

But if I then try to debug by "Run / Start Debugging", I still get the
Error: connect ECONNREFUSED 127.0.0.1:9966. [Cancel]. [Open "launch.json"] error :-(.

So how to configure "launch.json" ? My current one for Windows is

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "emmylua_new",
"request": "launch",
"name": "EmmyLua New Debug",
"host": "localhost",
"port": 9966,
"ext": [
".lua",
".lua.txt",
".lua.bytes"
],
"ideConnectDebugger": true
}
]
}

A known solution with other LUA debuggers is to implement the attributes "path" and "cpath", so that there additional path & cpath strings can be given to the debugger. Unfortunately, neither "path" nor "cpath" are accepted as properties.
Suggestion: Please implement these 2 properties!

b) For Debian Linux, though
~/.vscode/extensions/tangzx.emmylua-0.3.49/debugger/emmy/linux/
points to the directory where "emmy_core.so" is situated,

and
print(print(package.cpath) lists the directory to be included into the CPATH,

fails by
module 'emmy_core' not found :-(

@CppCXY
Copy link
Member

CppCXY commented Jul 1, 2021

This is not about Mac, but I have same & similar problems with Windows10-64bit and Debian Linux-64bit.

My updated code which is suggested to be included in the lua application, it differs between Windows & Linux, so does not cover MacOSX.

( I see that MacOSX libraries have the extension ".dylib" - ok, Debian Linux libraries have the extension ".so" :-), but thats it ).

if (package.config:sub(1,1) == "")
then
-- "C:\Users" - CMD => %homedrive%%homepath%, PowerShell => $home
--package.cpath = package.cpath .. "C:\Users\Administrator.vscode\extensions\tangzx.emmylua-0.3.49\debugger\emmy\windows\x64?.dll"
package.cpath = package.cpath .. "C:\Users\Administrator.vscode\extensions\tangzx.emmylua-0.3.49\debugger\emmy\windows\x86?.dll"
else
package.cpath = package.cpath .. ";~/.vscode/extensions/tangzx.emmylua-0.3.49/debugger/emmy/linux/?.so"
end
print(package.cpath)
local dbg = require("emmy_core")
dbg.tcpListen("localhost", 9966)

I installed the plugin by VSC store, not by GitHub
If there is any update in GitHub, please upload new version to VSC plugin store.

a)
The "x64" statement does not work, it breaks by
%1 is not a valid Win32 application.
The "x86" statement works.
So I can run the application in Terminal mode ( "Terminal / Run Task" ).

But if I then try to debug by "Run / Start Debugging", I still get the
Error: connect ECONNREFUSED 127.0.0.1:9966. [Cancel]. [Open "launch.json"] error :-(.

So how to configure "launch.json" ? My current one for Windows is

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "emmylua_new",
"request": "launch",
"name": "EmmyLua New Debug",
"host": "localhost",
"port": 9966,
"ext": [
".lua",
".lua.txt",
".lua.bytes"
],
"ideConnectDebugger": true
}
]
}

A known solution with other LUA debuggers is to implement the attributes "path" and "cpath", so that there additional path & cpath strings can be given to the debugger. Unfortunately, neither "path" nor "cpath" are accepted as properties.
Suggestion: Please implement these 2 properties!

b) For Debian Linux, though
~/.vscode/extensions/tangzx.emmylua-0.3.49/debugger/emmy/linux/
points to the directory where "emmy_core.so" is situated,

and
print(print(package.cpath) lists the directory to be included into the CPATH,

fails by
module 'emmy_core' not found :-(

This is not about Mac, but I have same & similar problems with Windows10-64bit and Debian Linux-64bit.

My updated code which is suggested to be included in the lua application, it differs between Windows & Linux, so does not cover MacOSX.

( I see that MacOSX libraries have the extension ".dylib" - ok, Debian Linux libraries have the extension ".so" :-), but thats it ).

if (package.config:sub(1,1) == "")
then
-- "C:\Users" - CMD => %homedrive%%homepath%, PowerShell => $home
--package.cpath = package.cpath .. "C:\Users\Administrator.vscode\extensions\tangzx.emmylua-0.3.49\debugger\emmy\windows\x64?.dll"
package.cpath = package.cpath .. "C:\Users\Administrator.vscode\extensions\tangzx.emmylua-0.3.49\debugger\emmy\windows\x86?.dll"
else
package.cpath = package.cpath .. ";~/.vscode/extensions/tangzx.emmylua-0.3.49/debugger/emmy/linux/?.so"
end
print(package.cpath)
local dbg = require("emmy_core")
dbg.tcpListen("localhost", 9966)

I installed the plugin by VSC store, not by GitHub
If there is any update in GitHub, please upload new version to VSC plugin store.

a)
The "x64" statement does not work, it breaks by
%1 is not a valid Win32 application.
The "x86" statement works.
So I can run the application in Terminal mode ( "Terminal / Run Task" ).

But if I then try to debug by "Run / Start Debugging", I still get the
Error: connect ECONNREFUSED 127.0.0.1:9966. [Cancel]. [Open "launch.json"] error :-(.

So how to configure "launch.json" ? My current one for Windows is

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "emmylua_new",
"request": "launch",
"name": "EmmyLua New Debug",
"host": "localhost",
"port": 9966,
"ext": [
".lua",
".lua.txt",
".lua.bytes"
],
"ideConnectDebugger": true
}
]
}

A known solution with other LUA debuggers is to implement the attributes "path" and "cpath", so that there additional path & cpath strings can be given to the debugger. Unfortunately, neither "path" nor "cpath" are accepted as properties.
Suggestion: Please implement these 2 properties!

b) For Debian Linux, though
~/.vscode/extensions/tangzx.emmylua-0.3.49/debugger/emmy/linux/
points to the directory where "emmy_core.so" is situated,

and
print(print(package.cpath) lists the directory to be included into the CPATH,

fails by
module 'emmy_core' not found :-(

emmylua-vscode support launch debug in windows 10(not add any code and show in windows temminal !),
if process has run, you can use emmylua attach.

emmylua-pr-0.3.95.zip

@CppCXY CppCXY closed this as completed Mar 16, 2022
@bcq028
Copy link

bcq028 commented Feb 14, 2024

ECONNREFUSED 127.0.0.1.:9966

I read a post https://zhongpan.tech/2020/04/22/032-vscode-debug-connection-resused/ solves my problem.
create launch.json and change host from localhost to 127.0.0.1 may help

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "emmylua_new",
            "request": "launch",
            "name": "EmmyLua New Debug",
            "host": "127.0.0.1",
            "port": 9966,
            "ext": [
                ".lua",
                ".lua.txt",
                ".lua.bytes"
            ],
            "ideConnectDebugger": true
        }
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants