Showstopper fix for IZ 149603 (Debugger confuses source files with the same name )

Gordon Prieur <[email protected]>
Newsgroups gmane.comp.java.netbeans.reviewers
Message-ID <[email protected]>
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)
   This fix is a more conservative fix than the one pushed to main. Its 
a revert to
    to the NB61 behavior (although not quite the same code). I won't have a
    public changeset until I push it to release65. Instead, I'm 
attaching the patch I
    sent out for review and QA testing. By the time  you see this 
though, it will
    probably have been pushed.
patch2 (text/plain, 2 KB)
changeset:   105993:0a02e8d23ea0
tag:         tip
user:        Gordon Prieur <[email protected]>
date:        Fri Oct 31 09:00:55 2008 -0700
summary:     A more conservative fix to IZ #149603.

diff -r 4aee68aeaf74 -r 0a02e8d23ea0 cnd.debugger.gdb/src/org/netbeans/modules/cnd/debugger/gdb/GdbDebugger.java
--- a/cnd.debugger.gdb/src/org/netbeans/modules/cnd/debugger/gdb/GdbDebugger.java	Fri Oct 31 13:47:19 2008 +0100
+++ b/cnd.debugger.gdb/src/org/netbeans/modules/cnd/debugger/gdb/GdbDebugger.java	Fri Oct 31 09:00:55 2008 -0700
@@ -168,6 +168,7 @@
     private String state = STATE_NONE;
     private final PropertyChangeSupport pcs;
     private String runDirectory;
+    private String baseDir;
     private final ArrayList<CallStackFrame> callstack = new ArrayList<CallStackFrame>();
     private final GdbEngineProvider gdbEngineProvider;
     private CallStackFrame currentCallStackFrame;
@@ -252,6 +253,7 @@
                 iotab.setErrSeparated(false);
             }
             runDirectory = pathMap.getRemotePath(pae.getProfile().getRunDirectory().replace("\\", "/") + "/");  // NOI18N
+            baseDir = pae.getConfiguration().getBaseDir().replace("\\", "/");  // NOI18N
             profile = (GdbProfile) pae.getConfiguration().getAuxObject(GdbProfile.GDB_PROFILE_ID);
             conType = hkey.equals(CompilerSetManager.LOCALHOST) ?
                 pae.getProfile().getConsoleType().getValue() : RunProfile.CONSOLE_TYPE_OUTPUT_WINDOW;
@@ -2392,8 +2394,10 @@
      */
     public String getBestPath(String path) {
         path = pathMap.getRemotePath(path);
-        if (path.startsWith(runDirectory)) {
-            return (path.substring(runDirectory.length()));
+        if (path.indexOf(' ') == -1 && platform != PlatformTypes.PLATFORM_MACOSX) {
+            return path;
+        } else if (path.startsWith(baseDir + '/')) {
+            return path.substring(baseDir.length() + 1);
         } else {
             int pos = path.lastIndexOf('/');
             if (pos != -1) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.