Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 157220

Summary: duplicate source filenames break breakpoint behavior
Product: [Tools] CDT Reporter: Doug Crawford <dcraw101>
Component: cdt-debugAssignee: cdt-debug-inbox <cdt-debug-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: elaskavaia.cdt, jamesblackburn+eclipse, rogernelson45687
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Doug Crawford CLA 2006-09-13 15:43:45 EDT
If I have 2 source files with the same name but in different directories, the error parser does not highlight gcc compiler errors.  Also, If I set a breakpoint in one of the files and run the debugger the breakpoint might show up at some random location in the other file that has the same name (I think it depends on which file is found first when searching the directory tree).  Note this is not a problem with gdb since there it is using the full source path.  Here is the output from my compiler which should generate a compiler error marker but doesn't:
make -k all 
g++  -g -I common/core -I common/database  -c -o 'bin/cygwin-debug/common/database/data.o' 'common/database/data.cpp'
common/database/data.cpp: In function `int dodata()':
common/database/data.cpp:8: error: expected `;' before "return"
make: *** [bin/cygwin-debug/common/database/data.o] Error 1
make: Target `all' not remade because of errors.

I am using cygwin with a standard make project and the Calisto release of Eclipse/CDT.
Comment 1 Doug Schaefer CLA 2006-09-13 17:06:20 EDT
These are two separate problems. The error parser problem is fixed in CDT 3.1.1. The breakpoint problem is different and I'll leave this bug open to address that.
Comment 2 Doug Crawford CLA 2006-09-13 18:23:13 EDT
With the breakpoint issue, I mentioned that the debugger might stop in the wrong file at some random location.  That is not exactly what is happening.  Lets say I have file1 and file2 with the same name but in different directories.  Assume I set a breakpoint at line 16 in file1.  If I start the debugger and a function in file2 is called before anything in file1 then the debugger will stop in file2 at line 16 (even though I never defined any breakpoints in file2).  Then when the program exits I now see that both file1 and file2 have blue breakpoint markers at line 16.
Comment 3 Nobody - feel free to take it CLA 2006-09-14 04:19:04 EDT
Unfortunately, this is a bug in gdb. If there are two files with the same name in the project gdb always sets a breakpoint at the file it finds for the first time.
BTW, blue marker means that you tried to set a breakpoint on a running session. But if the breakpoint is set succesfully the marker has a little check mark on it.
Comment 4 Igor Karatayev CLA 2007-02-19 06:54:30 EST
This is not gdb bug.
If for ex. we have to source files:
file.cpp
other/file.cpp
breakpoint in other/file.cpp can be set by 'break other/file.cpp:5'
Comment 5 Elena Laskavaia CLA 2008-07-11 14:38:32 EDT
There is no programmatic way to fix breakpoint for files with the basename,
but we implemented special option that allows to fix it in some cases.
Debug tab of Launch config has an option "Use full file name to set breakpoints".
If you enable it will use distinct name.
For that to work debug info should have full names name and source paths should be the same as IDE sees it.
Comment 6 Roger Nelson CLA 2019-01-22 06:18:22 EST
Find and delete duplicate files in seconds with Easy Duplicate Finder.

Speed up your computer and free up disk space by deleting duplicate files. You can recover gigabytes of space, make your computer faster, and organize your files. Oct an instant scan and find all the duplicates on your PC or Mac.

Easy Duplicate Finderâ„¢ is a powerful tool to find and remove duplicate photos, documents, MP3s, videos, and more. It makes deleting duplicate files easy and fun.
Comment 7 Roger Nelson CLA 2019-01-22 06:19:26 EST
(In reply to Doug Schaefer from comment #1)
> These are two separate problems. The error parser problem is fixed in CDT
> 3.1.1. The breakpoint problem is different and I'll leave this bug open to
> address that.

Find and delete duplicate files in seconds with Easy Duplicate Finder.

Speed up your computer and free up disk space by deleting duplicate files. You can recover gigabytes of space, make your computer faster, and organize your files. Oct an instant scan and find all the duplicates on your PC or Mac.

Easy Duplicate Finderâ„¢ is a powerful tool to find and remove duplicate photos, documents, MP3s, videos, and more. It makes deleting duplicate files easy and fun.