1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Support for cygwin debugger.

This commit is contained in:
Alain Magloire 2002-11-27 16:26:46 +00:00
parent f8f4d2617f
commit dc382d4604
8 changed files with 158 additions and 5 deletions

View file

@ -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:

View file

@ -2,3 +2,4 @@ pluginName=C/C++ Development Tools GDB/MI CDI Debugger Core
providerName=Eclipse.org
GDBDebugger.name=GDB Debugger
CygwinGDBDebugger.name=Cygwin GDB Debugger

View file

@ -18,17 +18,24 @@
<import plugin="org.eclipse.cdt.core"/>
</requires>
<extension
point="org.eclipse.cdt.debug.core.CDebugger">
<debugger
platform="native"
name="%GDBDebugger.name"
modes="run,core,attach"
cpu="native"
class="org.eclipse.cdt.debug.mi.core.GDBDebugger"
id="org.eclipse.cdt.debug.mi.core.CDebugger"
cpu="native"
platform="native">
id="org.eclipse.cdt.debug.mi.core.CDebugger">
</debugger>
<debugger
platform="win32"
name="%CygwinGDBDebugger.name"
modes="run,core,attach"
cpu="native"
class="org.eclipse.cdt.debug.mi.core.CygwinGDBDebugger"
id="org.eclipse.cdt.debug.mi.core.CygwinCDebugger">
</debugger>
</extension>
</plugin>

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -0,0 +1,4 @@
2002-11-26 Doug Schaefer
* plugin.xml:
Added new debugPage for Cygwin GDB.

View file

@ -31,7 +31,13 @@
id="org.eclipse.cdt.debug.mi.CDebuggerPage"
debuggerID="org.eclipse.cdt.debug.mi.core.CDebugger">
</debugPage>
<debugPage
class="org.eclipse.cdt.debug.mi.internal.ui.CDebuggerPage"
id="org.eclipse.cdt.debug.mi.CygwinCDebuggerPage"
debuggerID="org.eclipse.cdt.debug.mi.core.CygwinCDebugger">
</debugPage>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page