Skip to main content

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

I agree that using a command factory can help insulate the generic MI services from minor and syntax changes in MI protocol between versions and platforms. But if we decide to use this patter, I suggest that we refactor all the services and switch all the services to use a factory. It might even be prudent to make the constructors in those commands to be protected to avoid confusion as to which interface to use. To save time, we could copy over the CDI-GDB factories along with their common protocol implementation variations. That said, I'm not convinced that this problem really requires the use of a command factory. From my understanding of the problem, which could be wrong, is that certain commands in GDB do not properly interpret the escaping of backslashes. While, this manifests itself on Windows, I don't think it's a GDB-on-windows specific problem. I.e. if you were to build your sources on windows, then run GDB natively on Linux, you'd also see this bug.
We can discuss this further at tomorrow's meeting.

Tobias Södergren XT wrote:
I'm looking at the MIBreakpoins service which I guess would be a good candidate to change.

The MIBreakpoints.addBreakpoint(...) ends with:
		// Execute the command
            new MIBreakInsert(context, isTemporary, isHardware, condition, ignoreCount, location, tid), addBreakpointDRM);

which could make use of a factory service for the insert commmand. I'll implement the command factory and add patches to the issue.


From: dsdp-dd-dev-bounces@xxxxxxxxxxx [mailto:dsdp-dd-dev-bounces@xxxxxxxxxxx] On Behalf Of Tobias Södergren XT
Sent: den 25 februari 2008 12:48
To: Device Debugging developer discussions
Subject: [dsdp-dd-dev] 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: =================================================================== RCS file: diff -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,42 @@ +package; + +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 = "\\\\ <file://\\\\> "; //$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); + } + +}
dsdp-dd-dev mailing list

Back to the top