Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Breakpoints not firing due to path mismatch #385

Closed
arciisine opened this issue Dec 29, 2018 · 5 comments
Closed

Breakpoints not firing due to path mismatch #385

arciisine opened this issue Dec 29, 2018 · 5 comments
Assignees
Labels

Comments

@arciisine
Copy link

Currently I have an issue (since Node 10.12, which seems to be a change in node regarding file urls and source maps).

It appears that the function SourceMapUtils.getComputedSourceRoot is failing to produce a valid root, and so the files are all being listed as relative to the application root. This results in none of the source maps being found, and breakpoints being missed.

Defaulting the computed source root to the generated file's directory seems to solve this, but I have a feeling this isn't the right fix for the issue.

A few related issues:
microsoft/vscode#61711
nodejs/node#23693

@roblourens
Copy link
Member

Thanks for the PR, I'm not sure whether that's right or not either. Can you tell me more about what the problem actually is? A reproducible case, or set "trace": true in your launch config, run it again, and upload the log from the debug console here.

@arciisine
Copy link
Author

I'll upload a trace file later (that's actually how I debugged this issue). The issue for me, is that without this change, breakpoints won't stop in my typescript files. If I add the debugger keyword to my code, it will trigger a breakpoint but only in the javascript code.

@arciisine
Copy link
Author

arciisine commented Jan 1, 2019

I'm attaching my debugadapter.txt. debugadapter.txt

A snippet of interest:

[16:11:03.652 UTC] SourceMaps.getMapForGeneratedPath: Using inlined sourcemap in file:///Users/tim/Code/travetto/module/di/test/util.js
[16:11:03.652 UTC] SourceMap: creating for file:///Users/tim/Code/travetto/module/di/test/util.js
[16:11:03.652 UTC] SourceMap: sourceRoot:
[16:11:03.652 UTC] SourceMap: sources: ["util.ts"]
[16:11:03.652 UTC] SourceMap: no sourceRoot specified, using webRoot + script path dirname:
[16:11:03.653 UTC] SourceMaps.scriptParsed: file:///Users/tim/Code/travetto/module/di/test/util.js was just loaded and has mapped sources: ["/Users/tim/Code/travetto/module/di/util.ts"]

As you can see the file di/test/util is being mapped to di/util, and this is breaking debugging. The PR I provided seems to resolve this issues, but I'm not sure what the root cause is.

@roblourens
Copy link
Member

I see it, thanks!

@roblourens
Copy link
Member

Note to self, this is the case when the script is not resolved to a path on disk. Even though that .js doesn't exist at that location, if it's a file URI, we should still attempt to use that info to resolve paths in the sourcemap.

@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants