diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog index b3365fb8e0a..a579bd43c7b 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog @@ -1,3 +1,15 @@ +2002-11-26 Doug Schaefer + + * src/.../mi/core/CygwinGDBDebugger.java: + New Debugger that provides the Cygwin Command Factory to the MISession + * src/.../mi/core/command/CygwinCommandFactory.java: + New Command Factory for Cygwin specific implementations of the commands + * src/.../mi/core/command/CygwinMIEnvironmentDirectory.java: + New. Subclasses the MIEnvironmentDirectory command to convert the + paths using cygpath. + * plugin.xml: + Defines the new debugger extension. + 2002-11-25 Alain Magloire * src/.../mi/core/cdi/Watchpoint.java: diff --git a/debug/org.eclipse.cdt.debug.mi.core/plugin.properties b/debug/org.eclipse.cdt.debug.mi.core/plugin.properties index 7c348d9be4a..70fd7aaa530 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/plugin.properties +++ b/debug/org.eclipse.cdt.debug.mi.core/plugin.properties @@ -1,4 +1,5 @@ pluginName=C/C++ Development Tools GDB/MI CDI Debugger Core providerName=Eclipse.org -GDBDebugger.name=GDB Debugger \ No newline at end of file +GDBDebugger.name=GDB Debugger +CygwinGDBDebugger.name=Cygwin GDB Debugger \ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.mi.core/plugin.xml b/debug/org.eclipse.cdt.debug.mi.core/plugin.xml index 3f1d8dd235d..225f3c08acb 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/plugin.xml +++ b/debug/org.eclipse.cdt.debug.mi.core/plugin.xml @@ -18,17 +18,24 @@ - + id="org.eclipse.cdt.debug.mi.core.CDebugger"> + + diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java new file mode 100644 index 00000000000..8a056eef8f5 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java @@ -0,0 +1,57 @@ +/* + * (c) Copyright Rational Software Corporation. 2002. + * All Rights Reserved. + */ + +package org.eclipse.cdt.debug.mi.core; + +import org.eclipse.cdt.debug.core.cdi.CDIException; +import org.eclipse.cdt.debug.core.cdi.ICDISession; +import org.eclipse.cdt.debug.mi.core.cdi.CSession; +import org.eclipse.cdt.debug.mi.core.command.CygwinCommandFactory; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IPath; +import org.eclipse.debug.core.ILaunchConfiguration; + +/** + * @author Doug Schaefer + * + * Cygwin GDB Debugger overrides the GDB Debugger to apply the Cygwin + * Command Factory to the MI Session. + */ +public class CygwinGDBDebugger extends GDBDebugger { + + static final CygwinCommandFactory commandFactory = + new CygwinCommandFactory(); + + public ICDISession createLaunchSession( + ILaunchConfiguration config, + IFile exe) + throws CDIException { + CSession session = (CSession) super.createLaunchSession(config, exe); + session.getMISession().setCommandFactory(commandFactory); + return session; + } + + public ICDISession createAttachSession( + ILaunchConfiguration config, + IFile exe, + int pid) + throws CDIException { + CSession session = + (CSession) super.createAttachSession(config, exe, pid); + session.getMISession().setCommandFactory(commandFactory); + return session; + } + + public ICDISession createCoreSession( + ILaunchConfiguration config, + IFile exe, + IPath corefile) + throws CDIException { + CSession session = + (CSession) super.createCoreSession(config, exe, corefile); + session.getMISession().setCommandFactory(commandFactory); + return session; + } +} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/command/CygwinCommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/command/CygwinCommandFactory.java new file mode 100644 index 00000000000..16d0e408f8c --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/command/CygwinCommandFactory.java @@ -0,0 +1,21 @@ +/* + *(c) Copyright Rational Software Corporation, 2002 + * All Rights Reserved. + * + */ + +package org.eclipse.cdt.debug.mi.core.command; + +/** + * @author Doug Schaefer + * + * Cygwin Command Factory overrides the regular Command Factory to allow for + * commands to take into account the cygwin environment. + */ +public class CygwinCommandFactory extends CommandFactory { + + public MIEnvironmentDirectory createMIEnvironmentDirectory(String[] pathdirs) { + return new CygwinMIEnvironmentDirectory(pathdirs); + } + +} diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/command/CygwinMIEnvironmentDirectory.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/command/CygwinMIEnvironmentDirectory.java new file mode 100644 index 00000000000..571c7ea71eb --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/command/CygwinMIEnvironmentDirectory.java @@ -0,0 +1,45 @@ +/* + *(c) Copyright Rational Software Corporation, 2002 + * All Rights Reserved. + * + */ + +package org.eclipse.cdt.debug.mi.core.command; + +import java.io.ByteArrayOutputStream; + +import org.eclipse.cdt.core.CommandLauncher; +import org.eclipse.core.runtime.Path; + +/** + * @author Doug Schaefer + * + * Cygwin implementation of the MIEnvironmentDirectory command. In the cygwin + * environment, the paths are DOS paths and need to be converted to cygwin + * style paths before passing them to gdb. + */ +public class CygwinMIEnvironmentDirectory extends MIEnvironmentDirectory { + + CygwinMIEnvironmentDirectory(String[] paths) { + super(paths); + + String[] newpaths = new String[paths.length]; + for (int i = 0; i < paths.length; i++) { + // Use the cygpath utility to convert the path + CommandLauncher launcher = new CommandLauncher(); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + + launcher.execute( + new Path("cygpath"), + new String[] { paths[i] }, + new String[0], + new Path(".")); + if (launcher.waitAndRead(output, output) != CommandLauncher.OK) + newpaths[i] = paths[i]; + else + newpaths[i] = output.toString().trim(); + } + + setParameters(newpaths); + } +} diff --git a/debug/org.eclipse.cdt.debug.mi.ui/ChangeLog b/debug/org.eclipse.cdt.debug.mi.ui/ChangeLog new file mode 100644 index 00000000000..9703886074a --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.ui/ChangeLog @@ -0,0 +1,4 @@ +2002-11-26 Doug Schaefer + + * plugin.xml: + Added new debugPage for Cygwin GDB. diff --git a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml index 3ee502d8dc3..c7e4694a468 100644 --- a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml @@ -31,7 +31,13 @@ id="org.eclipse.cdt.debug.mi.CDebuggerPage" debuggerID="org.eclipse.cdt.debug.mi.core.CDebugger"> + + +