mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 09:45:39 +02:00
added new Debugger extension
This commit is contained in:
parent
44e30964ff
commit
912ea8b98a
7 changed files with 159 additions and 21 deletions
|
@ -1,2 +1,3 @@
|
||||||
pluginName=CDT Debug Core Plug-in
|
pluginName=CDT Debug Core Plug-in
|
||||||
providerName=Eclipse.org
|
providerName=Eclipse.org
|
||||||
|
CDTDebugger.name=C/C++ Core Debugger Extension
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<plugin
|
<plugin
|
||||||
id="org.eclipse.cdt.debug.core"
|
id="org.eclipse.cdt.debug.core"
|
||||||
name="%pluginName"
|
name="%pluginName"
|
||||||
version="1.0.0"
|
version="1.0.0"
|
||||||
provider-name="%providerName"
|
provider-name="%providerName"
|
||||||
class="org.eclipse.cdt.debug.core.CDebugCorePlugin">
|
class="org.eclipse.cdt.debug.core.CDebugCorePlugin">
|
||||||
|
|
||||||
<runtime>
|
<runtime>
|
||||||
<library name="cdebugcore.jar">
|
<library name="cdebugcore.jar">
|
||||||
<export name="*"/>
|
<export name="*"/>
|
||||||
</library>
|
</library>
|
||||||
</runtime>
|
</runtime>
|
||||||
<requires>
|
<requires>
|
||||||
<import plugin="org.eclipse.core.resources"/>
|
<import plugin="org.eclipse.core.resources"/>
|
||||||
</requires>
|
<import plugin="org.eclipse.debug.core"/>
|
||||||
|
</requires>
|
||||||
|
|
||||||
</plugin>
|
|
||||||
|
<extension-point id="CDebugger" name="%CDebugger.name"/>
|
||||||
|
|
||||||
|
</plugin>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.core;
|
package org.eclipse.cdt.debug.core;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.internal.core.CDebuggerManager;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.IPluginDescriptor;
|
import org.eclipse.core.runtime.IPluginDescriptor;
|
||||||
|
@ -27,6 +28,8 @@ public class CDebugCorePlugin extends Plugin
|
||||||
//The shared instance.
|
//The shared instance.
|
||||||
private static CDebugCorePlugin plugin;
|
private static CDebugCorePlugin plugin;
|
||||||
|
|
||||||
|
private CDebuggerManager debuggerManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constructor.
|
* The constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -104,4 +107,11 @@ public class CDebugCorePlugin extends Plugin
|
||||||
{
|
{
|
||||||
getDefault().getLog().log( status );
|
getDefault().getLog().log( status );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ICDebuggerManager getDebuggerManager() {
|
||||||
|
if ( debuggerManager == null ) {
|
||||||
|
debuggerManager = new CDebuggerManager();
|
||||||
|
}
|
||||||
|
return debuggerManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
/*
|
||||||
|
* (c) Copyright QNX Software System Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.core;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
|
||||||
|
public interface ICDebugger {
|
||||||
|
public ICDISession createLaunchSession(ILaunchConfiguration config, IFile exe) throws CDIException ;
|
||||||
|
public ICDISession createAttachSession(ILaunchConfiguration config, IFile exe, int pid) throws CDIException;
|
||||||
|
public ICDISession createCoreSession(ILaunchConfiguration config, IFile exe, IFile corefile) throws CDIException;
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
/*
|
||||||
|
* (c) Copyright QNX Software System Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*/package org.eclipse.cdt.debug.core;
|
||||||
|
|
||||||
|
public interface ICDebuggerInfo {
|
||||||
|
String getID();
|
||||||
|
String getName();
|
||||||
|
String[] getSupportedPlatforms();
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
/*
|
||||||
|
* (c) Copyright QNX Software System Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.core;
|
||||||
|
|
||||||
|
public interface ICDebuggerManager {
|
||||||
|
public ICDebugger createDebugger(String id);
|
||||||
|
public ICDebuggerInfo[] queryDebuggers(String platform_id);
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
* (c) Copyright QNX Software System Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.internal.core;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
|
import org.eclipse.cdt.debug.core.ICDebugger;
|
||||||
|
import org.eclipse.cdt.debug.core.ICDebuggerManager;
|
||||||
|
import org.eclipse.cdt.debug.core.ICDebuggerInfo;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
import org.eclipse.core.runtime.IExtension;
|
||||||
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
|
|
||||||
|
public class CDebuggerManager implements ICDebuggerManager {
|
||||||
|
|
||||||
|
public CDebuggerManager() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICDebugger createDebugger(String id) {
|
||||||
|
ICDebugger debugger = null;
|
||||||
|
|
||||||
|
IExtensionPoint extension = CDebugCorePlugin.getDefault().getDescriptor().getExtensionPoint("CDebugger");
|
||||||
|
if (extension != null) {
|
||||||
|
IExtension[] extensions = extension.getExtensions();
|
||||||
|
for(int i = 0; i < extensions.length; i++){
|
||||||
|
if ( id.equals(extensions[i].getUniqueIdentifier()) ) {
|
||||||
|
IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
|
||||||
|
try {
|
||||||
|
debugger = (ICDebugger)configElements[0].createExecutableExtension("class");
|
||||||
|
}
|
||||||
|
catch (CoreException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return debugger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICDebuggerInfo[] queryDebuggers(String platform_id) {
|
||||||
|
IExtensionPoint extension = CDebugCorePlugin.getDefault().getDescriptor().getExtensionPoint("CDebugger");
|
||||||
|
if (extension != null) {
|
||||||
|
IExtension[] extensions = extension.getExtensions();
|
||||||
|
CDebuggerInfo dinfo;
|
||||||
|
ArrayList dlist = new ArrayList(extensions.length);
|
||||||
|
for(int i = 0; i < extensions.length; i++){
|
||||||
|
IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
|
||||||
|
String platform = configElements[0].getAttribute("platform");
|
||||||
|
if ( platform == null || platform.equals("*") || platform.indexOf(platform_id) != -1 ) {
|
||||||
|
dlist.add(dinfo = new CDebuggerInfo());
|
||||||
|
dinfo.name = extensions[i].getLabel();
|
||||||
|
dinfo.id = extensions[i].getUniqueIdentifier();
|
||||||
|
dinfo.platforms = platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (ICDebuggerInfo[]) dlist.toArray(new ICDebuggerInfo[dlist.size()]);
|
||||||
|
}
|
||||||
|
return new ICDebuggerInfo[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
class CDebuggerInfo implements ICDebuggerInfo {
|
||||||
|
String id;
|
||||||
|
String name;
|
||||||
|
String platforms;
|
||||||
|
|
||||||
|
public String getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getSupportedPlatforms() {
|
||||||
|
StringTokenizer stoken = new StringTokenizer(platforms, ",");
|
||||||
|
String[] platforms = new String[stoken.countTokens()];
|
||||||
|
for( int i = 0; i < platforms.length; i++ ) {
|
||||||
|
platforms[i] = stoken.nextToken();
|
||||||
|
}
|
||||||
|
return platforms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue