Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dsdp-dd-dev] Windows version of the MIBrekInsert command

Title: Windows version of the MIBrekInsert command

Below a first attempt to provide a Windows version of the MIBreakInsert command.
Please notice the package and the name of the class, what do you think about that strategy?

So if this it going to be used, the question is who will be in charge of finding out which version
of the MIBreakInsert command that should be instantiated.

I propose a IMICommandFactoryService (or something with a better name) interface
for an OSGi service responsible for instantiating commands.

The different implementations of the service could be chosed by either one of or a mix of:

o The operating system on which Eclipse is running - which version is then specified by the feature.xml
o The dialect of the MI commands, as chosen in the debug config dialog

I think we discussed something like this on the previous phone meeting.

WDYT?

/Tobias

Index: MIWinBreakInsert.java
===================================================================
RCS file: MIWinBreakInsert.java
diff -N MIWinBreakInsert.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ MIWinBreakInsert.java       1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,42 @@
+package org.eclipse.dd.mi.service.command.commands.win;
+
+import org.eclipse.dd.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
+import org.eclipse.dd.mi.service.command.commands.MIBreakInsert;
+
+/**
+ * This is a windows specific adjustment to the {@link MIBreakInsert} command.
+ *
+ * Usually backslashes should be escaped to double backslashes for MI commands.
+ * In this case the path parameter 'line' should not be escaped.
+ *
+ * @author Tobias Sodergren
+ *
+ */
+public class MIWinBreakInsert extends MIBreakInsert {
+
+       private static final String DOUBLE_BACKSLASH = "\\\\"; //$NON-NLS-1$
+       private static final String SINGLE_BACKSLASH = "\\"; //$NON-NLS-1$
+      
+       /**
+        * Constructor as expected from {@link MIBreakInsert}.
+        *
+        * @see MIBreakInsert.
+        */
+       public MIWinBreakInsert(IBreakpointsTargetDMContext ctx,
+                       boolean isTemporary, boolean isHardware, String condition,
+                       int ignoreCount, String line, int tid) {
+               super(ctx, isTemporary, isHardware, condition, ignoreCount, line, tid);
+       }
+
+       /**
+        * The back-slashes in the path for this command should not be escaped.
+        */
+       @Override
+       protected String parametersToString() {
+               // This was simple, there's only one parameter and it is a path:line
+               // number.
+               String result = super.parametersToString();
+               return result.replace(DOUBLE_BACKSLASH, SINGLE_BACKSLASH);
+       }
+
+}


Back to the top