Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Added the 'Add Address Breakpoint' action to the workbench 'Run' menu

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/ChangeLog,v
retrieving revision 1.72
diff -u -r1.72 ChangeLog
--- ChangeLog 13 Jan 2003 22:28:48 -0000 1.72
+++ ChangeLog 14 Jan 2003 20:25:36 -0000
@@ -1,4 +1,11 @@
-2003-01-10 Mikhail Khodjaiants
+2003-01-14 Mikhail Khodjaiants
+ Added the 'Add Address Breakpoint' action to the workbench 'Run' menu.
+ * AddAddressBreakpointActionDelegate.java
+ * plugin.properties
+ * plugin.xml
+ * icons/full/obj16/brkp_obj.gif
+
+2003-01-13 Mikhail Khodjaiants
  Implementation of the 'Run To Line' action for disassembly.
  * RunToLineActionDelegate.java
 
Index: plugin.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/plugin.properties,v
retrieving revision 1.26
diff -u -r1.26 plugin.properties
--- plugin.properties 10 Jan 2003 19:36:39 -0000 1.26
+++ plugin.properties 14 Jan 2003 20:25:36 -0000
@@ -33,6 +33,7 @@
 BreakpointPropertiesAction.label=P&roperties...
 ManageWatchpointAction.label=Add C/C++ &Watchpoint...
 AddExpressionAction.label=Add C/C++ &_expression_...
+AddAddressBreakpointAction.label=Add &Address Breakpoint...
 RunToLineAction.label=Run To C/C++ &Line
 ShowFullPathsAction.label=Show Full Paths
 ShowFullPathsAction.tooltip=Show Full Paths
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/plugin.xml,v
retrieving revision 1.43
diff -u -r1.43 plugin.xml
--- plugin.xml 10 Jan 2003 23:27:27 -0000 1.43
+++ plugin.xml 14 Jan 2003 20:25:38 -0000
@@ -146,7 +146,7 @@
          </action>
          <action
                label="%ManageBreakpointAction.label"
-               icon="icons/full/obj16/brkpi_obj.gif"
+               icon="icons/full/obj16/brkp_obj.gif"
                helpContextId="manage_breakpoint_action_context"
                class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointActionDelegate"
                menubarPath="org.eclipse.ui.run/cBreakpointGroup"
@@ -159,6 +159,21 @@
             </enablement>
          </action>
          <action
+               label="%AddAddressBreakpointAction.label"
+               icon="icons/full/obj16/addrbrkp_obj.gif"
+               helpContextId="add_address_breakpoint_action_context"
+               class="org.eclipse.cdt.debug.internal.ui.AddAddressBreakpointActionDelegate"
+               menubarPath="org.eclipse.ui.run/cBreakpointGroup"
+               enablesFor="1"
+               id="org.eclipse.cdt.debug.internal.ui.AddAddressBreakpointActionDelegate">
+            <enablement>
+               <pluginState
+                     value="activated"
+                     id="org.eclipse.cdt.debug.ui">
+               </pluginState>
+            </enablement>
+         </action>
+         <action
                label="%ManageWatchpointAction.label"
                icon="icons/full/obj16/readwrite_obj.gif"
                helpContextId="manage_watchpoint_action_context"
@@ -747,9 +762,9 @@
             targetID="org.eclipse.cdt.ui.editor.asm.AsmEditor"
             id="org.eclipse.cdt.ui.editor.asm.AsmEditor.BreakpointRulerActions">
          <action
+               label="%Dummy.label"
                class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate"
                actionID="RulerDoubleClick"
-               label="%Dummy.label"
                id="org.eclipse.cdt.debug.ui.CEditor.ManageBreakpointRulerAction">
             <enablement>
                <pluginState
@@ -763,14 +778,14 @@
             targetID="org.eclipse.cdt.debug.ui.DisassemblyEditor"
             id="org.eclipse.cdt.debug.ui.DisassemblyEditor.BreakpointRulerActions">
          <action
-               actionID="RulerDoubleClick"
-               class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate"
                label="%Dummy.label"
+               class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate"
+               actionID="RulerDoubleClick"
                id="org.eclipse.cdt.debug.ui.CEditor.ManageBreakpointRulerAction">
             <enablement>
                <pluginState
-                     id="org.eclipse.cdt.debug.ui"
-                     value="activated">
+                     value="activated"
+                     id="org.eclipse.cdt.debug.ui">
                </pluginState>
             </enablement>
          </action>
@@ -826,6 +841,9 @@
          </action>
          <action
                id="org.eclipse.cdt.debug.internal.ui.actions.AddGlobalsActionDelegate">
+         </action>
+         <action
+               id="org.eclipse.cdt.debug.internal.ui.AddAddressBreakpointActionDelegate">
          </action>
       </debugActionGroup>
    </extension>
Index: icons/full/obj16/brkp_obj.gif
===================================================================
RCS file: icons/full/obj16/brkp_obj.gif
diff -N icons/full/obj16/brkp_obj.gif
Binary files /dev/null and brkp_obj.gif differ
Index: src/org/eclipse/cdt/debug/internal/ui/AddAddressBreakpointActionDelegate.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/internal/ui/AddAddressBreakpointActionDelegate.java
diff -N src/org/eclipse/cdt/debug/internal/ui/AddAddressBreakpointActionDelegate.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/internal/ui/AddAddressBreakpointActionDelegate.java 14 Jan 2003 20:25:38 -0000
@@ -0,0 +1,118 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+package org.eclipse.cdt.debug.internal.ui;
+
+import org.eclipse.cdt.debug.core.CDebugModel;
+import org.eclipse.cdt.debug.core.model.IExecFileInfo;
+import org.eclipse.cdt.debug.internal.ui.actions.AbstractListenerActionDelegate;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+
+/**
+ *
+ * Enter type comment.
+ *
+ * @since Jan 13, 2003
+ */
+public class AddAddressBreakpointActionDelegate extends AbstractListenerActionDelegate
+{
+ /**
+  *
+  * Enter type comment.
+  *
+  * @since Jan 13, 2003
+  */
+ public class AddressValidator implements IInputValidator
+ {
+  /**
+   * Constructor for AddressValidator.
+   */
+  public AddressValidator()
+  {
+   super();
+  }
+
+  /**
+   * @see org.eclipse.jface.dialogs.IInputValidator#isValid(String)
+   */
+  public String isValid( String newText )
+  {
+   if ( newText.trim().length() == 0 )
+    return "";
+   long value = 0;
+   try
+   {
+    value = parseValue( newText.trim() );
+   }
+   catch( NumberFormatException e )
+   {
+    return "Invalid address.";
+   }
+   return ( value > 0 ) ? null : "Address can not be 0.";
+  }
+ }
+
+ /**
+  * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#doAction(Object)
+  */
+ protected void doAction( Object element ) throws DebugException
+ {
+  InputDialog dialog = new InputDialog( getPage().getWorkbenchWindow().getShell(),
+             "Add Address Breakpoint",
+             "Enter address:",
+             null,
+             new AddressValidator() );
+  if ( dialog.open() == dialog.OK )
+  {
+   CDebugModel.createAddressBreakpoint( ((IExecFileInfo)getDebugTarget( element ).getAdapter( IExecFileInfo.class )).getExecFile(),
+             -1,
+             parseValue( dialog.getValue().trim() ),
+             true,
+             0,
+             "",
+             true );
+  }
+ }
+
+ /**
+  * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#isEnabledFor(Object)
+  */
+ protected boolean isEnabledFor( Object element )
+ {
+  if ( element != null && element instanceof IDebugElement )
+  {
+   IDebugTarget target = getDebugTarget( element );
+   return ( target != null && !target.isTerminated() && target.getAdapter( IExecFileInfo.class ) != null );
+  }
+  return false;
+ }

+ protected long parseValue( String text ) throws NumberFormatException
+ {
+  long value = 0;
+  if ( text.trim().startsWith( "0x" ) )
+  {
+   value = Integer.parseInt( text.substring( 2 ), 16 );
+  }
+  else
+  {
+   value = Integer.parseInt( text );
+  }
+  return value;
+ }

+ private IDebugTarget getDebugTarget( Object element )
+ {
+  if ( element != null && element instanceof IDebugElement )
+  {
+   return ((IDebugElement)element).getDebugTarget();
+  }
+  return null;
+ }
+}

Back to the top