diff options
author | Simon Marchi | 2017-03-11 00:05:14 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2017-04-28 14:59:24 +0000 |
commit | 9462c1db2421f05ab00e271da33a18d30bac7bbb (patch) | |
tree | cc275ecec8000cb8b7c225ea0bd7031799580e13 /dsf-gdb/org.eclipse.cdt.dsf.gdb | |
parent | fe3dc4a3de015e99316d1465ed9fae7de56bf2de (diff) | |
download | org.eclipse.cdt-9462c1db2421f05ab00e271da33a18d30bac7bbb.tar.gz org.eclipse.cdt-9462c1db2421f05ab00e271da33a18d30bac7bbb.tar.xz org.eclipse.cdt-9462c1db2421f05ab00e271da33a18d30bac7bbb.zip |
Bug 399494 - Consider all variable objects as not complex
There are cases where we consider some variables as complex when they
are not. In particular, if a pointer is declared using a typedef, is
will be considered complex with the current code. This is because it
has a child (the pointed value), but CDT doesn't know it's a pointer.
One of the consequence is that we assume the value is not modifiable.
Therefore, we won't update its value when it changes, and we won't let
the user edit it.
Initially I thought it would be safe to assume that variables with two
or more children are complex, but pointers to structures have as many
children as the structure has fields. Therefore, a pointer to a
structure, declared as a typedef, will still be wrongfully considered as
complex. Since there's no easy way to know for sure whether a variable
is complex, just assume everything is simple.
I added a test to verify that the value of a pointer declared using a
typedef will update correctly in CDT as it changes in the program.
There are two distinct scenarios, pointers that are variables and
pointers that are fields of structures. Instead of adding content to
testUpdateOfPointer, I decided to make a similar test method,
testUpdateOfPointerTypedef. The original test method was getting too
long and was difficult to follow. I think it's good to keep them short
and focused.
Another test verifies that the same kind of pointer can properly be
written/modified by the user.
Change-Id: If43b3b6e49cd4a20ea929c2a096745a32de14cd0
Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Diffstat (limited to 'dsf-gdb/org.eclipse.cdt.dsf.gdb')
-rw-r--r-- | dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java index 79d9ea4d189..f64265fe90d 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java @@ -532,10 +532,11 @@ public class MIVariableManager implements ICommandControl { // children taking into account RTTI ("set print object on")). // Note that the numChildrenHint can be trusted when asking if the number of children is 0 or not public boolean isComplex() { - return (getGDBType() == null) ? false - : getGDBType().getType() != GDBType.POINTER && getGDBType().getType() != GDBType.REFERENCE - && (getNumChildrenHint() > 0 - || hasMore() || getDisplayHint().isCollectionHint()); + // Since we can't reliably determine whether a variable is complex + // (see bug 399494), we err on the safe side and assume they are + // not. In the end we'll end up asking GDB a bit more things, but we + // should at least get correct results. + return false; } /** |