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

GDB's working directory doesn't match launch location #16

Closed
AE1020 opened this issue Oct 14, 2021 · 2 comments
Closed

GDB's working directory doesn't match launch location #16

AE1020 opened this issue Oct 14, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@AE1020
Copy link

AE1020 commented Oct 14, 2021

I noticed this at first when I set did set logging on in the startup commands, and found gdb.txt in the directory vscode was launched from... not alongside the executable.

I tried hardcoding a cd command into the generation of the gdb launch, here:

return `bash -c "${this.createEnvironmentVariablesSetterCommand()} trap '' 2 ; ${

So just doing cd /path/to/debuggee/ ; at the beginning of the executed string, before the $.

When I did that, it not only put gdb.txt in a better place, but made other things work that weren't. I'd been getting messages from gdb of "No source file named..." on paths that did exist. But it turns out that message really means "Couldn't find symbols for file named...". By launching gdb in the directory where the output executable was (instead of where vscode was launched) these errors went away.

After doing this I was able to debug chromium built from source. And vgdb does not seem to have problems watching Blink::Node variables (which causes vscode-cpptools to hang),

@penagos
Copy link
Owner

penagos commented Oct 19, 2021

If you have a patch for this I'd be more than happy to merge it into the master branch and queue it for the next bug fix release.

@penagos penagos added the bug Something isn't working label Oct 19, 2021
@AE1020
Copy link
Author

AE1020 commented Oct 20, 2021

All I did was hardcode a cd to the directory I was working with at the head of the invocation.

Doing it correctly you'd have to decide where to get this directory:

  • the directory of the executable being debugged?
  • the cwd property from the launch.json file?
  • some independent overridable property?

Then there is the question of defaulting (if there's no cwd, then should it fall back to the executable's directory?)

@penagos penagos closed this as completed in 4c17814 Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants