Open Ampaex opened 1 year ago
I have also been struggling with this trying to make my ~/.gdbinit
work.
I observed that the MI debugger is started with the current working directory set to the directory containing the MI debugger executable (so the CWD would be /path/to/
for "miDebuggerPath": "/path/to/ntoaarch64-gdb"
), and with the original environment variables. The values from "cwd"
and "environment
" are only applied later, after ~/.gdbinit
has been executed.
Please, any help with this? Could you indicate us how to add environment variables before the call of the debugger placed in "miDebuggerPath"?
If the required environment variables do not depend on your VScode workspace then you could create an adapter script that would set the variables and call GDB, passing through to it all the command-line arguments. Untested example:
"miDebuggerPath": "/path/to/ntoaarch64-gdb-vscode"
/path/to/ntoaarch64-gdb-vscode
:
#!/usr/bin/env sh
export NAME=VALUE
exec ntoaarch64-gdb "$@"
Yes, could be an option, but in my case is not so useful because has to be run in multiple machines. I not a good idea to be modifying the installation on each of them
Right, the location of the script doesn't really matter, it may (and probably should) be versioned within the workspace. I'd then just make sure to change the current working directory to /path/to/
before calling ntoaarch64-gdb
, just like VSCode does.
Environment
Bug Summary and Steps to Reproduce
Bug Summary: I'm trying to run a custom gdb(qnx neutrino - ntoaarch64-gdb), but for that, I need to set up some environment variables before. I've tried to use the "environment" field, the "envFile" approach, using "terminal.integrated.env.linux", doing a "preLaunchTask" and many other things but I'm not able to set them before the call of the binary. Every try results in gdb being executed without the environment variables. I currently have an environment script(.sh) for setting up all the variables.
Steps to reproduce:
Could you help me with this issue? Thanks
Debugger Configurations
Debugger Logs
Other Extensions
I'm using the extensions for C/C++.
Additional Information
No response