-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
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:
src
|- main.c
|- folder
|- main.c
That is, there are two main.c files. One directly in src:
int foo();
int main(int argc, char *argv[])
{
int a = 0;
a += 3;
a *= 4;
foo();
return 0;
}The other in src/folder:
int foo()
{
int b = 14;
int d = 13;
b += d - b * d;
return b + d;
}In both files, line 5 contains executable code.
Compile from within src:
gcc main.c folder/main.c -g -O0 -o a.exeAdd launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/src/a.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}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:
Settings
"debug.allowBreakpointsEverywhere": truec_cpp_properties.json is not in use and launch.json is given above.
tobiaskohlbau, psclkhoury, fpanjevic, gabeluci, patlefort and 10 moreTrass3r