microsoft / microsoft/vscode-cpptools

Breakpoints with multiple sourceFileMap mapping only works for the first mapping, not the second one

Open
#8,181 5 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

Bug type: Debugger

Describe the bug

  • OS and Version: Linux Ubunut 18.04
  • VS Code Version: 1.60.2
  • C/C++ Extension Version: v1.6.0
  • Other extensions you installed (and if the issue persists after disabling them): bazel , yes
  • A clear and concise description of what the bug is.

I am on a bazel build for a project with multiple workspaces

Therefore I need multiple entries in the sourceFileMap.

The problem is, all breakpoints in sources from the second source file mapping are disabled.
I can step through the code, and the corresponding code is opened in the editor,
but all breakpoints that are not in files from the first source file mapping become disabled/

To Reproduce
Please include a code sample and launch.json configuration.
Steps to reproduce the behavior:

Set a breakpoint in a file from the second mapping, it is ignored

Set a breakpoint in a file from the first mapping, it works

Remove the first mapping, files will not be found, but the breakpoint from the - now first but previously second - breakpoint work

    "version": "0.2.0",
    "configurations": [
        {
            "name": "some_bin",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/current_workspace/.bazel/what/ever/some_bin"
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "sourceFileMap": {
                // parent bazel workspace == ${workspaceFolder}
                "/proc/self/cwd/external/" : "/home/me/project/",            
               "/proc/self/cwd/" : "/home/me/project/current_workspace/" ,
            }
        }

Interestingly, when I set stopAtEntry to true, the main function is stopped, (a file from the second mapping) but all breakpoints int this file are grey out

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 issue with the provided launch.json configuration and its two sourceFileMap entries under the C++ debugger. Check breakpoint behavior for files in each mapping, including with stopAtEntry enabled. Done means breakpoints in files from the second mapping remain enabled and are hit like those from the first mapping.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
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.