microsoft / microsoft/vscode-cpptools

Not able to setup environment variables before the debugger is launched

Open
#10,618 5 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug debugger
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and version: Kubuntu / linux 5.15.0-52-generic
  • VS Code: 1.75.0
  • C/C++ extension: 1.14.4
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version:
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:

  1. I'm trying to run the launch gdb that needs some environment variables to be set.
  2. Try to add the envFile, environment field or any other approach.
  3. Launch the debugger
  4. See that the gdb debugger fails because variables are not set.

Could you help me with this issue?
Thanks

Debugger Configurations
{
          "name": "Launch debug (GDB)",
          "type": "cppdbg",
          "request": "launch",
          "miDebuggerPath": "/path/to/ntoaarch64-gdb",
          "program": "/path/to/binary",
          "stopAtEntry": false,
          "cwd": "${workspaceFolder}",
          "miDebuggerServerAddress": "(ip):(port)",
          "externalConsole": true,
          "MIMode": "gdb",
          "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
          ],
          "envFile": "${workspaceFolder}/.env",
          "environment": [
              {
                "name":"ENVVAR",
                "value": "/some/path/"
              }
           ]
        }
Debugger Logs
¡QNX environment is not set!
Other Extensions

I'm using the extensions for C/C++.

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the launch configuration with miDebuggerPath set to ntoaarch64-gdb and the environment and envFile fields populated. Check the debugger launch behavior using the supplied QNX environment script and the “QNX environment is not set!” log. Done means the required variables are available before the custom GDB process starts, or the issue is documented as unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.