question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[VSCode] Implement UseForBreakpoints for sourceFileMap with the C++ extension

See original GitHub issue

This is kind of two issues… The first is that when using GDB and setting a breakpoint on a file which has the same name as another file it will set the breakpoint on the wrong one. For example: a/file.cpp b/file.cpp set breakpoint on b/file.cpp and it gets set on a/file.cpp (2854) <-1272-break-insert -f file.cpp:123 This still seems like the open issue https://github.com/Microsoft/MIEngine/issues/147

That issue mentions that a sourceFileMap might fix this and looking at MapCurrentSrcToCompileTimeSrc it seems like it should but you need to enable the undocumented “useForBreakpoints” flag.

Looking at the format defined in https://github.com/Microsoft/MIEngine/blob/master/src/MIDebugPackage/OpenFolderSchema.json It seems like I should just need to add: "sourceFileMap": { "/compiler/path": { "editorPath": "/editor/path", "useForBreakpoints": true } },

But I now get the error: ERROR: Configuration for 'sourceFileMap' has a format error and will be ignored. Exception: Error reading string. Unexpected token: StartObject. Path '/compiler/path'.

Looking at SetCommonDebugSettings it looks like it’s only parsing it as a string, not an object.

Is there any other fix/workaround to get debugging working with the same file names with GDB?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
pieandcakescommented, Jul 22, 2019

@RYDB3RG The reason that was done is to support paths that don’t exactly match. The work needs to be done in OpenDebugAD7 to support the useForBreakpoints or forward the entire json blob to MIEngine (where you referenced the code above) so that the json parser there handles the setting.

0reactions
RYDB3RGcommented, Jul 20, 2019

@pieandcakes I was wondering if removing this line would help: https://github.com/microsoft/MIEngine/blob/3e998f58181d99315c85498cac483ee800e38ac6/src/MIDebugEngine/Engine.Impl/Breakpoints.cs#L117

I think its the reason that a fully qualified name becomes its basename and thus leads to multiple breakpoints

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure launch.json for C/C++ debugging in ...
This allows mapping of the compile-time paths for source to local source locations. It is an object of key/value pairs and will resolve...
Read more >
Debug C++ in Visual Studio Code
The C/C++ extension for VS Code has the ability to debug multi-threaded programs. All threads and their call stacks appear in the Call...
Read more >
C/C++ extension FAQ
Frequently asked questions about the C/C++ extension in Visual Studio Code. ... Use the C/C++: Change Configuration Provider... command to enable any such ......
Read more >
Configuring C# debugging
The extension tries to resolve targetArchitecture based on the output of dotnet --info in the PATH, else it tries to use the same...
Read more >
C++ programming with Visual Studio Code
Install the extension · Open VS Code. · Select the Extensions view icon on the Activity bar or use the keyboard shortcut (Ctrl+Shift+X)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found