Search code examples
visual-studio-codegccgdb

File compiled in a container with debug option and specific filesystem cannot be debug


I am compiling a C project with a container using gcc and specific toolchain. I mount my project locally under /opt/git/myProject to the home directory of my container and then I compile it /home/user/myProject.

When I debug using vscode, it tries to open a c file under the home directory of my localhost.

Is it possible to tell to gdb (or vscode) that in fact my source file linked to the bin being debugged is under /opt/git/myProject ?


Solution

  • Is it possible to tell to gdb

    Yes: see documentation on how to do that.

    I suspect that using set substitute-path /home/user/myProject /opt/git/myProject is what you want.