From 08ab887f65d777f04c33225a6b2430dafeeb3316 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Fri, 6 Jun 2003 19:55:13 +0000 Subject: [PATCH] Correct presentation of the full names of variables that contain pointers. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 4 +++ .../debug/internal/core/model/CVariable.java | 28 +++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 0b168f33963..795e7493879 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,7 @@ +2003-06-06 Mikhail Khodjaiants + Correct presentation of the full names of variables that contain pointers. + * CVariable.java + 2003-06-06 Mikhail Khodjaiants Changed the implementation of the'getName' method of CVariable to return the actual names of array members. diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java index a1da77c89e2..ae27330e135 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java @@ -358,6 +358,7 @@ public abstract class CVariable extends CDebugElement if ( fName == null ) { String cdiName = ( getOriginalCDIVariable() != null ) ? getOriginalCDIVariable().getName() : null; + fName = cdiName; if ( cdiName != null && getParent() instanceof ICValue ) { CVariable parent = getParentVariable(); @@ -370,10 +371,6 @@ public abstract class CVariable extends CDebugElement fName = parent.getName() + '[' + cdiName + ']'; } } - else - { - fName = cdiName; - } } return fName; } @@ -796,8 +793,27 @@ public abstract class CVariable extends CDebugElement { sb.insert( 0, '(' ); if ( i > 0 ) - sb.append( ( vars[i - 1].isPointer() ) ? "->" : "." ); - sb.append( vars[i].getName() ); + { + if ( vars[i - 1].isPointer() ) + { + if ( vars[i].getName().charAt( 0 ) == '*' && vars[i-1].getName().equals( vars[i].getName().substring( 1 ) ) ) + { + sb.insert( 0, '*' ); + } + else + { + sb.append( "->" ); + sb.append( vars[i].getName() ); + } + } + else + { + sb.append( '.' ); + sb.append( vars[i].getName() ); + } + } + else + sb.append( vars[i].getName() ); sb.append( ')' ); } return sb.toString();