Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 62956 Details for
Bug 180975
Cannot explore value of "string" C++ variable - variable view clears up
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch for MI for cdt_3_1 branch
patchMIIncTypeStringCpp.txt (text/plain), 7.89 KB, created by
Elena Laskavaia
on 2007-04-04 12:43:28 EDT
(
hide
)
Description:
Patch for MI for cdt_3_1 branch
Filename:
MIME Type:
Creator:
Elena Laskavaia
Created:
2007-04-04 12:43:28 EDT
Size:
7.89 KB
patch
obsolete
>Index: cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java,v >retrieving revision 1.21 >diff -u -r1.21 Variable.java >--- cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java 29 Nov 2005 19:46:09 -0000 1.21 >+++ cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java 4 Apr 2007 16:42:59 -0000 >@@ -17,6 +17,7 @@ > import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType; > import org.eclipse.cdt.debug.core.cdi.model.type.ICDIBoolType; > import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharType; >+import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType; > import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDoubleType; > import org.eclipse.cdt.debug.core.cdi.model.type.ICDIEnumType; > import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatType; >@@ -48,6 +49,7 @@ > import org.eclipse.cdt.debug.mi.core.cdi.model.type.EnumValue; > import org.eclipse.cdt.debug.mi.core.cdi.model.type.FloatValue; > import org.eclipse.cdt.debug.mi.core.cdi.model.type.FunctionValue; >+import org.eclipse.cdt.debug.mi.core.cdi.model.type.IncompleteType; > import org.eclipse.cdt.debug.mi.core.cdi.model.type.IntValue; > import org.eclipse.cdt.debug.mi.core.cdi.model.type.LongLongValue; > import org.eclipse.cdt.debug.mi.core.cdi.model.type.LongValue; >@@ -223,82 +225,65 @@ > } > MIVar[] vars = info.getMIVars(); > children = new Variable[vars.length]; >+ // For C++ in GDB the children of the >+ // the struture are the scope and the inherited classes. >+ // For example: >+ // class foo: public bar { >+ // int x; >+ // public: int y; >+ // } foobar; >+ // This will map to >+ // - foobar >+ // + bar >+ // - private >+ // - x >+ // - public >+ // - y >+ // So we choose to ignore the first set of children >+ // but carry over to those "fake" variables the typename and the qualified name >+ boolean cppFakeLayer = isCPPLanguage() && (!isFake() || (isFake() && !isAccessQualifier(fName))); >+ ICDIType t = getType(); >+ boolean containter = isStructureProvider(t); > for (int i = 0; i < vars.length; i++) { >- String fn= getFullName(); >- String childName = vars[i].getExp(); >+ String prefix = "(" + getFullName() + ")"; // parent qualified name >+ String childName = vars[i].getExp(); // chield simple name >+ String childFullName = prefix + "." + childName; // fallback full name > ICDIType childType = null; > boolean childFake = false; >- ICDIType t = getType(); >- if (t instanceof ICDIArrayType) { >- // For Array gdb varobj only return the index, override here. >- int index = castingIndex + i; >- fn = "(" + fn + ")[" + index + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- childName = getName() + "[" + index + "]"; //$NON-NLS-1$ //$NON-NLS-2$ >- } else if (t instanceof ICDIPointerType) { >- ICDIType subType = ((ICDIPointerType)t).getComponentType(); >- if (subType instanceof ICDIStructType) { >- if (isCPPLanguage()) { >- if (!isFake() >- || (isFake() && !(fName.equals("private") || fName.equals("public") || fName.equals("protected")))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- childFake = true; >- childType = t; >- } else { >- fn = "(" + fn + ")->" + vars[i].getExp(); //$NON-NLS-1$ //$NON-NLS-2$ >- } >- } else { // If not C++ language >- fn = "(" + fn + ")->" + vars[i].getExp(); //$NON-NLS-1$ //$NON-NLS-2$ >- } >+ if (cppFakeLayer && containter) { >+ childFake = true; >+ childType = t; >+ if (!isAccessQualifier(childName)) { >+ // if field is not access modifier and fake - it is a basetype >+ // cast to it to see reduced structure as value >+ childFullName = "(" + childName + ")" + prefix; > } else { >- fn = "*(" + fn + ")"; //$NON-NLS-1$ //$NON-NLS-2$ >+ childFullName = prefix; > } >- } else if (t instanceof ICDIReferenceType) { >- ICDIType subType = ((ICDIReferenceType)t).getComponentType(); >- if (subType instanceof ICDIStructType) { >- if (isCPPLanguage()) { >- if (!isFake() >- || (isFake() && !(fName.equals("private") || fName.equals("public") || fName.equals("protected")))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- childFake = true; >- childType = t; >- } else { >- fn = "(" + fn + ")." + vars[i].getExp(); //$NON-NLS-1$ //$NON-NLS-2$ >- } >- } else { // If not C++ language >- fn = "(" + fn + ")." + vars[i].getExp(); //$NON-NLS-1$ //$NON-NLS-2$ >+ } else { >+ if (t instanceof ICDIArrayType) { >+ // For Array gdb varobj only return the index, override here. >+ int index = castingIndex + i; >+ childFullName = prefix + "[" + index + "]"; //$NON-NLS-1$ //$NON-NLS-2$ >+ childName = getName() + "[" + index + "]"; //$NON-NLS-1$ //$NON-NLS-2$ >+ } else if (t instanceof ICDIPointerType) { >+ if (containter) { >+ childFullName = prefix + "->" + childName; //$NON-NLS-1$ >+ } else { >+ childFullName = "*" + prefix; //$NON-NLS-1$ > } >- } else { >- fn = "(" + fn + ")"; //$NON-NLS-1$ //$NON-NLS-2$ >- } >- } else if (t instanceof ICDIStructType) { >- if (isCPPLanguage()) { >- // For C++ in GDB the children of the >- // the struture are the scope and the inherited classes. >- // For example: >- // class foo: public bar { >- // int x; >- // public: int y; >- // } foobar; >- // This will map to >- // - foobar >- // + bar >- // - private >- // - x >- // - public >- // - y >- // So we choose to ignore the first set of children >- // but carry over to those "fake" variables the typename and the qualified name >- if (!isFake() >- || (isFake() && !(fName.equals("private") || fName.equals("public") || fName.equals("protected")))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- childFake = true; >- childType = t; >+ } else if (t instanceof ICDIReferenceType) { >+ if (containter) { >+ childFullName = prefix + "." + childName; //$NON-NLS-1$ > } else { >- fn = "(" + fn + ")." + vars[i].getExp(); //$NON-NLS-1$ //$NON-NLS-2$ >+ childFullName = prefix; > } >- } else { // If not C++ language >- fn = "(" + fn + ")." + vars[i].getExp(); //$NON-NLS-1$ //$NON-NLS-2$ >+ } else if (t instanceof ICDIStructType) { >+ // already correct name > } > } >- Variable v = createVariable((Target)getTarget(), (Thread)getThread(), (StackFrame)getStackFrame(), >- childName, fn, getPosition(), getStackDepth(), vars[i]); >+ Variable v = createVariable((Target) getTarget(), (Thread) getThread(), (StackFrame) getStackFrame(), childName, >+ childFullName, getPosition(), getStackDepth(), vars[i]); > if (childType != null) { > // Hack to reset the typename to a known value > v.fType = childType; >@@ -312,6 +297,22 @@ > return children; > } > >+ private boolean isStructureProvider(ICDIType t) { >+ // IncompleteType can be only struct or class, so same rules apply >+ if (t instanceof ICDIStructType || t instanceof IncompleteType) >+ return true; >+ if (t instanceof ICDIPointerType || t instanceof ICDIReferenceType) { >+ ICDIType type = ((ICDIDerivedType)t).getComponentType(); >+ return (type instanceof ICDIStructType || type instanceof IncompleteType); >+ } >+ return false; >+ >+ } >+ >+ boolean isAccessQualifier(String foo) { >+ return foo.equals("private") || foo.equals("public") || foo.equals("protected"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ } >+ > protected abstract Variable createVariable(Target target, Thread thread, StackFrame frame, > String name, String fullName, int pos, int depth, MIVar miVar); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
bjorn.freeman-benson
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 180975
:
62943
| 62956