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

Breakpoints in modules are not working/triggering during debug session #2

Open
killerovsky opened this issue Sep 18, 2018 · 2 comments

Comments

@killerovsky
Copy link

killerovsky commented Sep 18, 2018

It looks like breakpoints are triggering only in main/launch Lua file, but all breakpoints set in the imported modules (via require("module")) are not triggering.
Is this a bug or I need some tweaks in lrdb-extension config and/or workspace config?

OS: macOS 10.12.6
Lua Debugger: internal (Emscripten)

@killerovsky
Copy link
Author

It looks like on macOS, "internal Lua" (Emscripten generated) interpreter can't correctly resolve module file names for breakpoints. It uses internally paths like "@./some-module.lua" for modules but LuaDebugSession (lrdbDebug.ts) sends breakpoints info with paths like "some-module.lua" which as a result maps into "@some-module.lua" in the interpreter.

Modification of LuaDebugSession.convertClientPathToDebugger() function from:

this.convertClientPathToDebugger = (clientPath) => {
            return path.relative(sourceRoot, clientPath);
};

to:

this.convertClientPathToDebugger = (clientPath) => {
            return './' + path.relative(sourceRoot, clientPath);
};

resolves the problem with breakpoint triggering on macOS.

@keithoconor
Copy link

keithoconor commented Dec 12, 2019

I'm having similar problems with both stepping into code in an imported module (via eg. require("libs.foobar")), and setting breakpoints. When I try to step into the code, it's apparent that the path isn't formatted correctly - it comes in as eg "c:/project/libs.foobar", when it should be "c:/project/libs/foobar.lua" in order for VSCode to load the right file. Otherwise it throws a 'file not found' error.

I've been able to work around this by adding the last line here:

this.convertDebuggerPathToClient = (debuggerPath) => {
            if (!debuggerPath.startsWith("@")) {
                return '';
            }
            debuggerPath = debuggerPath.replace(/\./g, "/") + ".lua"

This at least lets me step into imported modules. Is there some sort of setup I haven't done correctly to make imported modules work?

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

2 participants