-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GDB Breakpoints are set in all files with same name #977
Comments
@pieandcakes Could you please elaborate on why this is considered a request for a feature? From my perspective, this looks like a bug, really. I have a project with a few hundred *.c files with the same name (they are mostly generated by another tool) and this makes it very hard to debug them because the debugger breaks at seemingly random places - additional to the line where I did set a breakpoint. |
@ZobyTwo When we send the bindings for the breakpoints we are currently only sending the filename. As such, it is "by design" even though it is unintended. There have been changes in |
@pieandcakes I see, thanks for the explanation. |
I've the same bug/lack of feature as I use cpptools to debug an ARM Processor with multiple cores. As each core gets it's own |
Is the bug has been resolved ? |
Seems to still be a problem (at least in 8.1-0ubuntu3). I tried to get round this by setting the full path name of the file but GDB doesn't like this either. I guess it is not using realpath internally to disambiguate files. |
Any ETA or roadmap on this? The breakpoint features seem frozen for so long - data breakpoints, log points. |
I have a possibly related issue based on the quote, the object file is built with |
I am having the same issue but with the vs debugger and it's quite annoying. We have a big repository and some files have the same name but in a different path. When I put a breakpoint in Folder1/Folder2/Util.cpp, all the Util.cpp will break regardless of their paths. This makes the debugger unusable. This is my launch.json {
"version": "0.2.0",
"configurations": [
{
"name": "Loader",
"type": "cppvsdbg",
"request": "launch",
"program": "c:/SomeExecutable.exe",
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"externalConsole": true,
}
]
} |
@psclkhoury It is on our list for current work planning. |
Any updates on this bug? |
Hello, I also have this problem under Ubuntu Server 18.04. I hope this will be fixed very soon as it's getting really annoying... |
Also got bitten by this on v1.0.1 |
3 years later still no fix? @pieandcakes Will you accept a PR for this or is it in the closed source part of the code? |
I think it's all open source by now. |
You can now specify breakpoints to use full path in v1.1.0 via Example:
|
@WardenGnaw Can you give a better example on how to use this? Do I have to do this for each breakpoint I set or what? What are I don't agree with the solution. By default I should be able to set a breakpoint and the full path should be sent to the debug engine without any extra action. This seems more like a workaround than a fix. |
For scenarios where you do not build on a different machine or move the source files before compiling, With the following, all breakpoints (except the first one the debug adapter uses to break at entry) will be fully qualified.
We decided not make this a default because there are projects that users have debug bits but do not have the source code. This would cause the breakpoint bind to fail. Here is the related code in the Debug Adapter: |
@WardenGnaw I tried:
I then tried to put the real path instead of
I think most users will never have to deal with that, so it do not understand why the default is chosen according to that very rare scenario. |
I can't follow. If you don't have the source code you can't set a breakpoint from the code editor, only manually via the breakpoints view and that user input should be passed on as-is. Anyway can't the debug adapter decide on its own if a full path is ok, like with File.Exists or whatever? |
@WardenGnaw Can we reopen this issue? The solution is not working for me. |
Why the solution is so badly described?
For reference this is my complete launch.json (sensitive data removed):
|
* Allow consoleCommand to exec while process run Added flag allowWhileRunning to consoleAsyncCmd since certain commands like 'version' do not require the process to be stopped in order to work
any updates? still reproducing |
I am unable to reproduce this issue in v1.8.4, as mentioned in #977 (comment), you need the following to enable breakpoints as full paths instead of just filename.
@amih90 Can you share your |
@WardenGnaw @sean-mcmanus I tried the suggested solution but it doesn't work for me. I also tried to enter the explicit I still don't understand why this is not fixed on the extension side by sending the full path to the debugger, instead of on the user side with us having to fiddle with our launch.json. It would be a much better and more robust solution. It got transformed to that after I started debugging: And of course the file was not found. This is my launch.json: "configurations": [
{
"name": "Start App",
"type": "cppvsdbg",
"request": "launch",
"cwd": "some/dir",
"program": "my/executable.exe",
"stopAtEntry": false,
"console": "newExternalWindow",
"requireExactSource": true,
"sourceFileMap": {
"${workspaceRoot}": {
"editorPath": "${workspaceRoot}",
"useForBreakpoints": true
}
}
},
] |
@psclkhoury I apologize since I did not read your initial message at #977 (comment) but only read your message starting at #977 (comment). I assumed that your issue was specifically for GDB not the vsdebugger. I have re-opened this issue for cppvdbg at #9054 |
I'm getting the same problems with the latest VSCode and native Windows debugger. |
It seems pretty strange that I can use the VS Code UI to set a breakpoint by clicking on a line number in a specific file and that has the effect of setting a breakpoint in a different file by default. I feel like a better experience would not require a multi-line json configuration to do the thing that 100% of users using this interface are trying to do. It also looks like I need to modify the setting of every configuration I have in my launch.json |
We have multiple projects, multiple libraries in multiple file repos. Having to list every single one in every entries in the launch.json is super-cumbersome. No single other IDE, development tools require such contortions just to properly set a breakpoint. As pointed out by someone else, the explanation why this is not the default behaviour makes no sense: if they don't have the source code, then they surely are not creating breakpoints in the editor! |
@WardenGnaw @pieandcakes can you guys at least respond and clarify why you don't want to fix it? |
totally agree. Hope to fix it , not a work around. |
still experiencing the issue. Makes debugging virtually impossible because the breakpoint in the other file with the same name is hit periodically and roughly 1000 times more often. How such a behavior that is obviously a bug can exist for over 6 years and not be fixed is a mystery to me. |
I agree, this reduces the effectiveness of an otherwise really good system - although the workaround is helpful. |
I am also getting this problem these days. It really took me some time to find out it's a bug from the editor. Hope it could be fixed to save time of other developers. Thank you. |
The SourceFileMap workaround does work though, so i'd recommend adding this to your config. |
This method is OK for a workspace with only one directory, but not for a workspace with multiple directories. For a workspace with multiple directories, this error will be reported:
I tried my best to follow the instructions and make the changes, but it didn't work. |
If I use an alternative to launch.json e.g. vscode-cmake-tool , is my debugger forever broken on files named the same thing? Pls no |
When setting a breakpoint in a file with a particular name, breakpoints are set in all files with that file name at the same line.
Environment
Win 10
VSCode 1.15 stable build
C/C++ 0.12.2
No other extension installed.
Gdb 7.6.1 is from mingw32
Gcc 5.3.0 is from mingw32
Reproduce
Create the following project layout:
That is, there are two
main.c
files. One directly insrc
:The other in
src/folder
:In both files, line 5 contains executable code.
Compile from within
src
:Add
launch.json
:Set breakpoint in
src/main.c
at line 5. Launch debugger, it breaks in main, hit continue and it will break in foo (which it should not).The above setup:
Breakpoints.zip
Settings
c_cpp_properties.json
is not in use and launch.json is given above.The text was updated successfully, but these errors were encountered: