This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 149603 - Debugger confuses source files with the same name
Summary: Debugger confuses source files with the same name
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: _ gordonp
URL:
Keywords:
: 149245 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-10-09 10:52 UTC by Alexander Pepin
Modified: 2017-05-11 15:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
gdb log (5.44 KB, text/plain)
2008-10-09 10:53 UTC, Alexander Pepin
Details
new patch proposed by Gordon (2.01 KB, text/plain)
2008-10-31 18:16 UTC, Egor Ushakov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pepin 2008-10-09 10:52:31 UTC
Steps to reproduce:
- create two sample projects e.g. Arguments_1 and Arguments_2
- set a line BP in the args.c in the first project
- start debugging the second project
Result: Debugger stops in args.c in the second project in the same line where breakpoint was set in the first project.
BP annotation is not displayed in the second file and 'Go To Source' works correctly.
Comment 1 Alexander Pepin 2008-10-09 10:53:13 UTC
Created attachment 71446 [details]
gdb log
Comment 2 _ gordonp 2008-10-09 18:05:26 UTC
Suggested fix (post NB65):

In LineBreakpointImpl.getBreakpointCommand(), return getBreakpoint().getPath() for the 1st validation
attempt if there are no embedded spaces in the path. The 2nd attempt (assuming the fix to 149214 gets
approved and integrated) should generate a path with the project base directory removed. The last
attempt should have all directory information removed.

The above assumes BreakpointImpl.completeValidation() will make subsequent validation attempts after
certain types of validation failure. The fix for 149214 provided this capability, although NB.next
should also try alternate source directories provided by the user (which the project system currently
silently ignores when the user adds them:-).
Comment 3 Alexander Pepin 2008-10-09 20:52:20 UTC
It's a very serious regression and should be fixed in 6.5
Comment 4 Alexander Pepin 2008-10-09 20:56:47 UTC
*** Issue 149245 has been marked as a duplicate of this issue. ***
Comment 5 Alexander Pepin 2008-10-29 18:18:00 UTC
Verified in trunk build 200810290201.
Comment 6 _ gordonp 2008-10-29 18:41:46 UTC
This was partially fixed in http://elif.russia.sun.com/hg/release65_cnd_freeze/rev/ac0e764c9a2a
but not pushed to the trunk before code freeze. The release65_cnd_freeze changes and further
changes, were pushed to the trunk with http://hg.netbeans.org/main?cmd=changeset;node=79fff0b61390.

The current fix attempts to send an absolute path to gdb in the -break-insert command. If
the absolute path contains embedded spaces, then a partial path is sent. This is because
gdb/mi doesn't correctly handle quoting (a fix is planned in mi3). I've filed IZ #151761
about this corner case and am closing this issue as fixed in trunk.
Comment 7 _ gordonp 2008-10-29 18:42:38 UTC
Reopening for release65 (it got closed when I marked it FIXED in trunk).
Comment 8 Alexander Pepin 2008-10-30 16:46:52 UTC
I confirm that it works fine in NB6.1, so we have a regression.
Comment 9 Egor Ushakov 2008-10-31 10:19:19 UTC
I disagree with the proposed fix.
Problems with spaces in the project path should be solved in a separate issue.
Comment 10 Egor Ushakov 2008-10-31 18:16:52 UTC
Created attachment 73011 [details]
new patch proposed by Gordon
Comment 11 Egor Ushakov 2008-10-31 18:18:49 UTC
I agree and approve this fix
Comment 12 _ gordonp 2008-10-31 20:29:50 UTC
Description of the bug (including IZ #):
   IZ #149603 Debugger confuses source files with the same name

Impact assessment i.e. why it is a showstopper?
  This bug  is a showstopper because it causes breakpoints  from one project to  cause
   the debugger to stop in another project if the file name (not path) is the same.

Risk assessment i.e. why is it safe?
  The proposed fix basically restores us to the functionality we had in NB 6.1.

Confirmation of peer code review and QE verification of fix
  Reviewed by Egor Ushakov

Changeset info (for reviewing diffs)
    http://hg.netbeans.org/release65?cmd=changeset;node=0a02e8d23ea0

Comment 13 soldatov 2008-11-01 10:11:25 UTC
verified in a preliminary FCS build
Comment 14 elecharny 2017-05-11 15:02:50 UTC
I still have the exact same problem with Netbeans 8.2. I'm debugging a project, setting a BP in a file named passwd.c, but when jumping in the function called, which belongs to this file, the debugger opens another file named passwd.c which is in another part of the project (I have 3 different path with such a file).

The only workaround I have found was to rename the file, which is really painful, considering this is a 20 years old Open Source project that is unlikely to accept such a rename...