-
Notifications
You must be signed in to change notification settings - Fork 244
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
add sourceFileMap
setting for conversion of paths between ide and gdb
#611
Comments
The issue is that the ide through DAP sends requests, at least the following:
When the ide and the running debugger doesn't have the sources on the same place then there needs to be a mapping - for example in a WSL case X:\projects\cortex\app vs. /home/me/app - GDB won't understand the former when send from the IDE and path substitutions or source paths don't apply to that, so the dap-implementation needs to provide the mapping before sending the paths to GDB. Similar GDB sends paths back, especially:
In this case there needs to be a reverse mapping. The start of a solution was merged upstream, it may be a useful start - or at least showcase for the principles (note: this isn't 100% finished yet and has at least one bug in that slipped in with Win32 support); and I'd say the "target" is likely always posix, so it can be simplified, too. WebFreak001/code-debug@ecb2da4 |
Here is my workaround for now, add it into "preAttachCommands": [
"set substitute-path /path/during/build /path/for/debuging",
], You can also use |
Thanks for the note, but as previously said;
If you use GDB on the same machine where the sources reside and the sources in the IDE are in the same place (either because the machine is identical, which isn't necessary the case with |
@saloid Thanks for |
I'm debugging with Andes toolchains based on Cygwin. While hitting breakpoint vscode opens an editor path to "/cygdrive/c/..." and shows "cannot find this file". Command Here is the launch and screenshot:
I found the gdb breaks at the right location I have tried with cpptools, the Is there any update? @haneefdm |
This may be useful for both the WSL scenario and for
external
debugging where the source path on the client (vscode) is not the same as the debugger (gdbserver, possibly running on wsl) sees:I suggest to add a
sourceFileMap
setting. This would need to applied anywhere the client passes paths (breakpoints, "go to cursor") and when the client receives paths (I guess that's the stack only).Originally posted by @GitMensch in #467 (comment)
People are using their own gdb-init scripts to [do path substitutions] - No help from extension needed.
The bigger problem is how breakpoints are set and how stack traces are interpreted. Disassembly is affected as well.. How we look for static variables is also affected -- as in we have to implement what gdb does. VSCode manages breakpoints with paths (file/line) that it sees. It wasn't clear to me how gdb handled file/line breakpoints and if clients (us) have to do the reverse mapping. [..m]
cpptools/cppdbg added support for source maps. We can check to see what all they do with that info.
Originally posted by @haneefdm in #467 (comment)
The text was updated successfully, but these errors were encountered: