microsoft / microsoft/vscode-cpptools

Source mapping not working if a folder inside the project root is given

Open
#13,242 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Environment
  • OS and version: Windows 111
  • VS Code: 1.96.4
  • C/C++ extension:1.23.4
  • GDB / LLDB version:13.2
Bug Summary and Steps to Reproduce

Bug Summary:
SourceMapping is not working if I tried to map a folder inside the project root directory.

Ie: : is working but /src:/src is not working.

Steps to reproduce:

  1. I've used a C/C++ project built using eclipse. I build it inside a folder and moved the entire folder to another location.
  2. Created a launch configuration for qemu using the relocated project and it's elf
  3. Mapped source till /src folder and debug
  4. I got The editor could not be opened because the file was not found in the editor. I was expecting the editor opens the mapped source file.

engine_debug_log.txt

Debugger Configurations
{
    "configurations": [
        {
           "logging": { "engineLogging": true, "trace": true, "traceResponse": true },
            "name": "test-qemu",
            "type": "cppdbg",
            "request": "launch",
            "program": "c:\\Users\\Ashling\\AppData\\Local\\Ashling\\qemu32_baremetal\\Debug\\qemu32_baremetal.elf",
            "args": [],
            "stopAtConnect": true,
            "stopAtEntry": true,
            "cwd": "c:\\Users\\Ashling\\AppData\\Local\\Ashling\\qemu32_baremetal",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "riscv32-unknown-elf-gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set RISC-V architecture",
                    "text": "set arch riscv:rv32",
                    "ignoreFailures": true
                },
                {
                    "description": "Set remote timeout",
                    "text": "set remotetimeout 250",
                    "ignoreFailures": true
                },
                {
                    "description": "Disable thread event printing",
                    "text": "set print thread-events off",
                    "ignoreFailures": true
                }
            ],
            "postRemoteConnectCommands": [
                {
                    "description": "Remove the default `break -f main` inserted by cppdbg (github issue: vscode-cpptools#8011)",
                    "text": "delete 1",
                    "ignoreFailures": true
                },
                {
                    "description": "Load command",
                    "text": "load",
                    "ignoreFailures": true
                }
            ],
            "miDebuggerServerAddress": "localhost:1234",
            "serverLaunchTimeout": 5000,
            "debugServerArgs": "--gdb tcp::1234 --machine virt --nographic -S --bios none -d cpu_reset",
            "debugServerPath": "qemu-system-riscv32.exe",
            "filterStderr": true,
            "hardwareBreakpoints": {
                "require": false,
                "limit": 4
            },
            "symbolLoadInfo": {
                "loadAll": true,
                "exceptionList": ""
            },
            "sourceFileMap": {
                "C:\\workspace_ms\\qemu32_baremetal\\qemu32_baremetal\\src": "c:\\Users\\Ashling\\AppData\\Local\\Ashling\\qemu32_baremetal\\src"
            }
        }
    ]
}
Debugger Logs
Attached in the issue.
Other Extensions

No response

Additional Information

If I map without /src folder, it's working.

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 Windows debugging scenario with the provided launch configuration and its nested sourceFileMap entry. Review the attached engine_debug_log.txt while comparing the working project-root mapping with the failing /src mapping; done means the editor opens the relocated source file when the nested mapping is used.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.