Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Marchi2015-02-17 18:07:26 +0000
committerGerrit Code Review @ Eclipse.org2015-05-04 20:03:18 +0000
commitcb16665cc776d9e46d5862e8ee283ff082063a90 (patch)
tree031f825d4f3a5b6ebe3e8ab99225d813bd87c00d
parent9f39b4828d81af86004ff4ebf290756053fac86f (diff)
downloadorg.eclipse.cdt-cb16665cc776d9e46d5862e8ee283ff082063a90.tar.gz
org.eclipse.cdt-cb16665cc776d9e46d5862e8ee283ff082063a90.tar.xz
org.eclipse.cdt-cb16665cc776d9e46d5862e8ee283ff082063a90.zip
Bug 293832 - [dsf-gdb] Ask gdb for variable value, even if it is a complex type
Currently, CDT does not ask GDB for the value of the variables it believes to be of complex types, such as structures. However, as described in the bug, it assumes that a typedefed pointer is a complex structure. Because of that, it displays a value of "{...}" for it instead of the pointer value. By asking GDB for the value of the variable even if it's of a complex type, CDT will always display the right thing for the value. This will cause a few more -var-evaluate-expression calls, but their number is still limited to what is visible in the variables view. So the impact should be negligible. Screenshot of before/after: http://i.imgur.com/Sx5ZPfO.png It is still impossible to edit the value, but this would be addressed in another patch. Change-Id: I92e6ead6351677e098a56d4af5bdb85fc61df080 Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java53
1 files changed, 22 insertions, 31 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 07246086dfb..3872f2089cf 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
@@ -1102,38 +1102,29 @@ public class MIVariableManager implements ICommandControl {
return;
}
- // If the variable is a complex structure, there is no need to ask the back-end for a value,
- // we can give it the {...} ourselves
- // Unless we are dealing with an array, in which case, we want to get the address of it
- if (isComplex() && ! isDynamic()) {
- if (isArray()) {
- // Figure out the address
- IExpressionDMContext exprCxt = DMContexts.getAncestorOfType(dmc, IExpressionDMContext.class);
- IExpressionDMContext addrCxt = fExpressionService.createExpression(exprCxt, "&(" + exprCxt.getExpression() + ")"); //$NON-NLS-1$//$NON-NLS-2$
-
- final FormattedValueDMContext formatCxt = new FormattedValueDMContext(
- fSession.getId(),
- addrCxt,
- dmc.getFormatID()
- );
-
- getVariable(
- addrCxt,
- new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), rm) {
- @Override
- protected void handleSuccess() {
- getData().getValue(formatCxt, rm);
+ // If we are dealing with an array, in which case, we want to get the address of it.
+ // When dealing with a complex value, we want to query the back-end to correctly
+ // address the case of a typedefed pointer (see bug 293832).
+ if (isArray()) {
+ // Figure out the address
+ IExpressionDMContext exprCxt = DMContexts.getAncestorOfType(dmc, IExpressionDMContext.class);
+ IExpressionDMContext addrCxt = fExpressionService.createExpression(exprCxt, "&(" + exprCxt.getExpression() + ")"); //$NON-NLS-1$//$NON-NLS-2$
+
+ final FormattedValueDMContext formatCxt = new FormattedValueDMContext(
+ fSession.getId(),
+ addrCxt,
+ dmc.getFormatID()
+ );
+
+ getVariable(
+ addrCxt,
+ new DataRequestMonitor<MIVariableObject>(fSession.getExecutor(), rm) {
+ @Override
+ protected void handleSuccess() {
+ getData().getValue(formatCxt, rm);
- }
- });
- } else {
- // Other complex structure
- String complexValue = "{...}"; //$NON-NLS-1$
- setValue(dmc.getFormatID(), complexValue);
- rm.setData(new FormattedValueDMData(complexValue));
- rm.done();
- }
-
+ }
+ });
return;
}

Back to the top