diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
index e6d688d2b56..d4ac77eee29 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Ericsson and others.
+ * Copyright (c) 2009, 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,6 +9,7 @@
* Ericsson - initial API and implementation
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Sergey Prigogin (Google)
+ * Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
@@ -734,6 +735,23 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
}
});
+ group= new Group(parent, SWT.NONE);
+ group.setText(MessagesForPreferences.GdbDebugPreferencePage_rtti_label);
+ groupLayout= new GridLayout(3, false);
+ group.setLayout(groupLayout);
+ group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ boolField= new BooleanFieldEditor(
+ IGdbDebugPreferenceConstants.PREF_USE_RTTI,
+ MessagesForPreferences.GdbDebugPreferencePage_use_rtti_label1 + "\n" //$NON-NLS-1$
+ + MessagesForPreferences.GdbDebugPreferencePage_use_rtti_label2,
+ group);
+
+ boolField.fillIntoGrid(group, 3);
+ addField(boolField);
+ // need to set layout again
+ group.setLayout(groupLayout);
+
// need to set layouts again
indentHelper.setLayout(helperLayout);
group.setLayout(groupLayout);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java
index 752701a87b2..0d7af9055d2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Ericsson and others.
+ * Copyright (c) 2009, 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* Ericsson - initial API and implementation
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
+ * Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
@@ -49,6 +50,12 @@ class MessagesForPreferences extends NLS {
public static String GdbDebugPreferencePage_Invalid_timeout_value;
public static String GdbDebugPreferencePage_Timeout_column_name;
public static String GdbDebugPreferencePage_Timeout_value_can_not_be_negative;
+ /** @since 2.3 */
+ public static String GdbDebugPreferencePage_rtti_label;
+ /** @since 2.3 */
+ public static String GdbDebugPreferencePage_use_rtti_label1;
+ /** @since 2.3 */
+ public static String GdbDebugPreferencePage_use_rtti_label2;
static {
// initialize resource bundle
NLS.initializeMessages(MessagesForPreferences.class.getName(), MessagesForPreferences.class);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties
index 954149f1345..209778aa4ae 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2009, 2011 Ericsson and others.
+# Copyright (c) 2009, 2012 Ericsson and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
# Contributors:
# Ericsson - initial API and implementation
# Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
+# Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
###############################################################################
GdbDebugPreferencePage_Add_button=Add
@@ -30,6 +31,10 @@ GdbDebugPreferencePage_enablePrettyPrinting_label1=Enable pretty printers in var
GdbDebugPreferencePage_enablePrettyPrinting_label2=(requires python-enabled GDB)
GdbDebugPreferencePage_initialChildCountLimitForCollections_label=For collections, initially limit child count to
+GdbDebugPreferencePage_rtti_label=Run-time type information
+GdbDebugPreferencePage_use_rtti_label1=Display run-time type of variables
+GdbDebugPreferencePage_use_rtti_label2=(requires GDB 7.5 or higher)
+
GdbDebugPreferencePage_defaults_label=Debug Configurations Defaults
GdbDebugPreferencePage_Delete_button=Delete
GdbDebugPreferencePage_Invalid_timeout_value=Invalid timeout value
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java
index 8a77e886b18..fd4606be4dc 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Ericsson and others.
+ * Copyright (c) 2009, 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,6 +9,7 @@
* Ericsson - initial implementation
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Sergey Prigogin (Google)
+ * Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb;
@@ -114,5 +115,14 @@ public interface IGdbDebugPreferenceConstants {
* @since 4.1
*/
public static final int COMMAND_TIMEOUT_VALUE_DEFAULT = 10000;
+
+ /**
+ * Boolean preference whether to use RTTI for MI variables type
+ * determination. Default is true
.
+ *
+ * @since 4.1
+ */
+ public static final String PREF_USE_RTTI = PREFIX + "useRtti"; //$NON-NLS-1$
+
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
index 92d0a08d776..ecebd28172c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Ericsson and others.
+ * Copyright (c) 2009, 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,6 +10,7 @@
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Sergey Prigogin (Google)
* Marc Khouzam (Ericsson) - Move to org.eclipse.cdt.dsf.gdb from UI plugin (bug 348159)
+ * Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal;
@@ -32,6 +33,7 @@ public class GdbPreferenceInitializer extends AbstractPreferenceInitializer {
node.putBoolean(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB, true);
node.putBoolean(IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER, true);
node.putBoolean(IGdbDebugPreferenceConstants.PREF_ENABLE_PRETTY_PRINTING, true);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_USE_RTTI, true);
node.putInt(IGdbDebugPreferenceConstants.PREF_INITIAL_CHILD_COUNT_LIMIT_FOR_COLLECTIONS, 100);
node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND, IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT, IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java
index edeeb6513b1..42b82306dd2 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java
@@ -13,6 +13,7 @@
* Sergey Prigogin (Google)
* Marc Khouzam (Ericsson) - No longer call method to check non-stop for GDB < 7.0 (Bug 365471)
* Mathias Kunter - Support for different charsets (bug 370462)
+ * Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.launching;
@@ -80,6 +81,7 @@ public class FinalLaunchSequence extends ReflectionSequence {
"stepSetEnvironmentDirectory", //$NON-NLS-1$
"stepSetBreakpointPending", //$NON-NLS-1$
"stepEnablePrettyPrinting", //$NON-NLS-1$
+ "stepSetPrintObject", //$NON-NLS-1$
"stepSetCharset", //$NON-NLS-1$
"stepSourceGDBInitFile", //$NON-NLS-1$
"stepSetAutoLoadSharedLibrarySymbols", //$NON-NLS-1$
@@ -215,6 +217,29 @@ public class FinalLaunchSequence extends ReflectionSequence {
}
}
+ /**
+ * Turn on RTTI usage, if enabled in preferences.
+ * @since 4.1
+ */
+ @Execute
+ public void stepSetPrintObject(final RequestMonitor requestMonitor) {
+ // Enable or disable variables type determination based on RTTI.
+ // See bug 377536 for details.
+ boolean useRtti = Platform.getPreferencesService().getBoolean(
+ GdbPlugin.PLUGIN_ID,
+ IGdbDebugPreferenceConstants.PREF_USE_RTTI, false, null);
+ fCommandControl.queueCommand(
+ fCommandControl.getCommandFactory().createMIGDBSetPrintObject(fCommandControl.getContext(), useRtti),
+ new DataRequestMonitor(getExecutor(), requestMonitor) {
+ @Override
+ protected void handleCompleted() {
+ // Not an essential command, so accept errors
+ requestMonitor.done();
+ }
+ }
+ );
+ }
+
/**
* Set the charsets.
* @since 4.1
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java
index c31feea345f..a706ee91c90 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java
@@ -17,6 +17,7 @@
* Marc Khouzam (Ericsson) - New methods for new MIDataDisassemble (Bug 357073)
* Marc Khouzam (Ericsson) - New method for new MIGDBSetPythonPrintStack (Bug 367788)
* Mathias Kunter - New methods for handling different charsets (Bug 370462)
+ * Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command;
@@ -106,6 +107,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetEnv;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetHostCharset;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetNonStop;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPagination;
+import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPrintObject;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPrintSevenbitStrings;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPythonPrintStack;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSchedulerLocking;
@@ -655,6 +657,11 @@ public class CommandFactory {
return new MIGDBSetPagination(ctx, isSet);
}
+ /** @since 4.1 */
+ public ICommand createMIGDBSetPrintObject(ICommandControlDMContext ctx, boolean enable) {
+ return new MIGDBSetPrintObject(ctx, enable);
+ }
+
/** @since 4.1 */
public ICommand createMIGDBSetPrintSevenbitStrings(ICommandControlDMContext ctx, boolean enable) {
return new MIGDBSetPrintSevenbitStrings(ctx, enable);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintObject.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintObject.java
new file mode 100644
index 00000000000..f78900958ea
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintObject.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Anton Gorenkov and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anton Gorenkov - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.dsf.mi.service.command.commands;
+
+import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
+
+/**
+ *
+ * -gdb-set print object [on | off]
+ *
+ * When on:
+ * for GDB <= 7.4, Runtime Type Information will be used in the gdb console.
+ * for GDB >= 7.5, Runtime Type Information will be used in the debug views.
+ * When off, only static type of variable is taken into account.
+ *
+ * @since 4.1
+ */
+public class MIGDBSetPrintObject extends MIGDBSet {
+ public MIGDBSetPrintObject(ICommandControlDMContext ctx, boolean enable) {
+ super(ctx, new String[] {"print", "object", enable ? "on" : "off"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+}