Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Implementation of the 'Automatically switch to disassembly mode' preference

Implementation of the 'Automatically switch to disassembly mode' preference.

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.16
diff -u -r1.16 ChangeLog
--- ChangeLog 15 Oct 2002 17:06:57 -0000 1.16
+++ ChangeLog 15 Oct 2002 18:26:56 -0000
@@ -1,4 +1,8 @@
 2002-10-15 Mikhail Khodjaiants
+ * ICDebugConstants.java: New interface that contains the constant definitions for C/C++ debug plug-in.
+ * CSourceManager.java: Implementation of the 'Automatically switch to disassembly mode' preference.
+
+2002-10-15 Mikhail Khodjaiants
  * CThread.java: The previous fix should be done only when switching between frames of the same thread.
 
 2002-10-14 Mikhail Khodjaiants
Index: src/org/eclipse/cdt/debug/core/ICDebugConstants.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/core/ICDebugConstants.java
diff -N src/org/eclipse/cdt/debug/core/ICDebugConstants.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/core/ICDebugConstants.java 15 Oct 2002 18:26:56 -0000
@@ -0,0 +1,28 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+package org.eclipse.cdt.debug.core;
+
+/**
+ *
+ * Constant definitions for C/C++ debug plug-in.
+ *
+ * @since: Oct 15, 2002
+ */
+public interface ICDebugConstants
+{
+ /**
+  * C/C++ debug plug-in identifier (value <code>"org.eclipse.cdt.debug.core"</code>).
+  */
+ public static final String PLUGIN_ID = CDebugCorePlugin.getDefault().getDescriptor().getUniqueIdentifier();
+
+ /**
+  * Boolean preference controlling whether the debugger automatically
+  * switchs to disassembly mode when can not find the source file .
+  * When <code>true</code> the debugger will automatically switch to
+  * disassembly mode.
+  */
+ public static final String PREF_AUTO_DISASSEMBLY = PLUGIN_ID + "cDebug.auto_disassembly"; file://$NON-NLS-1$
+}
Index: src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java,v
retrieving revision 1.3
diff -u -r1.3 CSourceManager.java
--- src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java 11 Oct 2002 21:41:50 -0000 1.3
+++ src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java 15 Oct 2002 18:26:56 -0000
@@ -6,6 +6,8 @@
 
 package org.eclipse.cdt.debug.internal.core.sourcelookup;
 
+import org.eclipse.cdt.debug.core.CDebugCorePlugin;
+import org.eclipse.cdt.debug.core.ICDebugConstants;
 import org.eclipse.cdt.debug.core.IStackFrameInfo;
 import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
 import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
@@ -136,11 +138,15 @@
  public Object getSourceElement( IStackFrame stackFrame )
  {
   Object result = null;
+  boolean autoDisassembly = CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_AUTO_DISASSEMBLY );
+  
   if ( getMode() == ISourceMode.MODE_SOURCE && getSourceLocator() != null )
   {
    result = getSourceLocator().getSourceElement( stackFrame );
   }
-  if ( result == null && getDisassemblyManager() != null )
+  if ( result == null &&
+    ( autoDisassembly || getMode() == ISourceMode.MODE_DISASSEMBLY ) &&
+    getDisassemblyManager() != null )
   {
    setRealMode( ISourceMode.MODE_DISASSEMBLY );
    result = getDisassemblyManager().getSourceElement( stackFrame );

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/ChangeLog,v
retrieving revision 1.2
diff -u -r1.2 ChangeLog
--- ChangeLog 14 Oct 2002 05:03:18 -0000 1.2
+++ ChangeLog 15 Oct 2002 18:21:22 -0000
@@ -1,3 +1,6 @@
+2002-10-15 Mikhail Khodjaiants
+ * CDebugPreferencePage.java: Implementation of the 'Automatically switch to disassembly mode' preference.
+
 2002-10-14 Mikhail Khodjaiants
  * CDebugUIPlugin.java: In the 'selectionChanged' method check if the thread of the new frame is current. If not make it current.
 
Index: src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java,v
retrieving revision 1.3
diff -u -r1.3 CDebugPreferencePage.java
--- src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java 8 Oct 2002 20:35:59 -0000 1.3
+++ src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java 15 Oct 2002 18:21:22 -0000
@@ -5,6 +5,8 @@
  */
 package org.eclipse.cdt.debug.internal.ui.preferences;
 
+import org.eclipse.cdt.debug.core.CDebugCorePlugin;
+import org.eclipse.cdt.debug.core.ICDebugConstants;
 import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
 import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
 import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
@@ -47,6 +49,9 @@
  // View setting widgets
  private Button fPathsButton;
 
+ // Disassembly setting widgets
+ private Button fAutoDisassemblyButton;
+
  private PropertyChangeListener fPropertyChangeListener;
 
  protected class PropertyChangeListener implements IPropertyChangeListener
@@ -105,6 +110,8 @@
   createPrimitiveDisplayPreferences( composite );  
   createSpacer( composite, 1 );
   createViewSettingPreferences( composite );
+  createSpacer( composite, 1 );
+  createDisassemblySettingPreferences( composite );
   setValues();
 
   return composite;
@@ -144,6 +151,7 @@
 
   fHexButton.setSelection( store.getBoolean( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES ) );
   fPathsButton.setSelection( store.getBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) );
+  fAutoDisassemblyButton.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_AUTO_DISASSEMBLY ) );
  }
 
  /* (non-Javadoc)
@@ -169,6 +177,7 @@
  {
   store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES, false );
   store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS, true );
+  CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_AUTO_DISASSEMBLY, false );
  }
 
  /**
@@ -199,6 +208,15 @@
  }
 
  /**
+  * Create the disassembly setting preferences composite widget
+  */
+ private void createDisassemblySettingPreferences( Composite parent )
+ {
+  Composite comp = createGroupComposite( parent, 1, "Disassembly options" );
+  fAutoDisassemblyButton = createCheckButton( comp, "Automatically switch to &disassembly mode" );
+ }
+
+ /**
   * Creates a button with the given label and sets the default
   * configuration data.
   */
@@ -232,6 +250,7 @@
    refreshViews();
   }
   CDebugUIPlugin.getDefault().savePluginPreferences();
+  CDebugCorePlugin.getDefault().savePluginPreferences();
   return true;
  }
 
@@ -291,6 +310,7 @@
   IPreferenceStore store = getPreferenceStore();
   store.setValue( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES, fHexButton.getSelection() );
   store.setValue( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS, fPathsButton.getSelection() );
+  CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_AUTO_DISASSEMBLY, fAutoDisassemblyButton.getSelection() );
  }
 
  /**
@@ -307,5 +327,6 @@
  {
   IPreferenceStore store = getPreferenceStore();
   fHexButton.setSelection( store.getDefaultBoolean( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES ) );
+  fAutoDisassemblyButton.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultBoolean( ICDebugConstants.PREF_AUTO_DISASSEMBLY ) );
  }
 }


Back to the top