microsoft / vscode-dwarf-debugging-ext

Enhanced WebAssembly debugging in VS Code
MIT License
13 stars 2 forks source link

Path substitutions? #7

Open fraguada opened 2 months ago

fraguada commented 2 months ago

In the Chrome Dev tools extension I can use Path substitutions to map from the prefix in the wasm file to where the actual source files are on my hard drive. this works great in the Chrome extension. I can build locally or on our automated runners and map the wasm to the source files.

Does such a feature exist with the vs code extension?

trzeciak commented 2 weeks ago

I would like that too.

I tried with sourceMapPathOverrides settings in launch configuration, but without any successed.

I compile my C++ code with flag: "-fdebug-compilation-dir=/root" (It is required, because my build system is a bazel with sandboxing), and I want to map /root to "${workspaceFolder}".

cc: @connor4312

connor4312 commented 1 week ago

sourceMapPathOverrides should work but I admit it's been a moment since I tested it with DWARF stuff.

Can you add trace: true to your launch.json config and share the log file (location written to the Debug Console) here or to connor [at] xbox.com? Thanks!

trzeciak commented 1 week ago

Hey, I wasn't sure if this project was alive xD, but now that I know! I'll try to prepare a working (or rather not working xD) example that should be easy to reproduce locally, I'll do my best to prepare it this weekend.

trzeciak commented 6 days ago

Finally.. xD I prepared small example: https://github.com/trzeciak/vscode-debugging-webapp-wasm

Motivation: In the target project I'm working on, we use Bazel with the sandboxing to build C++, so for debugging symbols to be useful we need to set the option -fdebug-compilation-dir=<some-root-pach> in clang (or equivalent option). On the other hand, we build builds on CI, so we chose a common root folder, e.g.: /ciroot. Let me know if you can repeat this in the prepared example, if not I will send my logs. BTW: I working on macOS.

If I using C/C++ DevTools Support (DWARF) in google chrome, and setup Path substitutions in extension-options, the breakpoints in tevtools works correctly with /ciroot path.