Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Khouzam2014-07-23 20:06:11 +0000
committerMarc Khouzam2014-12-18 17:32:59 +0000
commit13893bc0ead4ad0a385f1f3e9b67590eaa065355 (patch)
treede9a271dfcf461aa7c4f438c57bd6155d0512e99
parentaccfa032aa7e4f22b96510709bcaca12525740d7 (diff)
downloadorg.eclipse.cdt-13893bc0ead4ad0a385f1f3e9b67590eaa065355.tar.gz
org.eclipse.cdt-13893bc0ead4ad0a385f1f3e9b67590eaa065355.tar.xz
org.eclipse.cdt-13893bc0ead4ad0a385f1f3e9b67590eaa065355.zip
Bug 441277 - Provide an example plugin to show how to extend DSF-GDB
Change-Id: Ic6efd321d09bfc4d62344244c419dc6b0b9758ec Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com> Reviewed-on: https://git.eclipse.org/r/30660 Tested-by: Hudson CI
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/.classpath7
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/.project28
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/.settings/org.eclipse.jdt.core.prefs70
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/META-INF/MANIFEST.MF27
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/about.html28
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/build.properties5
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/plugin.xml76
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/pom.xml17
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GDBExamplePlugin.java67
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GdbExtendedAdapterFactory.java434
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedFinalLaunchSequence_7_7.java124
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunch.java24
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunchDelegate.java56
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedServicesLaunchSequence.java43
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedControl_7_7.java32
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedService.java121
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactory.java63
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactoryNS.java31
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/IGDBExtendedFunctions.java30
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/GdbExtendedCommandFactory_6_8.java36
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/commands/CLIGDBVersion.java36
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedLaunchVMProvider.java50
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedThreadVMNode.java172
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedVMMessages.java33
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedVMMessages.properties41
-rw-r--r--dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedViewModelAdapter.java42
-rw-r--r--pom.xml1
27 files changed, 1694 insertions, 0 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/.classpath b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/.classpath
new file mode 100644
index 0000000000..098194ca4b
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/.project b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/.project
new file mode 100644
index 0000000000..9bcd88e7af
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.cdt.examples.dsf.gdb</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/.settings/org.eclipse.jdt.core.prefs b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..625b641ae3
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,70 @@
+#Tue Jun 24 11:04:03 PDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/META-INF/MANIFEST.MF b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..3cad61e975
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/META-INF/MANIFEST.MF
@@ -0,0 +1,27 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: GDB DSF Debugger Extension Example
+Bundle-SymbolicName: org.eclipse.cdt.examples.dsf.gdb;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.cdt.examples.dsf.gdb.GDBExamplePlugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.cdt.dsf.gdb,
+ org.eclipse.cdt.dsf,
+ org.eclipse.debug.core,
+ org.eclipse.cdt.launch,
+ org.eclipse.debug.ui,
+ org.eclipse.cdt.dsf.gdb.ui,
+ org.eclipse.cdt.dsf.ui,
+ org.eclipse.cdt.ui,
+ org.eclipse.cdt.debug.core,
+ org.eclipse.cdt.debug.ui
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: Eclipse CDT
+Export-Package: org.eclipse.cdt.examples.dsf.gdb;x-internal:=true,
+ org.eclipse.cdt.examples.dsf.gdb.launch;x-internal:=true,
+ org.eclipse.cdt.examples.dsf.gdb.service;x-internal:=true,
+ org.eclipse.cdt.examples.dsf.gdb.service.command;x-internal:=true,
+ org.eclipse.cdt.examples.dsf.gdb.service.command.commands;x-internal:=true,
+ org.eclipse.cdt.examples.dsf.gdb.viewmodel;x-internal:=true
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/about.html b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/about.html
new file mode 100644
index 0000000000..c1cb2e12f4
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>May 14, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/build.properties b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/build.properties
new file mode 100644
index 0000000000..e9863e281e
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/plugin.xml b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/plugin.xml
new file mode 100644
index 0000000000..d82f295af9
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/plugin.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension point="org.eclipse.debug.core.launchDelegates">
+ <launchDelegate
+ id="org.eclipse.cdt.examples.dsf.gdb.launchDelegate"
+ type="org.eclipse.cdt.launch.applicationLaunchType"
+ modes="debug"
+ delegate="org.eclipse.cdt.examples.dsf.gdb.launch.GdbExtendedLaunchDelegate"
+ name="Example GDB Extended Launch Delegate"
+ delegateDescription="Launch Delegate that uses an example extension to the CDT's GDB launch."
+ sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+ sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
+ </launchDelegate>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTabs">
+ <!-- Local application launch tabs-->
+ <tab
+ id="org.eclipse.cdt.dsf.gdb.launch.localApplicationLaunch.mainTab"
+ group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
+ name="%launchTab.main.name"
+ class="org.eclipse.cdt.dsf.gdb.internal.ui.launching.CMainTab">
+ <associatedDelegate delegate="org.eclipse.cdt.examples.dsf.gdb.launchDelegate"/>
+ </tab>
+ <tab id="org.eclipse.cdt.dsf.gdb.launch.localApplicationLaunch.argumentsTab"
+ group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
+ name="%launchTab.arguments.name"
+ class="org.eclipse.cdt.dsf.gdb.internal.ui.launching.CArgumentsTab">
+ <associatedDelegate delegate="org.eclipse.cdt.examples.dsf.gdb.launchDelegate"/>
+ <placement after="org.eclipse.cdt.dsf.gdb.launch.mainTab"/>
+ </tab>
+ <tab
+ id="org.eclipse.cdt.dsf.gdb.launch.localApplicationLaunch.environmentTab"
+ group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
+ name="%launchTab.environment.name"
+ class="org.eclipse.debug.ui.EnvironmentTab">
+ <associatedDelegate delegate="org.eclipse.cdt.examples.dsf.gdb.launchDelegate"/>
+ <placement after="org.eclipse.cdt.dsf.gdb.launch.argumentsTab"/>
+ </tab>
+ <tab
+ id="org.eclipse.cdt.dsf.gdb.launch.localApplicationLaunch.debuggerTab"
+ group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
+ name="%launchTab.debugger.name"
+ class="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab">
+ <associatedDelegate delegate="org.eclipse.cdt.examples.dsf.gdb.launchDelegate"/>
+ <placement after="org.eclipse.debug.ui.environmentTab"/>
+ </tab>
+ <tab
+ id="org.eclipse.cdt.dsf.gdb.launch.localApplicationLaunch.sourceLookupTab"
+ group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
+ name="%launchTab.sourceLookup.name"
+ class="org.eclipse.debug.ui.sourcelookup.SourceLookupTab">
+ <associatedDelegate delegate="org.eclipse.cdt.examples.dsf.gdb.launchDelegate"/>
+ <placement after="org.eclipse.cdt.dsf.gdb.launch.debuggerTab"/>
+ </tab>
+ <tab
+ id="org.eclipse.cdt.dsf.gdb.launch.localApplicationLaunch.commonTab"
+ group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
+ name="%launchTab.common.name"
+ class="org.eclipse.debug.ui.CommonTab">
+ <associatedDelegate delegate="org.eclipse.cdt.examples.dsf.gdb.launchDelegate"/>
+ <placement after="org.eclipse.debug.ui.sourceLookupTab"/>
+ </tab>
+ </extension>
+ <extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ class="org.eclipse.cdt.examples.dsf.gdb.GdbExtendedAdapterFactory"
+ adaptableType="org.eclipse.cdt.examples.dsf.gdb.launch.GdbExtendedLaunch">
+ <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"/>
+ <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"/>
+ <adapter type="org.eclipse.debug.ui.contexts.ISuspendTrigger"/>
+ <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory"/>
+ </factory>
+ </extension>
+</plugin>
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/pom.xml b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/pom.xml
new file mode 100644
index 0000000000..39a25d8ca6
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/pom.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.cdt</groupId>
+ <artifactId>cdt-parent</artifactId>
+ <version>8.5.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <version>1.0.0-SNAPSHOT</version>
+ <artifactId>org.eclipse.cdt.examples.dsf.gdb</artifactId>
+ <packaging>eclipse-plugin</packaging>
+</project>
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GDBExamplePlugin.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GDBExamplePlugin.java
new file mode 100644
index 0000000000..86609f1dcf
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GDBExamplePlugin.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class GDBExamplePlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.cdt.examples.dsf.gdb"; //$NON-NLS-1$
+
+ // The shared instance
+ private static GDBExamplePlugin plugin;
+
+ private static BundleContext fgBundleContext;
+
+ /**
+ * The constructor
+ */
+ public GDBExamplePlugin() {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ fgBundleContext = context;
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ fgBundleContext = null;
+ }
+
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static GDBExamplePlugin getDefault() {
+ return plugin;
+ }
+
+ public static BundleContext getBundleContext() {
+ return fgBundleContext;
+ }
+
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GdbExtendedAdapterFactory.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GdbExtendedAdapterFactory.java
new file mode 100644
index 0000000000..d509ad0704
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/GdbExtendedAdapterFactory.java
@@ -0,0 +1,434 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.cdt.debug.core.model.IConnectHandler;
+import org.eclipse.cdt.debug.core.model.IDebugNewExecutableHandler;
+import org.eclipse.cdt.debug.core.model.IResumeWithoutSignalHandler;
+import org.eclipse.cdt.debug.core.model.IReverseResumeHandler;
+import org.eclipse.cdt.debug.core.model.IReverseStepIntoHandler;
+import org.eclipse.cdt.debug.core.model.IReverseStepOverHandler;
+import org.eclipse.cdt.debug.core.model.IReverseToggleHandler;
+import org.eclipse.cdt.debug.core.model.ISaveTraceDataHandler;
+import org.eclipse.cdt.debug.core.model.IStartTracingHandler;
+import org.eclipse.cdt.debug.core.model.IStepIntoSelectionHandler;
+import org.eclipse.cdt.debug.core.model.ISteppingModeTarget;
+import org.eclipse.cdt.debug.core.model.IStopTracingHandler;
+import org.eclipse.cdt.debug.core.model.IUncallHandler;
+import org.eclipse.cdt.debug.ui.IPinProvider;
+import org.eclipse.cdt.dsf.concurrent.Immutable;
+import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
+import org.eclipse.cdt.dsf.debug.ui.actions.DsfResumeCommand;
+import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepIntoCommand;
+import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepIntoSelectionCommand;
+import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepOverCommand;
+import org.eclipse.cdt.dsf.debug.ui.actions.DsfStepReturnCommand;
+import org.eclipse.cdt.dsf.debug.ui.actions.DsfSuspendCommand;
+import org.eclipse.cdt.dsf.debug.ui.actions.IDsfStepIntoSelection;
+import org.eclipse.cdt.dsf.debug.ui.sourcelookup.DsfSourceDisplayAdapter;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.SteppingController;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.actions.DefaultRefreshAllTarget;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.actions.IRefreshAllTarget;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.DefaultDsfModelSelectionPolicyFactory;
+import org.eclipse.cdt.dsf.gdb.internal.commands.ISelectNextTraceRecordHandler;
+import org.eclipse.cdt.dsf.gdb.internal.commands.ISelectPrevTraceRecordHandler;
+import org.eclipse.cdt.dsf.gdb.internal.ui.GdbDebugTextHover;
+import org.eclipse.cdt.dsf.gdb.internal.ui.GdbPinProvider;
+import org.eclipse.cdt.dsf.gdb.internal.ui.GdbSuspendTrigger;
+import org.eclipse.cdt.dsf.gdb.internal.ui.actions.DsfTerminateCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbDisconnectCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbRestartCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.actions.GdbSteppingModeTarget;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbConnectCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbDebugNewExecutableCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbResumeWithoutSignalCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseResumeCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseStepIntoCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseStepOverCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbReverseToggleCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbSaveTraceDataCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbSelectNextTraceRecordCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbSelectPrevTraceRecordCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbStartTracingCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbStopTracingCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.commands.GdbUncallCommand;
+import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.GdbViewModelAdapter;
+import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
+import org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.examples.dsf.gdb.viewmodel.GdbExtendedViewModelAdapter;
+import org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchesListener2;
+import org.eclipse.debug.core.commands.IDisconnectHandler;
+import org.eclipse.debug.core.commands.IRestartHandler;
+import org.eclipse.debug.core.commands.IResumeHandler;
+import org.eclipse.debug.core.commands.IStepIntoHandler;
+import org.eclipse.debug.core.commands.IStepOverHandler;
+import org.eclipse.debug.core.commands.IStepReturnHandler;
+import org.eclipse.debug.core.commands.ISuspendHandler;
+import org.eclipse.debug.core.commands.ITerminateHandler;
+import org.eclipse.debug.core.model.IDebugModelProvider;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicyFactory;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputProvider;
+import org.eclipse.debug.ui.contexts.ISuspendTrigger;
+import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
+
+/**
+ * This implementation of platform adapter factory only retrieves the adapters
+ * for the launch object. But it also manages the creation and destruction
+ * of the session-based adapters which are returned by the
+ * IDMContext.getAdapter() methods.
+ */
+@SuppressWarnings("restriction")
+@ThreadSafe
+public class GdbExtendedAdapterFactory
+ implements IAdapterFactory, ILaunchesListener2
+{
+ @Immutable
+ class SessionAdapterSet {
+ final GdbLaunch fLaunch;
+ final GdbViewModelAdapter fViewModelAdapter;
+ final DsfSourceDisplayAdapter fSourceDisplayAdapter;
+ final DsfStepIntoCommand fStepIntoCommand;
+ final DsfStepIntoSelectionCommand fStepIntoSelectionCommand;
+ final GdbReverseStepIntoCommand fReverseStepIntoCommand;
+ final DsfStepOverCommand fStepOverCommand;
+ final GdbReverseStepOverCommand fReverseStepOverCommand;
+ final DsfStepReturnCommand fStepReturnCommand;
+ final GdbUncallCommand fUncallCommand;
+ final DsfSuspendCommand fSuspendCommand;
+ final DsfResumeCommand fResumeCommand;
+ final GdbReverseResumeCommand fReverseResumeCommand;
+ final GdbResumeWithoutSignalCommand fResumeWithoutSignalCommand;
+ final GdbRestartCommand fRestartCommand;
+ final DsfTerminateCommand fTerminateCommand;
+ final GdbDebugNewExecutableCommand fDebugNewExecutableCommand;
+ final GdbConnectCommand fConnectCommand;
+ final GdbDisconnectCommand fDisconnectCommand;
+ final IDebugModelProvider fDebugModelProvider;
+ final GdbSuspendTrigger fSuspendTrigger;
+ final GdbSteppingModeTarget fSteppingModeTarget;
+ final IModelSelectionPolicyFactory fModelSelectionPolicyFactory;
+ final SteppingController fSteppingController;
+ final DefaultRefreshAllTarget fRefreshAllTarget;
+ final GdbReverseToggleCommand fReverseToggleTarget;
+ final GdbStartTracingCommand fStartTracingTarget;
+ final GdbStopTracingCommand fStopTracingTarget;
+ final GdbSaveTraceDataCommand fSaveTraceDataTarget;
+ final GdbSelectNextTraceRecordCommand fSelectNextRecordTarget;
+ final GdbSelectPrevTraceRecordCommand fSelectPrevRecordTarget;
+ final GdbDebugTextHover fDebugTextHover;
+ final GdbPinProvider fPinProvider;
+
+ SessionAdapterSet(GdbLaunch launch) {
+ fLaunch = launch;
+ DsfSession session = launch.getSession();
+
+ // register stepping controller
+ fSteppingController = new SteppingController(session);
+ session.registerModelAdapter(SteppingController.class, fSteppingController);
+
+ fViewModelAdapter = new GdbExtendedViewModelAdapter(session, fSteppingController);
+ session.registerModelAdapter(IViewerInputProvider.class, fViewModelAdapter);
+
+ if (launch.getSourceLocator() instanceof ISourceLookupDirector) {
+ fSourceDisplayAdapter = new DsfSourceDisplayAdapter(session, (ISourceLookupDirector)launch.getSourceLocator(), fSteppingController);
+ } else {
+ fSourceDisplayAdapter = null;
+ }
+ session.registerModelAdapter(ISourceDisplay.class, fSourceDisplayAdapter);
+
+ fSteppingModeTarget = new GdbSteppingModeTarget(session);
+ fStepIntoCommand = new DsfStepIntoCommand(session, fSteppingModeTarget);
+ fStepIntoSelectionCommand = new DsfStepIntoSelectionCommand(session);
+ fReverseStepIntoCommand = new GdbReverseStepIntoCommand(session, fSteppingModeTarget);
+ fStepOverCommand = new DsfStepOverCommand(session, fSteppingModeTarget);
+ fReverseStepOverCommand = new GdbReverseStepOverCommand(session, fSteppingModeTarget);
+ fStepReturnCommand = new DsfStepReturnCommand(session);
+ fUncallCommand = new GdbUncallCommand(session, fSteppingModeTarget);
+ fSuspendCommand = new DsfSuspendCommand(session);
+ fResumeCommand = new DsfResumeCommand(session);
+ fReverseResumeCommand = new GdbReverseResumeCommand(session);
+ fResumeWithoutSignalCommand = new GdbResumeWithoutSignalCommand(session);
+ fRestartCommand = new GdbRestartCommand(session, fLaunch);
+ fTerminateCommand = new DsfTerminateCommand(session);
+ fDebugNewExecutableCommand = new GdbDebugNewExecutableCommand(session, fLaunch);
+ fConnectCommand = new GdbConnectCommand(session, fLaunch);
+ fDisconnectCommand = new GdbDisconnectCommand(session);
+ fSuspendTrigger = new GdbSuspendTrigger(session, fLaunch);
+ fModelSelectionPolicyFactory = new DefaultDsfModelSelectionPolicyFactory();
+ fRefreshAllTarget = new DefaultRefreshAllTarget();
+ fReverseToggleTarget = new GdbReverseToggleCommand(session);
+ fStartTracingTarget = new GdbStartTracingCommand(session);
+ fStopTracingTarget = new GdbStopTracingCommand(session);
+ fSaveTraceDataTarget = new GdbSaveTraceDataCommand(session);
+ fSelectNextRecordTarget = new GdbSelectNextTraceRecordCommand(session);
+ fSelectPrevRecordTarget = new GdbSelectPrevTraceRecordCommand(session);
+ fPinProvider = new GdbPinProvider(session);
+
+ session.registerModelAdapter(ISteppingModeTarget.class, fSteppingModeTarget);
+ session.registerModelAdapter(IStepIntoHandler.class, fStepIntoCommand);
+ session.registerModelAdapter(IStepIntoSelectionHandler.class, fStepIntoSelectionCommand);
+ session.registerModelAdapter(IReverseStepIntoHandler.class, fReverseStepIntoCommand);
+ session.registerModelAdapter(IStepOverHandler.class, fStepOverCommand);
+ session.registerModelAdapter(IReverseStepOverHandler.class, fReverseStepOverCommand);
+ session.registerModelAdapter(IStepReturnHandler.class, fStepReturnCommand);
+ session.registerModelAdapter(IUncallHandler.class, fUncallCommand);
+ session.registerModelAdapter(ISuspendHandler.class, fSuspendCommand);
+ session.registerModelAdapter(IResumeHandler.class, fResumeCommand);
+ session.registerModelAdapter(IReverseResumeHandler.class, fReverseResumeCommand);
+ session.registerModelAdapter(IResumeWithoutSignalHandler.class, fResumeWithoutSignalCommand);
+ session.registerModelAdapter(IRestartHandler.class, fRestartCommand);
+ session.registerModelAdapter(ITerminateHandler.class, fTerminateCommand);
+ session.registerModelAdapter(IConnectHandler.class, fConnectCommand);
+ session.registerModelAdapter(IDebugNewExecutableHandler.class, fDebugNewExecutableCommand);
+ session.registerModelAdapter(IDisconnectHandler.class, fDisconnectCommand);
+ session.registerModelAdapter(IModelSelectionPolicyFactory.class, fModelSelectionPolicyFactory);
+ session.registerModelAdapter(IRefreshAllTarget.class, fRefreshAllTarget);
+ session.registerModelAdapter(IReverseToggleHandler.class, fReverseToggleTarget);
+ session.registerModelAdapter(IStartTracingHandler.class, fStartTracingTarget);
+ session.registerModelAdapter(IStopTracingHandler.class, fStopTracingTarget);
+ session.registerModelAdapter(ISaveTraceDataHandler.class, fSaveTraceDataTarget);
+ session.registerModelAdapter(ISelectNextTraceRecordHandler.class, fSelectNextRecordTarget);
+ session.registerModelAdapter(ISelectPrevTraceRecordHandler.class, fSelectPrevRecordTarget);
+ session.registerModelAdapter(IPinProvider.class, fPinProvider);
+ session.registerModelAdapter(IDsfStepIntoSelection.class, fStepIntoSelectionCommand);
+
+ fDebugModelProvider = new IDebugModelProvider() {
+ // @see org.eclipse.debug.core.model.IDebugModelProvider#getModelIdentifiers()
+ @Override
+ public String[] getModelIdentifiers() {
+ return new String[] { GdbLaunchDelegate.GDB_DEBUG_MODEL_ID, ICBreakpoint.C_BREAKPOINTS_DEBUG_MODEL_ID, "org.eclipse.cdt.gdb" }; //$NON-NLS-1$
+ }
+ };
+ session.registerModelAdapter(IDebugModelProvider.class, fDebugModelProvider);
+
+ /*
+ * Registering the launch as an adapter, ensures that this launch,
+ * and debug model ID will be associated with all DMContexts from this
+ * session.
+ */
+ session.registerModelAdapter(ILaunch.class, fLaunch);
+
+ /*
+ * Register debug hover adapter (bug 309001).
+ */
+ fDebugTextHover = new GdbDebugTextHover();
+ session.registerModelAdapter(ICEditorTextHover.class, fDebugTextHover);
+ }
+
+ void dispose() {
+ DsfSession session = fLaunch.getSession();
+
+ fViewModelAdapter.dispose();
+ session.unregisterModelAdapter(IViewerInputProvider.class);
+
+ session.unregisterModelAdapter(ISourceDisplay.class);
+ if (fSourceDisplayAdapter != null) fSourceDisplayAdapter.dispose();
+
+ session.unregisterModelAdapter(SteppingController.class);
+ fSteppingController.dispose();
+
+ session.unregisterModelAdapter(ISteppingModeTarget.class);
+ session.unregisterModelAdapter(IStepIntoHandler.class);
+ session.unregisterModelAdapter(IStepIntoSelectionHandler.class);
+ session.unregisterModelAdapter(IReverseStepIntoHandler.class);
+ session.unregisterModelAdapter(IStepOverHandler.class);
+ session.unregisterModelAdapter(IReverseStepOverHandler.class);
+ session.unregisterModelAdapter(IStepReturnHandler.class);
+ session.unregisterModelAdapter(IUncallHandler.class);
+ session.unregisterModelAdapter(ISuspendHandler.class);
+ session.unregisterModelAdapter(IResumeHandler.class);
+ session.unregisterModelAdapter(IReverseResumeHandler.class);
+ session.unregisterModelAdapter(IResumeWithoutSignalHandler.class);
+ session.unregisterModelAdapter(IRestartHandler.class);
+ session.unregisterModelAdapter(ITerminateHandler.class);
+ session.unregisterModelAdapter(IConnectHandler.class);
+ session.unregisterModelAdapter(IDebugNewExecutableHandler.class);
+ session.unregisterModelAdapter(IDisconnectHandler.class);
+ session.unregisterModelAdapter(IModelSelectionPolicyFactory.class);
+ session.unregisterModelAdapter(IRefreshAllTarget.class);
+ session.unregisterModelAdapter(IReverseToggleHandler.class);
+ session.unregisterModelAdapter(IStartTracingHandler.class);
+ session.unregisterModelAdapter(IStopTracingHandler.class);
+ session.unregisterModelAdapter(ISaveTraceDataHandler.class);
+ session.unregisterModelAdapter(ISelectNextTraceRecordHandler.class);
+ session.unregisterModelAdapter(ISelectPrevTraceRecordHandler.class);
+ session.unregisterModelAdapter(IPinProvider.class);
+
+ session.unregisterModelAdapter(IDebugModelProvider.class);
+ session.unregisterModelAdapter(ILaunch.class);
+
+ session.unregisterModelAdapter(ICEditorTextHover.class);
+
+ fSteppingModeTarget.dispose();
+ fStepIntoCommand.dispose();
+ fStepIntoSelectionCommand.dispose();
+ fReverseStepIntoCommand.dispose();
+ fStepOverCommand.dispose();
+ fReverseStepOverCommand.dispose();
+ fStepReturnCommand.dispose();
+ fUncallCommand.dispose();
+ fSuspendCommand.dispose();
+ fResumeCommand.dispose();
+ fReverseResumeCommand.dispose();
+ fResumeWithoutSignalCommand.dispose();
+ fRestartCommand.dispose();
+ fTerminateCommand.dispose();
+ fConnectCommand.dispose();
+ fDebugNewExecutableCommand.dispose();
+ fDisconnectCommand.dispose();
+ fSuspendTrigger.dispose();
+ fReverseToggleTarget.dispose();
+ fStartTracingTarget.dispose();
+ fStopTracingTarget.dispose();
+ fSaveTraceDataTarget.dispose();
+ fSelectNextRecordTarget.dispose();
+ fSelectPrevRecordTarget.dispose();
+ fPinProvider.dispose();
+ }
+ }
+
+ /**
+ * Active adapter sets. They are accessed using the launch instance
+ * which owns the debug services session.
+ */
+ private static Map<GdbLaunch, SessionAdapterSet> fgLaunchAdapterSets =
+ Collections.synchronizedMap(new HashMap<GdbLaunch, SessionAdapterSet>());
+
+ /**
+ * Map of launches for which adapter sets have already been disposed.
+ * This map (used as a set) is maintained in order to avoid re-creating an
+ * adapter set after the launch was removed from the launch manager, but
+ * while the launch is still being held by other classes which may
+ * request its adapters. A weak map is used to avoid leaking
+ * memory once the launches are no longer referenced.
+ * <p>
+ * Access to this map is synchronized using the fgLaunchAdapterSets
+ * instance.
+ * </p>
+ */
+ private static Map<ILaunch, SessionAdapterSet> fgDisposedLaunchAdapterSets =
+ new WeakHashMap<ILaunch, SessionAdapterSet>();
+
+ static void disposeAdapterSet(ILaunch launch) {
+ synchronized(fgLaunchAdapterSets) {
+ if ( fgLaunchAdapterSets.containsKey(launch) ) {
+ fgLaunchAdapterSets.remove(launch).dispose();
+ fgDisposedLaunchAdapterSets.put(launch, null);
+ }
+ }
+ }
+
+ public GdbExtendedAdapterFactory() {
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
+ }
+
+ /**
+ * This method only actually returns adapters for the launch object.
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (!(adaptableObject instanceof GdbLaunch)) return null;
+
+ GdbLaunch launch = (GdbLaunch)adaptableObject;
+
+ // Check for valid session.
+ // Note: even if the session is no longer active, the adapter set
+ // should still be returned. This is because the view model may still
+ // need to show elements representing a terminated process/thread/etc.
+ DsfSession session = launch.getSession();
+ if (session == null) return null;
+
+ // Find the correct set of adapters based on the launch session-ID. If not found
+ // it means that we have a new launch and new session, and we have to create a
+ // new set of adapters.
+
+ SessionAdapterSet adapterSet;
+ synchronized(fgLaunchAdapterSets) {
+ // The adapter set for the given launch was already disposed.
+ // Return a null adapter.
+ if (fgDisposedLaunchAdapterSets.containsKey(launch)) {
+ return null;
+ }
+ adapterSet = fgLaunchAdapterSets.get(launch);
+ if (adapterSet == null) {
+ // If the first time we attempt to create an adapterSet is once the session is
+ // already inactive, we should not create it and return null.
+ // This can happen, for example, when we run JUnit tests and we don't actually
+ // have a need for any adapters until the launch is actually being removed.
+ // Note that we must do this here because fgDisposedLaunchAdapterSets
+ // may not already know that the launch has been removed because of a race
+ // condition with the caller which is also processing a launchRemoved method.
+ // Bug 334687
+ if (session.isActive() == false) {
+ return null;
+ }
+ adapterSet = new SessionAdapterSet(launch);
+ fgLaunchAdapterSets.put(launch, adapterSet);
+ }
+ }
+
+ // Returns the adapter type for the launch object.
+ if (adapterType.equals(IElementContentProvider.class)) return adapterSet.fViewModelAdapter;
+ else if (adapterType.equals(IModelProxyFactory.class)) return adapterSet.fViewModelAdapter;
+ else if (adapterType.equals(IColumnPresentationFactory.class)) return adapterSet.fViewModelAdapter;
+ else if (adapterType.equals(ISuspendTrigger.class)) return adapterSet.fSuspendTrigger;
+ else return null;
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Class[] getAdapterList() {
+ return new Class[] {
+ IElementContentProvider.class, IModelProxyFactory.class, ISuspendTrigger.class,
+ IColumnPresentationFactory.class,
+ };
+ }
+
+ @Override
+ public void launchesRemoved(ILaunch[] launches) {
+ // Dispose the set of adapters for a launch only after the launch is
+ // removed.
+ for (ILaunch launch : launches) {
+ if (launch instanceof GdbLaunch) {
+ disposeAdapterSet(launch);
+ }
+ }
+ }
+
+ @Override
+ public void launchesTerminated(ILaunch[] launches) {
+ }
+
+ @Override
+ public void launchesAdded(ILaunch[] launches) {
+ }
+
+ @Override
+ public void launchesChanged(ILaunch[] launches) {
+ }
+
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedFinalLaunchSequence_7_7.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedFinalLaunchSequence_7_7.java
new file mode 100644
index 0000000000..8785ffb540
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedFinalLaunchSequence_7_7.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.launch;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
+import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
+import org.eclipse.cdt.dsf.gdb.launching.FinalLaunchSequence_7_7;
+import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
+import org.eclipse.cdt.dsf.service.DsfServicesTracker;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.examples.dsf.gdb.GDBExamplePlugin;
+import org.eclipse.cdt.examples.dsf.gdb.service.IGDBExtendedFunctions;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+public class GdbExtendedFinalLaunchSequence_7_7 extends FinalLaunchSequence_7_7 {
+
+ private IGDBControl fControl;
+ private DsfServicesTracker fTracker;
+
+ public GdbExtendedFinalLaunchSequence_7_7(DsfSession session, Map<String, Object> attributes, RequestMonitorWithProgress rm) {
+ super(session, attributes, rm);
+ }
+
+ @Override
+ protected String[] getExecutionOrder(String group) {
+ if (GROUP_TOP_LEVEL.equals(group)) {
+ // Initialize the list with the base class' steps
+ // We need to create a list that we can modify, which is why we create our own ArrayList.
+ List<String> orderList = new ArrayList<String>(Arrays.asList(super.getExecutionOrder(GROUP_TOP_LEVEL)));
+
+ // Now insert our init step right after the initialization of the base class.
+ orderList.add(orderList.indexOf("stepInitializeFinalLaunchSequence_7_7") + 1, "stepInitializeExtendedFinalLaunchSequence_7_7"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // As the first operation to do, show the user the version of GDB
+ orderList.add(orderList.indexOf("stepInitializeExtendedFinalLaunchSequence_7_7") + 1, "stepNotifyVersion"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Add the step to set pagination before the .gdbinit file is sourced
+ // that way the user can override this setting using .gdbinit.
+ orderList.add(orderList.indexOf("stepSourceGDBInitFile"), "stepSetPagination"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ return orderList.toArray(new String[orderList.size()]);
+ }
+
+ return null;
+ }
+
+ @Execute
+ public void stepInitializeExtendedFinalLaunchSequence_7_7(RequestMonitor rm) {
+ fTracker = new DsfServicesTracker(GDBExamplePlugin.getBundleContext(), getSession().getId());
+ fControl = fTracker.getService(IGDBControl.class);
+
+ if (fControl == null) {
+ rm.done(new Status(IStatus.ERROR, GDBExamplePlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Cannot obtain service", null)); //$NON-NLS-1$
+ return;
+ }
+
+ rm.done();
+ }
+
+ @RollBack("stepInitializeExtendedFinalLaunchSequence_7_7")
+ public void rollBackInitializeExtendedFinalLaunchSequence_7_7(RequestMonitor rm) {
+ if (fTracker != null) fTracker.dispose();
+ fTracker = null;
+ rm.done();
+ }
+
+ @Execute
+ public void stepNotifyVersion(final RequestMonitor rm) {
+ final IGDBExtendedFunctions funcService = fTracker.getService(IGDBExtendedFunctions.class);
+ funcService.getVersion(
+ fControl.getContext(),
+ new ImmediateDataRequestMonitor<String>(rm) {
+ @Override
+ protected void handleCompleted() {
+ String str;
+ if (isSuccess()) {
+ str = "======= GDB version: " + getData() + " ======="; //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ str = "Could not obtain GDB version. Error: " + //$NON-NLS-1$
+ getStatus();
+ }
+ funcService.notify(fControl.getContext(), str, rm);
+ }
+ });
+ }
+
+ @Execute
+ public void stepSetPagination(final RequestMonitor rm) {
+ // Make sure pagination is always off
+ fControl.queueCommand(
+ fControl.getCommandFactory().createMIGDBSetPagination(fControl.getContext(), false),
+ new ImmediateDataRequestMonitor<MIInfo>(rm) {
+ @Override
+ protected void handleCompleted() {
+ // We accept errors
+ rm.done();
+ }
+ });
+ }
+
+ @Execute
+ public void stepCleanupExtendedFinalLaunchSequence_7_7(final RequestMonitor rm) {
+ if (fTracker != null) fTracker.dispose();
+ fTracker = null;
+ rm.done();
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunch.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunch.java
new file mode 100644
index 0000000000..be0fd63138
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunch.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.launch;
+
+import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
+import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.ISourceLocator;
+
+@ThreadSafe
+public class GdbExtendedLaunch extends GdbLaunch
+{
+ public GdbExtendedLaunch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) {
+ super(launchConfiguration, mode, locator);
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunchDelegate.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunchDelegate.java
new file mode 100644
index 0000000000..96011424a1
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedLaunchDelegate.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.launch;
+
+import org.eclipse.cdt.dsf.concurrent.Sequence;
+import org.eclipse.cdt.dsf.debug.service.IDsfDebugServicesFactory;
+import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
+import org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate;
+import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.examples.dsf.gdb.GDBExamplePlugin;
+import org.eclipse.cdt.examples.dsf.gdb.service.GdbExtendedDebugServicesFactory;
+import org.eclipse.cdt.examples.dsf.gdb.service.GdbExtendedDebugServicesFactoryNS;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.ISourceLocator;
+
+public class GdbExtendedLaunchDelegate extends GdbLaunchDelegate {
+ public GdbExtendedLaunchDelegate() {
+ super();
+ }
+
+ @Override
+ protected GdbLaunch createGdbLaunch(ILaunchConfiguration configuration, String mode, ISourceLocator locator) throws CoreException {
+ return new GdbExtendedLaunch(configuration, mode, locator);
+ }
+
+ @Override
+ protected Sequence getServicesSequence(DsfSession session, ILaunch launch, IProgressMonitor rm) {
+ return new GdbExtendedServicesLaunchSequence(session, (GdbLaunch)launch, rm);
+ }
+
+ @Override
+ protected IDsfDebugServicesFactory newServiceFactory(ILaunchConfiguration config, String version) {
+ boolean nonStop = LaunchUtils.getIsNonStopMode(config);
+ if (nonStop && isNonStopSupportedInGdbVersion(version)) {
+ return new GdbExtendedDebugServicesFactoryNS(version);
+ }
+ return new GdbExtendedDebugServicesFactory(version);
+ }
+
+ @Override
+ protected String getPluginID() {
+ return GDBExamplePlugin.PLUGIN_ID;
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedServicesLaunchSequence.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedServicesLaunchSequence.java
new file mode 100644
index 0000000000..28a11b4175
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/launch/GdbExtendedServicesLaunchSequence.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.launch;
+
+import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
+import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
+import org.eclipse.cdt.dsf.gdb.launching.ServicesLaunchSequence;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.examples.dsf.gdb.service.IGDBExtendedFunctions;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class GdbExtendedServicesLaunchSequence extends ServicesLaunchSequence {
+
+ private GdbLaunch fLaunch;
+
+ public GdbExtendedServicesLaunchSequence(DsfSession session, GdbLaunch launch, IProgressMonitor pm) {
+ super(session, launch, pm);
+ fLaunch = launch;
+ }
+
+ @Override
+ public Step[] getSteps() {
+ // Add an extra step at the end to create the new service
+ Step[] steps = super.getSteps();
+ Step[] moreSteps = new Step[steps.length + 1];
+ System.arraycopy(steps, 0, moreSteps, 0, steps.length);
+ moreSteps[steps.length] = new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fLaunch.getServiceFactory().createService(IGDBExtendedFunctions.class, fLaunch.getSession()).initialize(requestMonitor);
+ }
+ };
+ return moreSteps;
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedControl_7_7.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedControl_7_7.java
new file mode 100644
index 0000000000..a59a5fab5f
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedControl_7_7.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.service;
+
+import java.util.Map;
+
+import org.eclipse.cdt.dsf.concurrent.RequestMonitorWithProgress;
+import org.eclipse.cdt.dsf.concurrent.Sequence;
+import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_7;
+import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.examples.dsf.gdb.launch.GdbExtendedFinalLaunchSequence_7_7;
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+public class GDBExtendedControl_7_7 extends GDBControl_7_7 {
+ public GDBExtendedControl_7_7(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
+ super(session, config, factory);
+ }
+
+ @Override
+ protected Sequence getCompleteInitializationSequence(Map<String, Object> attributes, RequestMonitorWithProgress rm) {
+ return new GdbExtendedFinalLaunchSequence_7_7(getSession(), attributes, rm);
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedService.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedService.java
new file mode 100644
index 0000000000..c8dca46ff1
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GDBExtendedService.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.service;
+
+import java.util.Hashtable;
+
+import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
+import org.eclipse.cdt.dsf.debug.service.command.CommandCache;
+import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
+import org.eclipse.cdt.dsf.gdb.IGdbDebugConstants;
+import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
+import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
+import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIGDBVersionInfo;
+import org.eclipse.cdt.dsf.service.AbstractDsfService;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.examples.dsf.gdb.GDBExamplePlugin;
+import org.eclipse.cdt.examples.dsf.gdb.service.command.GdbExtendedCommandFactory_6_8;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IStatusHandler;
+import org.osgi.framework.BundleContext;
+
+public class GDBExtendedService extends AbstractDsfService implements IGDBExtendedFunctions {
+
+ private IMICommandControl fCommandControl;
+ private CommandFactory fCommandFactory;
+ private CommandCache fVersionCache;
+
+ public GDBExtendedService(DsfSession session) {
+ super(session);
+ }
+
+ @Override
+ public void initialize(final RequestMonitor rm) {
+ super.initialize(new ImmediateRequestMonitor(rm) {
+ @Override
+ protected void handleSuccess() {
+ doInitialize(rm);
+ }
+ });
+ }
+
+ private void doInitialize(RequestMonitor rm) {
+ fCommandControl = getServicesTracker().getService(IMICommandControl.class);
+ fCommandFactory = fCommandControl.getCommandFactory();
+
+ fVersionCache = new CommandCache(getSession(), fCommandControl);
+ fVersionCache.setContextAvailable(fCommandControl.getContext(), true);
+
+ register(new String[] { IGDBExtendedFunctions.class.getName() },
+ new Hashtable<String, String>());
+
+ rm.done();
+ }
+
+
+ @Override
+ public void shutdown(RequestMonitor rm) {
+ unregister();
+ super.shutdown(rm);
+ }
+
+ @Override
+ protected BundleContext getBundleContext() {
+ return GDBExamplePlugin.getBundleContext();
+ }
+
+ @Override
+ public void notify(ICommandControlDMContext ctx, String str, RequestMonitor rm) {
+ IStatus status = new Status(
+ IStatus.INFO,
+ GdbPlugin.getUniqueIdentifier(),
+ IGdbDebugConstants.STATUS_HANDLER_CODE,
+ str,
+ null);
+ IStatusHandler statusHandler = DebugPlugin.getDefault().getStatusHandler(status);
+ if (statusHandler != null) {
+ try {
+ statusHandler.handleStatus(status, null);
+ }
+ catch(CoreException e) {
+ GDBExamplePlugin.getDefault().getLog().log(e.getStatus());
+ }
+ }
+ rm.done();
+ }
+
+ @Override
+ public void getVersion(ICommandControlDMContext ctx, final DataRequestMonitor<String> rm) {
+ if (fCommandFactory instanceof GdbExtendedCommandFactory_6_8) {
+ GdbExtendedCommandFactory_6_8 factory = (GdbExtendedCommandFactory_6_8)fCommandFactory;
+
+ // Use the cache to avoid having to go to GDB more than once for a value
+ // that does not change. No need to even clear the cache since the GDB version will never change.
+ fVersionCache.execute(factory.createCLIGDBVersion(ctx),
+ new ImmediateDataRequestMonitor<MIGDBVersionInfo>(rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.done(getData().getVersion());
+ }
+ });
+ } else {
+ rm.done(new Status(IStatus.ERROR, GDBExamplePlugin.PLUGIN_ID,
+ NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactory.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactory.java
new file mode 100644
index 0000000000..2a1065e4a1
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactory.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.service;
+
+import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
+import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory;
+import org.eclipse.cdt.dsf.gdb.service.command.GDBControl;
+import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_0;
+import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_2;
+import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_4;
+import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.examples.dsf.gdb.service.command.GdbExtendedCommandFactory_6_8;
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+public class GdbExtendedDebugServicesFactory extends GdbDebugServicesFactory {
+
+ public GdbExtendedDebugServicesFactory(String version) {
+ super(version);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <V> V createService(Class<V> clazz, DsfSession session, Object ... optionalArguments) {
+ if (IGDBExtendedFunctions.class.isAssignableFrom(clazz)) {
+ return (V)createExtendedService(session);
+ }
+ return super.createService(clazz, session, optionalArguments);
+ }
+
+ @Override
+ protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) {
+ if (GDB_7_7_VERSION.compareTo(getVersion()) <= 0) {
+ return new GDBExtendedControl_7_7(session, config, new GdbExtendedCommandFactory_6_8());
+ }
+ if (GDB_7_4_VERSION.compareTo(getVersion()) <= 0) {
+ return new GDBControl_7_4(session, config, new GdbExtendedCommandFactory_6_8());
+ }
+ if (GDB_7_2_VERSION.compareTo(getVersion()) <= 0) {
+ return new GDBControl_7_2(session, config, new GdbExtendedCommandFactory_6_8());
+ }
+ if (GDB_7_0_VERSION.compareTo(getVersion()) <= 0) {
+ return new GDBControl_7_0(session, config, new GdbExtendedCommandFactory_6_8());
+ }
+ if (GDB_6_8_VERSION.compareTo(getVersion()) <= 0) {
+ return new GDBControl(session, config, new GdbExtendedCommandFactory_6_8());
+ }
+ return new GDBControl(session, config, new CommandFactory());
+ }
+
+ protected IGDBExtendedFunctions createExtendedService(DsfSession session) {
+ return new GDBExtendedService(session);
+ }
+
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactoryNS.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactoryNS.java
new file mode 100644
index 0000000000..6e732d83e4
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/GdbExtendedDebugServicesFactoryNS.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.service;
+
+import org.eclipse.cdt.dsf.debug.service.IRunControl;
+import org.eclipse.cdt.dsf.gdb.service.GDBRunControl_7_0_NS;
+import org.eclipse.cdt.dsf.gdb.service.GDBRunControl_7_2_NS;
+import org.eclipse.cdt.dsf.service.DsfSession;
+
+public class GdbExtendedDebugServicesFactoryNS extends GdbExtendedDebugServicesFactory {
+
+ public GdbExtendedDebugServicesFactoryNS(String version) {
+ super(version);
+ }
+
+ @Override
+ protected IRunControl createRunControlService(DsfSession session) {
+ if (GDB_7_2_VERSION.compareTo(getVersion()) <= 0) {
+ return new GDBRunControl_7_2_NS(session);
+ }
+ return new GDBRunControl_7_0_NS(session);
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/IGDBExtendedFunctions.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/IGDBExtendedFunctions.java
new file mode 100644
index 0000000000..318f8fa3ce
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/IGDBExtendedFunctions.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.service;
+
+import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
+import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
+import org.eclipse.cdt.dsf.service.IDsfService;
+
+
+public interface IGDBExtendedFunctions extends IDsfService {
+ /**
+ * Request a notification to the user
+ */
+ void notify(ICommandControlDMContext ctx, String str, RequestMonitor rm);
+
+ /**
+ * Get the version of the debugger
+ */
+ void getVersion(ICommandControlDMContext ctx, DataRequestMonitor<String> rm);
+
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/GdbExtendedCommandFactory_6_8.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/GdbExtendedCommandFactory_6_8.java
new file mode 100644
index 0000000000..a0003b0770
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/GdbExtendedCommandFactory_6_8.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.service.command;
+
+import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
+import org.eclipse.cdt.dsf.debug.service.command.ICommand;
+import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
+import org.eclipse.cdt.dsf.gdb.service.command.CommandFactory_6_8;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIGDBVersionInfo;
+import org.eclipse.cdt.examples.dsf.gdb.service.command.commands.CLIGDBVersion;
+
+public class GdbExtendedCommandFactory_6_8 extends CommandFactory_6_8 {
+ @Override
+ public ICommand<MIBreakInsertInfo> createMIDPrintfInsert(
+ IBreakpointsTargetDMContext ctx, boolean isTemporary,
+ String condition, int ignoreCount, int tid, boolean disabled,
+ String location, String printfStr) {
+ // Prefix all dynamic printf with the [EX] tag
+ printfStr = printfStr.replaceFirst("^\"", "\"[EX] "); //$NON-NLS-1$ //$NON-NLS-2$
+ return super.createMIDPrintfInsert(ctx, isTemporary, condition, ignoreCount,
+ tid, disabled, location, printfStr);
+ }
+
+ public ICommand<MIGDBVersionInfo> createCLIGDBVersion(ICommandControlDMContext ctx) {
+ return new CLIGDBVersion(ctx);
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/commands/CLIGDBVersion.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/commands/CLIGDBVersion.java
new file mode 100644
index 0000000000..06ff365844
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/service/command/commands/CLIGDBVersion.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.service.command.commands;
+
+import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
+import org.eclipse.cdt.dsf.mi.service.command.commands.MIInterpreterExecConsole;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIGDBVersionInfo;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
+
+/**
+ * We use -interpreter-exec console "show version" instead
+ * of -gdb-version to avoid having the output automatically printed
+ * to our console.
+ *
+ */
+public class CLIGDBVersion extends MIInterpreterExecConsole<MIGDBVersionInfo> {
+ private static final String COMMAND = "show version"; //$NON-NLS-1$
+
+ public CLIGDBVersion(ICommandControlDMContext ctx) {
+ super(ctx, COMMAND);
+ }
+
+ @Override
+ public MIInfo getResult(MIOutput out) {
+ return new MIGDBVersionInfo(out);
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedLaunchVMProvider.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedLaunchVMProvider.java
new file mode 100644
index 0000000000..059a07abf6
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedLaunchVMProvider.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.viewmodel;
+
+import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.LaunchRootVMNode;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.StackFramesVMNode;
+import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch.ContainerVMNode;
+import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch.GdbStandardProcessVMNode;
+import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch.LaunchVMProvider;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMAdapter;
+import org.eclipse.cdt.dsf.ui.viewmodel.IRootVMNode;
+import org.eclipse.cdt.dsf.ui.viewmodel.IVMNode;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+
+@SuppressWarnings("restriction")
+public class GdbExtendedLaunchVMProvider extends LaunchVMProvider
+{
+ @ThreadSafe
+ public GdbExtendedLaunchVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session)
+ {
+ super(adapter, presentationContext, session);
+ }
+
+ @Override
+ protected void createNodes() {
+ IRootVMNode launchNode = new LaunchRootVMNode(this);
+ setRootNode(launchNode);
+
+ // Container node to contain all processes and threads
+ IVMNode containerNode = new ContainerVMNode(this, getSession());
+ IVMNode processesNode = new GdbStandardProcessVMNode(this);
+ addChildNodes(launchNode, new IVMNode[] { containerNode, processesNode});
+
+ IVMNode threadsNode = new GdbExtendedThreadVMNode(this, getSession());
+ addChildNodes(containerNode, new IVMNode[] { threadsNode });
+
+ IVMNode stackFramesNode = new StackFramesVMNode(this, getSession());
+ addChildNodes(threadsNode, new IVMNode[] { stackFramesNode });
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedThreadVMNode.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedThreadVMNode.java
new file mode 100644
index 0000000000..41bb56e209
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedThreadVMNode.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.viewmodel;
+
+import java.util.Map;
+
+import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementColorDescriptor;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ExecutionContextLabelText;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ILaunchVMConstants;
+import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch.GdbExecutionContextLabelText;
+import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch.IGdbLaunchVMConstants;
+import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch.ThreadVMNode;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
+import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelAttribute;
+import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelColumnInfo;
+import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelImage;
+import org.eclipse.cdt.dsf.ui.viewmodel.properties.LabelText;
+import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider;
+import org.eclipse.cdt.ui.CDTSharedImages;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+
+@SuppressWarnings("restriction")
+public class GdbExtendedThreadVMNode extends ThreadVMNode {
+ public GdbExtendedThreadVMNode(AbstractDMVMProvider provider, DsfSession session) {
+ super(provider, session);
+ }
+
+ @Override
+ protected IElementLabelProvider createLabelProvider() {
+ PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
+
+ provider.setColumnInfo(
+ PropertiesBasedLabelProvider.ID_COLUMN_NO_COLUMNS,
+ new LabelColumnInfo(new LabelAttribute[] {
+ // Text is made of the thread name followed by its state and state change reason.
+ new GdbExecutionContextLabelText(
+ GdbExtendedVMMessages.ThreadVMNode_No_columns__text_format,
+ new String[] {
+ ExecutionContextLabelText.PROP_NAME_KNOWN,
+ PROP_NAME,
+ ExecutionContextLabelText.PROP_ID_KNOWN,
+ ILaunchVMConstants.PROP_ID,
+ IGdbLaunchVMConstants.PROP_OS_ID_KNOWN,
+ IGdbLaunchVMConstants.PROP_OS_ID,
+ IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN,
+ IGdbLaunchVMConstants.PROP_CORES_ID,
+ ILaunchVMConstants.PROP_IS_SUSPENDED,
+ ExecutionContextLabelText.PROP_STATE_CHANGE_REASON_KNOWN,
+ ILaunchVMConstants.PROP_STATE_CHANGE_REASON,
+ ExecutionContextLabelText.PROP_STATE_CHANGE_DETAILS_KNOWN,
+ ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS}),
+ new LabelText(GdbExtendedVMMessages.ThreadVMNode_No_columns__Error__label, new String[0]),
+ /* RUNNING THREAD - RED PIN */
+ new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_R_PINNED)) {
+ { setPropertyNames(new String[] {
+ ILaunchVMConstants.PROP_IS_SUSPENDED,
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (prop != null && pin_prop != null && pin_color_prop != null) ?
+ !prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
+ };
+ },
+ /* RUNNING THREAD - GREEN PIN */
+ new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_G_PINNED)) {
+ { setPropertyNames(new String[] {
+ ILaunchVMConstants.PROP_IS_SUSPENDED,
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (prop != null && pin_prop != null && pin_color_prop != null) ?
+ !prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
+ };
+ },
+ /* RUNNING THREAD - BLUE PIN */
+ new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_RUNNING_B_PINNED)) {
+ { setPropertyNames(new String[] {
+ ILaunchVMConstants.PROP_IS_SUSPENDED,
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean prop = (Boolean) properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ Boolean pin_prop = (Boolean) properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (prop != null && pin_prop != null && pin_color_prop != null) ?
+ !prop.booleanValue() && pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
+ };
+ },
+ /* RUNNING THREAD - NO PIN */
+ new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING)) {
+ { setPropertyNames(new String[] { ILaunchVMConstants.PROP_IS_SUSPENDED }); }
+
+ @Override
+ public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
+ // prop has been seen to be null during session shutdown [313823]
+ Boolean prop = (Boolean)properties.get(ILaunchVMConstants.PROP_IS_SUSPENDED);
+ return (prop != null) ? !prop.booleanValue() : false;
+ };
+ },
+ /* SUSPENDED THREAD - RED PIN */
+ new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_R_PINNED)) {
+ { setPropertyNames(new String[] {
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (pin_prop != null && pin_color_prop != null) ?
+ pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.RED) : false;
+ };
+ },
+ /* SUSPENDED THREAD - GREEN PIN */
+ new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_G_PINNED)) {
+ { setPropertyNames(new String[] {
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (pin_prop != null && pin_color_prop != null) ?
+ pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.GREEN) : false;
+ };
+ },
+ /* SUSPENDED THREAD - BLUE PIN */
+ new LabelImage(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_THREAD_SUSPENDED_B_PINNED)) {
+ { setPropertyNames(new String[] {
+ IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
+ IGdbLaunchVMConstants.PROP_PIN_COLOR }); }
+
+ @Override
+ public boolean isEnabled(IStatus status, Map<String, Object> properties) {
+ Boolean pin_prop = (Boolean)properties.get(IGdbLaunchVMConstants.PROP_PINNED_CONTEXT);
+ Object pin_color_prop = properties.get(IGdbLaunchVMConstants.PROP_PIN_COLOR);
+ return (pin_prop != null && pin_color_prop != null) ?
+ pin_prop.booleanValue() && pin_color_prop.equals(IPinElementColorDescriptor.BLUE) : false;
+ };
+ },
+ /* SUSPENDED THREAD - NO PIN */
+ new LabelImage(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED)),
+ }));
+ return provider;
+ }
+
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedVMMessages.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedVMMessages.java
new file mode 100644
index 0000000000..0e84cef24d
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedVMMessages.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.viewmodel;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ */
+public class GdbExtendedVMMessages extends NLS {
+ public static String ThreadVMNode_No_columns__text_format;
+ public static String ThreadVMNode_No_columns__Error__label;
+ public static String ContainerVMNode_No_columns__text_format;
+ public static String ContainerVMNode_No_columns__Error__label;
+ /** since 2.3 */
+ public static String ContainerVMNode_filtered_running_threads;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(GdbExtendedVMMessages.class.getName(), GdbExtendedVMMessages.class);
+ }
+
+ private GdbExtendedVMMessages() {
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedVMMessages.properties b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedVMMessages.properties
new file mode 100644
index 0000000000..423c501b61
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedVMMessages.properties
@@ -0,0 +1,41 @@
+###############################################################################
+# Copyright (c) 2014 Ericsson and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Marc Khouzam (Ericsson) - Initial API and implementation
+###############################################################################
+
+# {0} - name available, 0=not available/1=available
+# {1} - name
+# {2} - ID available, 0=not available/1=available
+# {3} - ID
+# {4} - OS Thread ID available, 0=not available/1=available
+# {5} - OS Thread ID
+# {6} - Core available, 0=not available/1=available
+# {7} - Core
+# {8} - 0=running/1=suspended
+# {9} - state change reason available, 0=not available/1=available
+# {10} - state change reason
+# {11} - state change details available, 0=not available/1=available
+# {12} - state change details
+ThreadVMNode_No_columns__text_format=DSP{2,choice,0#|1# #{3}}{0,choice,0#|1# [{1}]}{4,choice,0#|1# {5}}{6,choice,0#|1# [core: {7}]} ({8,choice,0#Running|1#Suspended}{9,choice,0#|1# : {10}}{11,choice,0#|1# : {12}})
+
+ThreadVMNode_No_columns__Error__label=<unavailable>
+
+# {0} - name available, 0=not available/1=available
+# {1} - name
+# {2} - ID available, 0=not available/1=available
+# {3} - ID
+# {4} - Cores available, 0=not available/1=available
+# {5} - Cores
+# {6} - Thread summary available, 0=not available/1=available
+# {7} - Thread summary in text format
+ContainerVMNode_No_columns__text_format={0,choice,0#Process|1#{1}}{2,choice,0#|1# [{3}]}{4,choice,0#|1# [cores: {5}]}{6,choice,0#|1# {7}}
+
+ContainerVMNode_No_columns__Error__label=<unavailable>
+
+ContainerVMNode_filtered_running_threads=filtered running DSPs \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedViewModelAdapter.java b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedViewModelAdapter.java
new file mode 100644
index 0000000000..25ef040fd2
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.examples.dsf.gdb/src/org/eclipse/cdt/examples/dsf/gdb/viewmodel/GdbExtendedViewModelAdapter.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Khouzam (Ericsson) - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.gdb.viewmodel;
+
+import org.eclipse.cdt.dsf.concurrent.ThreadSafe;
+import org.eclipse.cdt.dsf.debug.ui.viewmodel.SteppingController;
+import org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.GdbViewModelAdapter;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.dsf.ui.viewmodel.IVMProvider;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.ui.IDebugUIConstants;
+
+@SuppressWarnings("restriction")
+@ThreadSafe
+public class GdbExtendedViewModelAdapter extends GdbViewModelAdapter
+{
+ public GdbExtendedViewModelAdapter(DsfSession session, SteppingController controller) {
+ super(session, controller);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ @Override
+ protected IVMProvider createViewModelProvider(IPresentationContext context) {
+ if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) {
+ return new GdbExtendedLaunchVMProvider(this, context, getSession());
+ } else {
+ return super.createViewModelProvider(context);
+ }
+ }
+}
diff --git a/pom.xml b/pom.xml
index b578f66a73..8aad9ab495 100644
--- a/pom.xml
+++ b/pom.xml
@@ -177,6 +177,7 @@
<module>build/org.eclipse.cdt.make.ui.tests</module>
<module>dsf-gdb/org.eclipse.cdt.dsf.gdb.tests</module>
<module>dsf-gdb/org.eclipse.cdt.tests.dsf.gdb</module>
+ <module>dsf-gdb/org.eclipse.cdt.examples.dsf.gdb</module>
<module>build/org.eclipse.cdt.autotools.core</module>
<module>build/org.eclipse.cdt.autotools.docs</module>

Back to the top