mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
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>
This commit is contained in:
parent
5edeb05a5b
commit
a2174db422
8 changed files with 109 additions and 5 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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$
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<MIInfo>(getExecutor(), requestMonitor) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
// Not an essential command, so accept errors
|
||||
requestMonitor.done();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the charsets.
|
||||
* @since 4.1
|
||||
|
|
|
@ -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<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);
|
||||
|
|
|
@ -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$
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue