summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxgsa2012-05-01 16:50:46 (EDT)
committer Marc Khouzam2012-05-02 05:58:38 (EDT)
commita2174db422c6bc30e06a63f162df30ca214951a2 (patch)
tree8b35a0734270c977b98b2b80a96dce2e3a6cd141
parent5edeb05a5b0fd3f3d31b26f73262cd9ad3cc9e1f (diff)
downloadorg.eclipse.cdt-a2174db422c6bc30e06a63f162df30ca214951a2.zip
org.eclipse.cdt-a2174db422c6bc30e06a63f162df30ca214951a2.tar.gz
org.eclipse.cdt-a2174db422c6bc30e06a63f162df30ca214951a2.tar.bz2
Bug 377536 - Add a global preference to use RTTI for variable types
determination (the gdb "set print object" option) Change-Id: I834bb746da33db3b73aef6023f4e4d2517eb9bd5 Reviewed-on: https://git.eclipse.org/r/5655 Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> IP-Clean: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java12
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java25
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintObject.java30
8 files changed, 109 insertions, 5 deletions
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 e6d688d..d4ac77e 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 752701a..0d7af90 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 954149f..209778a 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 8a77e88..fd4606b 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 <code>true</code>.
+ *
+ * @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 92d0a08..ecebd28 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 edeeb65..42b8230 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$
@@ -216,6 +218,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<MIInfo>(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 c31feea..a706ee9 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;
@@ -656,6 +658,11 @@ public class CommandFactory {
}
/** @since 4.1 */
+ public ICommand<MIInfo> createMIGDBSetPrintObject(ICommandControlDMContext ctx, boolean enable) {
+ return new MIGDBSetPrintObject(ctx, enable);
+ }
+
+ /** @since 4.1 */
public ICommand<MIInfo> 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 0000000..f789009
--- /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$
+ }
+}