microsoft / microsoft/vscode-cpptools

Debugger is not going into the right directory, failing to start the program

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

Nobody has claimed this yet.

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

Description

Environment

Version: 1.73.1
Commit: 6261075646f055b99068d3688932416f2346dd3b
Date: 2022-11-09T03:54:53.913Z
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Linux x64 5.19.0-kali2-amd64
Sandboxed: No

Bug Summary and Steps to Reproduce

So I have my PROJECT_DIR, and directory bin_dir for binaries, and all the files it needs are there too, but debugger fails to go into that directory.

Output:
`[Done] exited with code=0 in 5.045 seconds

[Running] cd "/home/bane/Desktop/TESTC/ariadne/" && gcc ariadne.c -o ariadne && "/home/bane/Desktop/TESTC/ariadne/"ariadne
[*] CURRENT WORKING DIRECTORY: /home/bane/Desktop/TESTC/ariadne
Can't open the file test.txt
`

Debugger Configurations
{
    "configurations": [
        {
            "name": "gcc buildndbg",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}/bin_dir",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "gcc build c11",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ],
    "version": "2.0.0"
}

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "gcc build c11",
            "command": "/usr/bin/gcc",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "-W",
                "-Wall",
                "-std=c11",
                "${file}",
                "-obin_dir/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}
Debugger Logs
Not needed
Other Extensions

A lot

Additional Information

I have no idea how to deal with that %#%@#

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 with the debugger and task configurations shown in the issue, focusing on the cwd, program, build output path, and task working directory. Reproduce the launch on Linux with the provided settings and verify that the built program starts from bin_dir and can open test.txt there.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.