mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 370462: Improving the debug preferences - add support for different charsets and unify DSF and CDI debug preferences. Update to number format changes to avoid API breakage.
This commit is contained in:
parent
23a8adbdb7
commit
49c5be791f
17 changed files with 48 additions and 58 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2012 Intel Corporation and others.
|
||||
* Copyright (c) 2004, 2008 Intel Corporation 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,7 +8,6 @@
|
|||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
* Mark Mitchell, CodeSourcery - Bug 136896: View variables in binary format
|
||||
* Mathias Kunter - Bug 370462: View variables in octal format
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core;
|
||||
|
||||
|
@ -104,15 +103,6 @@ public interface IAddress extends Comparable<Object> {
|
|||
*/
|
||||
String toHexAddressString();
|
||||
|
||||
/**
|
||||
* Converts address to the octal representation with '0' prefix and
|
||||
* with all leading zeros. The length of returned string should be
|
||||
* the same for all addresses of given class. I.e. 12 for 32-bit
|
||||
* addresses and 23 for 64-bit addresses
|
||||
* @since 5.4
|
||||
*/
|
||||
String toOctalAddressString();
|
||||
|
||||
/**
|
||||
* Converts address to the binary representation with '0b' prefix and
|
||||
* with all leading zeros. The length of returned string should be
|
||||
|
|
|
@ -164,7 +164,6 @@ public class Addr32 implements IAddress, Serializable {
|
|||
/**
|
||||
* @since 5.4
|
||||
*/
|
||||
@Override
|
||||
public String toOctalAddressString() {
|
||||
String addressString = Long.toString(address, 8);
|
||||
StringBuffer sb = new StringBuffer(OCTAL_CHARS_NUM);
|
||||
|
|
|
@ -168,7 +168,6 @@ public class Addr64 implements IAddress, Serializable {
|
|||
/**
|
||||
* @since 5.4
|
||||
*/
|
||||
@Override
|
||||
public String toOctalAddressString() {
|
||||
String addressString = address.toString(8);
|
||||
StringBuffer sb = new StringBuffer(OCTAL_CHARS_NUM);
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<component id="org.eclipse.cdt.debug.core" version="2">
|
||||
<resource path="src/org/eclipse/cdt/debug/core/ICDebugConstants.java" type="org.eclipse.cdt.debug.core.ICDebugConstants">
|
||||
<filter id="403853384">
|
||||
<message_arguments>
|
||||
<message_argument value="org.eclipse.cdt.debug.core.ICDebugConstants"/>
|
||||
</message_arguments>
|
||||
</filter>
|
||||
</resource>
|
||||
<resource path="src/org/eclipse/cdt/debug/core/sourcelookup/MappingSourceContainer.java" type="org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer">
|
||||
<filter id="643846161">
|
||||
<message_arguments>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2012 QNX Software Systems and others.
|
||||
* Copyright (c) 2000, 2011 QNX Software Systems 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,7 +9,6 @@
|
|||
* QNX Software Systems - Initial API and implementation
|
||||
* Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
|
||||
* Patrick Chuong (Texas Instruments) - Update CDT ToggleBreakpointTargetFactory enablement (340177)
|
||||
* Mathias Kunter - PREF_CHARSET has been renamed to PREF_WIDE_CHARSET (bug 370462)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.core;
|
||||
|
||||
|
@ -503,7 +502,7 @@ public class CDebugUtils {
|
|||
private static CharsetDecoder fDecoder;
|
||||
|
||||
public static CharsetDecoder getCharsetDecoder() {
|
||||
String charsetName = CDebugCorePlugin.getDefault().getPluginPreferences().getString(ICDebugConstants.PREF_WIDE_CHARSET);
|
||||
String charsetName = CDebugCorePlugin.getDefault().getPluginPreferences().getString(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET);
|
||||
if (fDecoder == null || !fDecoder.charset().name().equals(charsetName)) {
|
||||
Charset charset = Charset.forName(charsetName);
|
||||
fDecoder = charset.newDecoder();
|
||||
|
@ -757,4 +756,4 @@ public class CDebugUtils {
|
|||
String customModel = System.getProperty(ICDebugConstants.PREF_TOGGLE_BREAKPOINT_MODEL_IDENTIFIER, null);
|
||||
return customModel != null && Boolean.valueOf(customModel);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -40,16 +40,26 @@ public interface ICDebugConstants {
|
|||
|
||||
/**
|
||||
* The charset to use for decoding char type strings. We however can't use the ID
|
||||
* "character_set" here because that would break backwards compatibility.
|
||||
* "character_set" here because that would break backwards compatibility as it was
|
||||
* already used for wide charsets.
|
||||
* @since 7.2
|
||||
*/
|
||||
public static final String PREF_CHARSET = PLUGIN_ID + "cDebug.non_wide_character_set"; //$NON-NLS-1$
|
||||
|
||||
public static final String PREF_DEBUG_CHARSET = PLUGIN_ID + "cDebug.non_wide_character_set"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* The charset to use for decoding wchar_t type strings. We have to use the ID
|
||||
* "character_set" here so that we don't break backwards compatibility.
|
||||
* @since 7.2
|
||||
*/
|
||||
public static final String PREF_WIDE_CHARSET = PLUGIN_ID + "cDebug.character_set"; //$NON-NLS-1$
|
||||
public static final String PREF_DEBUG_WIDE_CHARSET = PLUGIN_ID + "cDebug.character_set"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Deprecated id for the charset used for decoding wchar_t type strings.
|
||||
* Replaced by ICDebugConstants.PREF_WIDE_CHARSET.
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PREF_CHARSET = PLUGIN_ID + "cDebug.character_set"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* The identifier of the default expression format to use in the expressions
|
||||
|
@ -117,6 +127,7 @@ public interface ICDebugConstants {
|
|||
* @deprecated Provided for compatibility reasons only. Use the default value
|
||||
* from the Preferences object instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String DEF_CHARSET = "UTF-16"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,11 +41,11 @@ public class CDebugCorePreferenceInitializer extends AbstractPreferenceInitializ
|
|||
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT, ICDIFormat.NATURAL );
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT, ICDIFormat.NATURAL );
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT, ICDIFormat.NATURAL );
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_CHARSET, Charset.defaultCharset().name() );
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_DEBUG_CHARSET, Charset.defaultCharset().name() );
|
||||
if (Platform.getOS().equals(Platform.OS_WIN32))
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_WIDE_CHARSET, "UTF-16"); //$NON-NLS-1$
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, "UTF-16"); //$NON-NLS-1$
|
||||
else
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_WIDE_CHARSET, "UTF-32"); //$NON-NLS-1$
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, "UTF-32"); //$NON-NLS-1$
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_INSTRUCTION_STEP_MODE_ON, false );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ public class CIndexedValue extends AbstractCValue implements IIndexedValue {
|
|||
else if ( CVariableFormat.DECIMAL.equals( format ) )
|
||||
return address.toString();
|
||||
else if ( CVariableFormat.OCTAL.equals( format ) )
|
||||
return address.toOctalAddressString();
|
||||
return address.toHexAddressString();
|
||||
else if ( CVariableFormat.BINARY.equals( format ) )
|
||||
return address.toBinaryAddressString();
|
||||
return null;
|
||||
|
|
|
@ -633,7 +633,7 @@ public class CValue extends AbstractCValue {
|
|||
else if ( CVariableFormat.DECIMAL.equals( format ) )
|
||||
return address.toString();
|
||||
else if ( CVariableFormat.OCTAL.equals( format ) )
|
||||
return address.toOctalAddressString();
|
||||
return address.toHexAddressString();
|
||||
else if ( CVariableFormat.BINARY.equals( format ) )
|
||||
return address.toBinaryAddressString();
|
||||
return null;
|
||||
|
|
|
@ -68,7 +68,7 @@ RemoveAllGlobalsAction.tooltip=Remove All Global Variables
|
|||
CVariableFormatMenu.label=Format
|
||||
HexVariableFormatAction.label=Hexadecimal
|
||||
DecVariableFormatAction.label=Decimal
|
||||
NaturalVariableFormatAction.label=Natural
|
||||
NaturalVariableFormatAction.label=Default
|
||||
BinaryVariableFormatAction.label=Binary
|
||||
|
||||
CDebugActionGroup.name=C/C++ Debug
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 QNX Software Systems and others.
|
||||
* Copyright (c) 2009, 2012 QNX Software Systems 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
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Marc Khouzam (Ericsson) - Support for octal number format (bug 370462)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
|
@ -40,10 +41,10 @@ public class NumberFormatsContribution extends CompoundContributionItem implemen
|
|||
|
||||
private static final Map<CVariableFormat, String> FORMATS = new LinkedHashMap<CVariableFormat, String>();
|
||||
static {
|
||||
FORMATS.put(CVariableFormat.NATURAL, "Natural");
|
||||
FORMATS.put(CVariableFormat.NATURAL, "Default");
|
||||
FORMATS.put(CVariableFormat.DECIMAL, "Decimal");
|
||||
FORMATS.put(CVariableFormat.HEXADECIMAL, "Hexadecimal");
|
||||
//FORMATS.put(CVariableFormat.OCTAL, "Octal");
|
||||
FORMATS.put(CVariableFormat.OCTAL, "Octal");
|
||||
FORMATS.put(CVariableFormat.BINARY, "Binary");
|
||||
}
|
||||
|
||||
|
|
|
@ -180,18 +180,18 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
|||
// Charset editors
|
||||
PreferenceStore ps = new PreferenceStore();
|
||||
|
||||
ps.setDefault(ICDebugConstants.PREF_CHARSET, CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultString(ICDebugConstants.PREF_CHARSET));
|
||||
ps.setValue(ICDebugConstants.PREF_CHARSET, CDebugCorePlugin.getDefault().getPluginPreferences().getString(ICDebugConstants.PREF_CHARSET));
|
||||
ps.setDefault(ICDebugConstants.PREF_DEBUG_CHARSET, CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultString(ICDebugConstants.PREF_DEBUG_CHARSET));
|
||||
ps.setValue(ICDebugConstants.PREF_DEBUG_CHARSET, CDebugCorePlugin.getDefault().getPluginPreferences().getString(ICDebugConstants.PREF_DEBUG_CHARSET));
|
||||
fCharsetEditor.setPreferenceStore(ps);
|
||||
fCharsetEditor.load();
|
||||
if (CDebugCorePlugin.getDefault().getPluginPreferences().isDefault(ICDebugConstants.PREF_CHARSET))
|
||||
if (CDebugCorePlugin.getDefault().getPluginPreferences().isDefault(ICDebugConstants.PREF_DEBUG_CHARSET))
|
||||
fCharsetEditor.loadDefault();
|
||||
|
||||
ps.setDefault(ICDebugConstants.PREF_WIDE_CHARSET, CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultString(ICDebugConstants.PREF_WIDE_CHARSET));
|
||||
ps.setValue(ICDebugConstants.PREF_WIDE_CHARSET, CDebugCorePlugin.getDefault().getPluginPreferences().getString(ICDebugConstants.PREF_WIDE_CHARSET));
|
||||
ps.setDefault(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultString(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET));
|
||||
ps.setValue(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, CDebugCorePlugin.getDefault().getPluginPreferences().getString(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET));
|
||||
fWideCharsetEditor.setPreferenceStore(ps);
|
||||
fWideCharsetEditor.load();
|
||||
if (CDebugCorePlugin.getDefault().getPluginPreferences().isDefault(ICDebugConstants.PREF_WIDE_CHARSET))
|
||||
if (CDebugCorePlugin.getDefault().getPluginPreferences().isDefault(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET))
|
||||
fWideCharsetEditor.loadDefault();
|
||||
|
||||
// Others
|
||||
|
@ -251,12 +251,12 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
|||
|
||||
// Create charset editor
|
||||
Composite charsetComposite = ControlFactory.createComposite(formatComposite, 1);
|
||||
fCharsetEditor = new EncodingFieldEditor(ICDebugConstants.PREF_CHARSET, "", PreferenceMessages.getString( "CDebugPreferencePage.18" ), charsetComposite); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fCharsetEditor = new EncodingFieldEditor(ICDebugConstants.PREF_DEBUG_CHARSET, "", PreferenceMessages.getString( "CDebugPreferencePage.18" ), charsetComposite); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fCharsetEditor.setPropertyChangeListener(getPropertyChangeListener());
|
||||
|
||||
// Create wide charset editor
|
||||
Composite wideCharsetComposite = ControlFactory.createComposite(formatComposite, 1);
|
||||
fWideCharsetEditor = new EncodingFieldEditor(ICDebugConstants.PREF_WIDE_CHARSET, "", PreferenceMessages.getString( "CDebugPreferencePage.16" ), wideCharsetComposite); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fWideCharsetEditor = new EncodingFieldEditor(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, "", PreferenceMessages.getString( "CDebugPreferencePage.16" ), wideCharsetComposite); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fWideCharsetEditor.setPropertyChangeListener(getPropertyChangeListener());
|
||||
}
|
||||
|
||||
|
@ -355,10 +355,10 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
|||
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT, getFormatId( fRegisterFormatCombo.getSelectionIndex() ) );
|
||||
|
||||
fCharsetEditor.store();
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setValue(ICDebugConstants.PREF_CHARSET, fCharsetEditor.getPreferenceStore().getString(ICDebugConstants.PREF_CHARSET));
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setValue(ICDebugConstants.PREF_DEBUG_CHARSET, fCharsetEditor.getPreferenceStore().getString(ICDebugConstants.PREF_DEBUG_CHARSET));
|
||||
|
||||
fWideCharsetEditor.store();
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setValue(ICDebugConstants.PREF_WIDE_CHARSET, fWideCharsetEditor.getPreferenceStore().getString(ICDebugConstants.PREF_WIDE_CHARSET));
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setValue(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, fWideCharsetEditor.getPreferenceStore().getString(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET));
|
||||
|
||||
CCorePlugin.getDefault().getPluginPreferences().setValue( CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, fShowBinarySourceFilesButton.getSelection() );
|
||||
}
|
||||
|
|
|
@ -33,15 +33,15 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td headers="option"><strong>Default variable format</strong></td>
|
||||
<td headers="description">Select the default variable format from either Natural, Hexadecimal, Decimal or binary.</td>
|
||||
<td headers="description">Select the default variable format from either Default, Hexadecimal, Decimal, Octal or Binary.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td headers="option"><strong>Default expression format</strong></td>
|
||||
<td headers="description">Select the default expression format from either Natural, Hexadecimal, Decimal or binary.</td>
|
||||
<td headers="description">Select the default expression format from either Default, Hexadecimal, Decimal, Octal or Binary.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td headers="option"><strong>Default register format</strong></td>
|
||||
<td headers="description">Select the default register format from either Natural, Hexadecimal, Decimal or binary.</td>
|
||||
<td headers="description">Select the default register format from either Default, Hexadecimal, Decimal, Octal or Binary.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td headers="option"><strong>Character encoding</strong></td>
|
||||
|
|
|
@ -135,7 +135,7 @@ stops. </p>
|
|||
<tr>
|
||||
<td valign="top" headers="icon2"><div style="text-align:center;"></div></td>
|
||||
<td valign="top" headers="name2"><strong>Format</strong></td>
|
||||
<td valign="top" headers="description2">Select a format type. Choices include: BInary, Decimal, Natural, and hexadecimal. </td>
|
||||
<td valign="top" headers="description2">Select a format type. Choices include: Default, Decimal, Hexadecimal, Octal or Binary. </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" headers="icon2"><div style="text-align:center;"></div></td>
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
<li>In the Registers view, right-click a register, and select <strong>Format</strong>.</li>
|
||||
<li>Type a new value.</li>
|
||||
<li>Do one of the following:
|
||||
<ul><li>Click <strong>Natural</strong>.</li><li>Click <strong>Decimal</strong>.</li><li>Click <strong>
|
||||
Hexadecimal</strong>.</li></ul>
|
||||
<ul><li>Click <strong>Default</strong>.</li><li>Click <strong>Decimal</strong>.</li><li>Click <strong>
|
||||
Hexadecimal</strong>.</li><li>Click <strong>Octal</strong>.</li><li>Click <strong>Binary</strong>.</li></ul>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ public class FinalLaunchSequence_7_0 extends FinalLaunchSequence {
|
|||
// the inferior program. Note that GDB only accepts upper case charset names.
|
||||
String charset =
|
||||
Platform.getPreferencesService().getString(CDebugCorePlugin.PLUGIN_ID,
|
||||
ICDebugConstants.PREF_CHARSET,
|
||||
ICDebugConstants.PREF_DEBUG_CHARSET,
|
||||
Charset.defaultCharset().name(),
|
||||
null);
|
||||
fCommandControl.queueCommand(
|
||||
|
@ -139,7 +139,7 @@ public class FinalLaunchSequence_7_0 extends FinalLaunchSequence {
|
|||
|
||||
String wideCharset =
|
||||
Platform.getPreferencesService().getString(CDebugCorePlugin.PLUGIN_ID,
|
||||
ICDebugConstants.PREF_WIDE_CHARSET,
|
||||
ICDebugConstants.PREF_DEBUG_WIDE_CHARSET,
|
||||
defaultWideCharset,
|
||||
null);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2012 Wind River Systems and others.
|
||||
* Copyright (c) 2006, 2010 Wind River Systems 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,7 +8,6 @@
|
|||
* Contributors:
|
||||
* Wind River Systems - initial API and implementation
|
||||
* Ericsson - Update for GDB/MI
|
||||
* Mathias Kunter - Support for octal number format (bug 370462)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.debug.service;
|
||||
|
||||
|
@ -108,7 +107,6 @@ public interface IExpressions extends IFormattedValues {
|
|||
@Override public boolean isMax() { return false; }
|
||||
@Override public String toString(int radix) { return "INVALID"; }
|
||||
@Override public String toHexAddressString() { return toString(); }
|
||||
@Override public String toOctalAddressString() { return toString(); }
|
||||
@Override public String toBinaryAddressString() { return toString(); }
|
||||
@Override public int getCharsNum() { return 0; }
|
||||
@Override public int getSize() { return 0; }
|
||||
|
|
Loading…
Add table
Reference in a new issue