microsoft / microsoft/MIEngine

'sourceFileMap' does not work if there are duplicate keys/values

Open
#1,066 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug VS Code
Dominant language
C#
Stars
859
Forks
233
Avg merge
1d 6h
Merged PRs (30d)
3

Description

We will incorrectly bind the breakpoint if there are duplicate editorPath keys since it will always pick up the first one if it is not unique.

Example launch.json:

"sourceFileMap": {
      "/project/Bcgir_task_build.latest_pass": { 
      "editorPath": "/project/test", 
      "useForBreakpoints": false
   },
      "/project/.Bcgir_task_build.latest_pass.sbsyncmaster": { 
      "editorPath": "/project/test", 
      "useForBreakpoints": false
   },
      "/project/.Bcgir_task_build.latest_pass.sbsyncmaster.inprogress": { 
      "editorPath": "/project/test", 
      "useForBreakpoints": false
   }
},

Example Setting Breakpoint:

<--   C (setBreakpoints-4): {"command":"setBreakpoints","arguments":{"source":{"name":"tGenAndKill.cpp","path":"/project/test/matlab/src/cgir_support/dom_core/analysis/livenessAnalysis/pkgtest/tGenAndKill.cpp"},"lines":[5],"breakpoints":[{"line":5}],"sourceModified":false},"type":"request","seq":4}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (6613) <-1013-break-insert -f /project/Bcgir_task_build.latest_pass/matlab/src/cgir_support/dom_core/analysis/livenessAnalysis/pkgtest/tGenAndKill.cpp:5\n"},"seq":504}
1: (6613) <-1013-break-insert -f /project/Bcgir_task_build.latest_pass/matlab/src/cgir_support/dom_core/analysis/livenessAnalysis/pkgtest/tGenAndKill.cpp:5
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (6649) ->&\"No source file named /project/Bcgir_task_build.latest_pass/matlab/src/cgir_support/dom_core/analysis/livenessAnalysis/pkgtest/tGenAndKill.cpp.\\n\"\n"},"seq":506}
1: (6649) ->&"No source file named /project/Bcgir_task_build.latest_pass/matlab/src/cgir_support/dom_core/analysis/livenessAnalysis/pkgtest/tGenAndKill.cpp.\n"

Related: https://github.com/microsoft/vscode-cpptools/issues/6381


Fix:
Validate that compileTimePath and sourcePath are unique.
https://github.com/microsoft/MIEngine/blob/728f403c563c2c50c46542e9b44271a7f8d5895b/src/MICore/LaunchOptions.cs#L372-L415

Contributor guide

No contributing guide indexed for this repository

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 in src/MICore/LaunchOptions.cs around lines 372-415, where sourceFileMap entries are processed. Trace how compileTimePath and sourcePath are handled for duplicate values, then validate that both are unique and confirm the breakpoint mapping no longer selects an ambiguous entry.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.