mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 13:25:45 +02:00
Merge remote-tracking branch 'cdt/master' into sd90
This commit is contained in:
commit
2876909d25
90 changed files with 5620 additions and 563 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2012-04-20 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
|
* META-INF/MANIFEST.MF: Bump up version to 1.1.0.
|
||||||
|
* pom.xml: Ditto.
|
||||||
|
|
||||||
2012-04-11 Jeff Johnston <jjohnstn@redhat.com>
|
2012-04-11 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
Bug #375007 fix from Anna Dushistova
|
Bug #375007 fix from Anna Dushistova
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %Bundle-Name.0
|
Bundle-Name: %Bundle-Name.0
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.autotools.core;singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.autotools.core;singleton:=true
|
||||||
Bundle-Version: 1.0.2.qualifier
|
Bundle-Version: 1.1.0.qualifier
|
||||||
Bundle-Activator: org.eclipse.cdt.autotools.core.AutotoolsPlugin
|
Bundle-Activator: org.eclipse.cdt.autotools.core.AutotoolsPlugin
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Require-Bundle: org.eclipse.ui;bundle-version="3.4.0",
|
Require-Bundle: org.eclipse.ui;bundle-version="3.4.0",
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<version>1.0.2-SNAPSHOT</version>
|
<version>1.1.0-SNAPSHOT</version>
|
||||||
<artifactId>org.eclipse.cdt.autotools.core</artifactId>
|
<artifactId>org.eclipse.cdt.autotools.core</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
</project>
|
</project>
|
|
@ -18,10 +18,9 @@
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<!-- Change to groupId org.eclipse.tycho.extras after upgrade to Tycho 0.14 -->
|
<groupId>org.eclipse.tycho.extras</groupId>
|
||||||
<groupId>com.google.code.tycho-eclipserun-plugin</groupId>
|
|
||||||
<artifactId>tycho-eclipserun-plugin</artifactId>
|
<artifactId>tycho-eclipserun-plugin</artifactId>
|
||||||
<version>${tycho-version}</version>
|
<version>${tycho-extras-version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<appArgLine>-application org.eclipse.ant.core.antRunner -buildfile build-index.xml build.index</appArgLine>
|
<appArgLine>-application org.eclipse.ant.core.antRunner -buildfile build-index.xml build.index</appArgLine>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -15,13 +15,14 @@
|
||||||
<artifactId>org.eclipse.cdt.autotools.tests</artifactId>
|
<artifactId>org.eclipse.cdt.autotools.tests</artifactId>
|
||||||
<packaging>eclipse-test-plugin</packaging>
|
<packaging>eclipse-test-plugin</packaging>
|
||||||
|
|
||||||
<repositories>
|
<!-- Uncommenting this is useful when the repo is built first then you want to run tests on this plugin only -->
|
||||||
|
<!-- <repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>cdt.repo</id>
|
<id>cdt.repo</id>
|
||||||
<url>file:/${basedir}/../../releng/org.eclipse.cdt.repo/target/repository</url>
|
<url>file:/${basedir}/../../releng/org.eclipse.cdt.repo/target/repository</url>
|
||||||
<layout>p2</layout>
|
<layout>p2</layout>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>-->
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
|
@ -15,13 +15,14 @@
|
||||||
<artifactId>org.eclipse.cdt.managedbuilder.core.tests</artifactId>
|
<artifactId>org.eclipse.cdt.managedbuilder.core.tests</artifactId>
|
||||||
<packaging>eclipse-test-plugin</packaging>
|
<packaging>eclipse-test-plugin</packaging>
|
||||||
|
|
||||||
<repositories>
|
<!-- Uncommenting this is useful when the repo is built first then you want to run tests on this plugin only -->
|
||||||
|
<!-- <repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>cdt.repo</id>
|
<id>cdt.repo</id>
|
||||||
<url>file:/${basedir}/../../releng/org.eclipse.cdt.repo/target/repository</url>
|
<url>file:/${basedir}/../../releng/org.eclipse.cdt.repo/target/repository</url>
|
||||||
<layout>p2</layout>
|
<layout>p2</layout>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>-->
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2011 Broadcom Corporation and others.
|
* Copyright (c) 2011, 2012 Broadcom Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -71,11 +71,13 @@ public abstract class AbstractBuilderTest extends TestCase {
|
||||||
Job.getJobManager().cancel(CCorePlugin.getPDOMManager());
|
Job.getJobManager().cancel(CCorePlugin.getPDOMManager());
|
||||||
Job.getJobManager().join(CCorePlugin.getPDOMManager(), null);
|
Job.getJobManager().join(CCorePlugin.getPDOMManager(), null);
|
||||||
|
|
||||||
// Clean-up any projects we were using
|
if (projects != null) {
|
||||||
for (IProject project : projects) {
|
// Clean-up any projects we were using
|
||||||
project.delete(true, null);
|
for (IProject project : projects) {
|
||||||
|
project.delete(true, null);
|
||||||
|
}
|
||||||
|
projects.clear();
|
||||||
}
|
}
|
||||||
projects.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2011 QNX Software Systems and others.
|
* Copyright (c) 2011, 2012 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -11,11 +11,9 @@
|
||||||
package org.eclipse.cdt.managedbuilder.core.tests;
|
package org.eclipse.cdt.managedbuilder.core.tests;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
@ -28,6 +26,7 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
|
import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.tcmodification.IConfigurationModification;
|
import org.eclipse.cdt.managedbuilder.tcmodification.IConfigurationModification;
|
||||||
import org.eclipse.cdt.managedbuilder.tcmodification.IToolChainModificationManager;
|
import org.eclipse.cdt.managedbuilder.tcmodification.IToolChainModificationManager;
|
||||||
|
import org.eclipse.cdt.managedbuilder.testplugin.AbstractBuilderTest;
|
||||||
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
|
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
|
@ -39,11 +38,10 @@ import org.eclipse.core.resources.IWorkspaceDescription;
|
||||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
|
|
||||||
public class ManagedBuildDependencyLibsTests extends TestCase {
|
public class ManagedBuildDependencyLibsTests extends AbstractBuilderTest {
|
||||||
private static final String PROJ_PATH = "depLibsProjects";
|
private static final String PROJ_PATH = "depLibsProjects";
|
||||||
private static final String MESSAGE_TAIL = " (see .log file for more details).";
|
private static final String MESSAGE_TAIL = " (see .log file for more details).";
|
||||||
|
|
||||||
|
@ -60,12 +58,12 @@ public class ManagedBuildDependencyLibsTests extends TestCase {
|
||||||
|
|
||||||
suite.addTest(new ManagedBuildDependencyLibsTests("testDepLibs"));
|
suite.addTest(new ManagedBuildDependencyLibsTests("testDepLibs"));
|
||||||
suite.addTest(new ManagedBuildDependencyLibsTests("testDepUObjs"));
|
suite.addTest(new ManagedBuildDependencyLibsTests("testDepUObjs"));
|
||||||
|
suite.addTest(new ManagedBuildDependencyLibsTests("testGetArtifactTimeStampEscapeURI_bug377295"));
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildProject(IProject curProject) {
|
private void buildProject(IProject curProject) {
|
||||||
|
|
||||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(curProject);
|
|
||||||
try {
|
try {
|
||||||
IProject[] referencedProjects = curProject.getReferencedProjects();
|
IProject[] referencedProjects = curProject.getReferencedProjects();
|
||||||
for(int i = 0; i < referencedProjects.length; ++i)
|
for(int i = 0; i < referencedProjects.length; ++i)
|
||||||
|
@ -118,20 +116,6 @@ public class ManagedBuildDependencyLibsTests extends TestCase {
|
||||||
ManagedBuildTestHelper.removeProject(fTobjs.getName());
|
ManagedBuildTestHelper.removeProject(fTobjs.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteFiles(IFolder dir, String pattern, IProgressMonitor monitor) {
|
|
||||||
List<IFile> files = new ArrayList<IFile>();
|
|
||||||
findFiles(dir, pattern, files);
|
|
||||||
for(Iterator<IFile> i = files.iterator(); i.hasNext(); ) {
|
|
||||||
IFile file = i.next();
|
|
||||||
try {
|
|
||||||
file.delete(true, monitor);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error deleting file " + file.getFullPath().toString() + '.' + MESSAGE_TAIL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void findFiles(IResource dir, String pattern, List<IFile> files) {
|
private void findFiles(IResource dir, String pattern, List<IFile> files) {
|
||||||
IResource resource = null;
|
IResource resource = null;
|
||||||
try {
|
try {
|
||||||
|
@ -146,7 +130,7 @@ public class ManagedBuildDependencyLibsTests extends TestCase {
|
||||||
for(int i = 0; i < members.length; ++i) {
|
for(int i = 0; i < members.length; ++i) {
|
||||||
resource = members[i];
|
resource = members[i];
|
||||||
if(resource.getType() == IResource.FOLDER)
|
if(resource.getType() == IResource.FOLDER)
|
||||||
findFiles((IFolder)resource, pattern, files);
|
findFiles(resource, pattern, files);
|
||||||
else {
|
else {
|
||||||
if(resource.getName().matches(pattern))
|
if(resource.getName().matches(pattern))
|
||||||
files.add((IFile)resource);
|
files.add((IFile)resource);
|
||||||
|
@ -291,4 +275,20 @@ public class ManagedBuildDependencyLibsTests extends TestCase {
|
||||||
fail("Error. This time it should build application.");
|
fail("Error. This time it should build application.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tests that the URI used to get the time stamp of the artifact is escaped correctly
|
||||||
|
// See AdditionalInput.getArtifactTimeStamp(IToolChain toolChain)
|
||||||
|
public void testGetArtifactTimeStampEscapeURI_bug377295() throws CoreException {
|
||||||
|
setWorkspace("regressions");
|
||||||
|
final IProject project = loadProject("helloworldC");
|
||||||
|
IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
|
||||||
|
IConfiguration[] configs = buildInfo.getManagedProject().getConfigurations();
|
||||||
|
for (IConfiguration configuration : configs) {
|
||||||
|
configuration.setArtifactName("test [377295]");
|
||||||
|
}
|
||||||
|
|
||||||
|
project.build(IncrementalProjectBuilder.FULL_BUILD, null);
|
||||||
|
// This will trigger AdditionalInput.getArtifactTimeStamp to get called, no IllegalArgumentException should be thrown
|
||||||
|
project.build(IncrementalProjectBuilder.FULL_BUILD, null);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,13 +1,14 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2011 Intel Corporation and others.
|
* Copyright (c) 2005, 2012 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - Initial API and implementation
|
* Intel Corporation - Initial API and implementation
|
||||||
* IBM Corporation
|
* IBM Corporation
|
||||||
|
* Marc-Andre Laperle
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.internal.core;
|
package org.eclipse.cdt.managedbuilder.internal.core;
|
||||||
|
|
||||||
|
@ -40,6 +41,7 @@ import org.eclipse.cdt.managedbuilder.internal.macros.IMacroContextInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.macros.OptionContextData;
|
import org.eclipse.cdt.managedbuilder.internal.macros.OptionContextData;
|
||||||
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
|
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
|
||||||
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
||||||
|
import org.eclipse.cdt.utils.EFSExtensionManager;
|
||||||
import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
|
import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
|
||||||
import org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableSubstitutor;
|
import org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableSubstitutor;
|
||||||
import org.eclipse.core.filesystem.EFS;
|
import org.eclipse.core.filesystem.EFS;
|
||||||
|
@ -380,7 +382,7 @@ public class AdditionalInput implements IAdditionalInput {
|
||||||
} catch (BuildMacroException e) {
|
} catch (BuildMacroException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
URI buildArtifactURI = buildLocationURI.resolve(artifactName);
|
URI buildArtifactURI = EFSExtensionManager.getDefault().append(buildLocationURI, artifactName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IFileStore artifact = EFS.getStore(buildArtifactURI);
|
IFileStore artifact = EFS.getStore(buildArtifactURI);
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.codan.core.cxx.externaltool;
|
package org.eclipse.cdt.codan.core.cxx.externaltool;
|
||||||
|
|
||||||
import static org.eclipse.cdt.core.ErrorParserContext.CODAN;
|
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.eclipse.cdt.codan.core.CodanRuntime;
|
import org.eclipse.cdt.codan.core.CodanRuntime;
|
||||||
|
@ -127,7 +125,7 @@ public abstract class AbstractExternalToolBasedChecker extends AbstractCheckerWi
|
||||||
private ErrorParserManager createErrorParserManager(InvocationParameters parameters) {
|
private ErrorParserManager createErrorParserManager(InvocationParameters parameters) {
|
||||||
IProject project = parameters.getActualFile().getProject();
|
IProject project = parameters.getActualFile().getProject();
|
||||||
URI workingDirectory = URIUtil.toURI(parameters.getWorkingDirectory());
|
URI workingDirectory = URIUtil.toURI(parameters.getWorkingDirectory());
|
||||||
return new ErrorParserManager(project, workingDirectory, this, getParserIDs(), CODAN);
|
return new ErrorParserManager(project, workingDirectory, this, getParserIDs());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9592,4 +9592,21 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
assertSame(calls[calls.length - 1] + " and " + calls[calls.length - 2] + " resolve to different functions",
|
assertSame(calls[calls.length - 1] + " and " + calls[calls.length - 2] + " resolve to different functions",
|
||||||
functions[calls.length - 1], functions[calls.length - 2]);
|
functions[calls.length - 1], functions[calls.length - 2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// void f(int x) try {
|
||||||
|
// } catch(...) {
|
||||||
|
// (void)x;
|
||||||
|
// }
|
||||||
|
public void testParentScopeOfCatchHandler_376246() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
// struct MyClass {
|
||||||
|
// struct MyException {};
|
||||||
|
// void doSomething() throw(MyException);
|
||||||
|
// };
|
||||||
|
// void MyClass::doSomething() throw (MyException) {}
|
||||||
|
public void testScopeOfExceptionSpecification_377457() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,14 @@
|
||||||
<artifactId>org.eclipse.cdt.core.tests</artifactId>
|
<artifactId>org.eclipse.cdt.core.tests</artifactId>
|
||||||
<packaging>eclipse-test-plugin</packaging>
|
<packaging>eclipse-test-plugin</packaging>
|
||||||
|
|
||||||
<repositories>
|
<!-- Uncommenting this is useful when the repo is built first then you want to run tests on this plugin only -->
|
||||||
|
<!-- <repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>cdt.repo</id>
|
<id>cdt.repo</id>
|
||||||
<url>file:/${basedir}/../../releng/org.eclipse.cdt.repo/target/repository</url>
|
<url>file:/${basedir}/../../releng/org.eclipse.cdt.repo/target/repository</url>
|
||||||
<layout>p2</layout>
|
<layout>p2</layout>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>-->
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
|
@ -47,7 +47,8 @@ Export-Package: org.eclipse.cdt.core,
|
||||||
org.eclipse.cdt.managedbuilder.core,
|
org.eclipse.cdt.managedbuilder.core,
|
||||||
org.eclipse.cdt.make.core,
|
org.eclipse.cdt.make.core,
|
||||||
org.eclipse.cdt.make.ui,
|
org.eclipse.cdt.make.ui,
|
||||||
org.eclipse.cdt.codan.core.cxx",
|
org.eclipse.cdt.codan.core.cxx,
|
||||||
|
org.eclipse.cdt.dsf.gdb",
|
||||||
org.eclipse.cdt.internal.core.browser;x-friends:="org.eclipse.cdt.ui",
|
org.eclipse.cdt.internal.core.browser;x-friends:="org.eclipse.cdt.ui",
|
||||||
org.eclipse.cdt.internal.core.cdtvariables;x-internal:=true,
|
org.eclipse.cdt.internal.core.cdtvariables;x-internal:=true,
|
||||||
org.eclipse.cdt.internal.core.dom;x-internal:=true,
|
org.eclipse.cdt.internal.core.dom;x-internal:=true,
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Anton Leherbauer (Wind River Systems)
|
* Anton Leherbauer (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.model;
|
package org.eclipse.cdt.internal.core.model;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -41,7 +40,6 @@ import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.PlatformObject;
|
import org.eclipse.core.runtime.PlatformObject;
|
||||||
|
|
||||||
public abstract class CElement extends PlatformObject implements ICElement {
|
public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
|
|
||||||
public static final char CEM_ESCAPE = '\\';
|
public static final char CEM_ESCAPE = '\\';
|
||||||
public static final char CEM_CPROJECT = '=';
|
public static final char CEM_CPROJECT = '=';
|
||||||
public static final char CEM_SOURCEROOT = '/';
|
public static final char CEM_SOURCEROOT = '/';
|
||||||
|
@ -51,11 +49,10 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
public static final char CEM_PARAMETER = '(';
|
public static final char CEM_PARAMETER = '(';
|
||||||
public static final char CEM_ELEMENTTYPE = '#';
|
public static final char CEM_ELEMENTTYPE = '#';
|
||||||
|
|
||||||
protected static final CElement[] NO_ELEMENTS = new CElement[0];
|
protected static final CElement[] NO_ELEMENTS = {};
|
||||||
|
|
||||||
protected int fType;
|
protected int fType;
|
||||||
|
|
||||||
protected ICElement fParent;
|
protected ICElement fParent;
|
||||||
|
|
||||||
protected String fName;
|
protected String fName;
|
||||||
|
|
||||||
protected CElement(ICElement parent, String name, int type) {
|
protected CElement(ICElement parent, String name, int type) {
|
||||||
|
@ -80,7 +77,6 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
return super.getAdapter(adapter);
|
return super.getAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// setters
|
// setters
|
||||||
|
|
||||||
public void setElementType (int type) {
|
public void setElementType (int type) {
|
||||||
|
@ -123,14 +119,7 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
@Override
|
@Override
|
||||||
public URI getLocationURI() {
|
public URI getLocationURI() {
|
||||||
IResource res = getUnderlyingResource();
|
IResource res = getUnderlyingResource();
|
||||||
|
return res == null ? null : res.getLocationURI();
|
||||||
if(res != null) {
|
|
||||||
return res.getLocationURI();
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -138,8 +127,7 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
try {
|
try {
|
||||||
return getElementInfo() != null;
|
return getElementInfo() != null;
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
// Do not log it, it will fil the .log alarming the user.
|
// Do not log it, otherwise it would fill the .log alarming the user.
|
||||||
//CCorePlugin.log(e);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,7 +141,7 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
*/
|
*/
|
||||||
protected ICElement getSourceElementAtOffset(int offset) throws CModelException {
|
protected ICElement getSourceElementAtOffset(int offset) throws CModelException {
|
||||||
if (this instanceof ISourceReference && this instanceof Parent) {
|
if (this instanceof ISourceReference && this instanceof Parent) {
|
||||||
ICElement[] children = ((Parent)this).getChildren();
|
ICElement[] children = ((Parent) this).getChildren();
|
||||||
for (ICElement aChild : children) {
|
for (ICElement aChild : children) {
|
||||||
if (aChild instanceof ISourceReference) {
|
if (aChild instanceof ISourceReference) {
|
||||||
ISourceReference child = (ISourceReference) aChild;
|
ISourceReference child = (ISourceReference) aChild;
|
||||||
|
@ -162,9 +150,9 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
int endPos = startPos + range.getLength();
|
int endPos = startPos + range.getLength();
|
||||||
if (offset < endPos && offset >= startPos) {
|
if (offset < endPos && offset >= startPos) {
|
||||||
if (child instanceof Parent) {
|
if (child instanceof Parent) {
|
||||||
return ((Parent)child).getSourceElementAtOffset(offset);
|
return ((Parent) child).getSourceElementAtOffset(offset);
|
||||||
}
|
}
|
||||||
return (ICElement)child;
|
return (ICElement) child;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +173,7 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
protected ICElement[] getSourceElementsAtOffset(int offset) throws CModelException {
|
protected ICElement[] getSourceElementsAtOffset(int offset) throws CModelException {
|
||||||
if (this instanceof ISourceReference && this instanceof Parent) {
|
if (this instanceof ISourceReference && this instanceof Parent) {
|
||||||
ArrayList<Object> list = new ArrayList<Object>();
|
ArrayList<Object> list = new ArrayList<Object>();
|
||||||
ICElement[] children = ((Parent)this).getChildren();
|
ICElement[] children = ((Parent) this).getChildren();
|
||||||
for (ICElement aChild : children) {
|
for (ICElement aChild : children) {
|
||||||
if (aChild instanceof ISourceReference) {
|
if (aChild instanceof ISourceReference) {
|
||||||
ISourceReference child = (ISourceReference) aChild;
|
ISourceReference child = (ISourceReference) aChild;
|
||||||
|
@ -194,7 +182,7 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
int endPos = startPos + range.getLength();
|
int endPos = startPos + range.getLength();
|
||||||
if (offset < endPos && offset >= startPos) {
|
if (offset < endPos && offset >= startPos) {
|
||||||
if (child instanceof Parent) {
|
if (child instanceof Parent) {
|
||||||
ICElement[] elements = ((Parent)child).getSourceElementsAtOffset(offset);
|
ICElement[] elements = ((Parent) child).getSourceElementsAtOffset(offset);
|
||||||
list.addAll(Arrays.asList(elements));
|
list.addAll(Arrays.asList(elements));
|
||||||
}
|
}
|
||||||
list.add(child);
|
list.add(child);
|
||||||
|
@ -238,7 +226,8 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
public ICProject getCProject() {
|
public ICProject getCProject() {
|
||||||
ICElement current = this;
|
ICElement current = this;
|
||||||
do {
|
do {
|
||||||
if (current instanceof ICProject) return (ICProject) current;
|
if (current instanceof ICProject)
|
||||||
|
return (ICProject) current;
|
||||||
} while ((current = current.getParent()) != null);
|
} while ((current = current.getParent()) != null);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -285,7 +274,7 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
}
|
}
|
||||||
String lhsName= lhs.getElementName();
|
String lhsName= lhs.getElementName();
|
||||||
String rhsName= rhs.getElementName();
|
String rhsName= rhs.getElementName();
|
||||||
if( lhsName == null || rhsName == null || lhsName.length() != rhsName.length() ||
|
if (lhsName == null || rhsName == null || lhsName.length() != rhsName.length() ||
|
||||||
!lhsName.equals(rhsName)) {
|
!lhsName.equals(rhsName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -311,7 +300,7 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
|
|
||||||
public CElementInfo getElementInfo (IProgressMonitor monitor) throws CModelException {
|
public CElementInfo getElementInfo (IProgressMonitor monitor) throws CModelException {
|
||||||
CModelManager manager = CModelManager.getDefault();
|
CModelManager manager = CModelManager.getDefault();
|
||||||
CElementInfo info = (CElementInfo)manager.getInfo(this);
|
CElementInfo info = (CElementInfo) manager.getInfo(this);
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
@ -326,7 +315,7 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toDebugString() {
|
public String toDebugString() {
|
||||||
return getElementName() + " " + getTypeString(); //$NON-NLS-1$
|
return getElementName() + " " + getTypeString(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// util
|
// util
|
||||||
|
@ -367,11 +356,11 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
case C_FIELD:
|
case C_FIELD:
|
||||||
return "C_FIELD"; //$NON-NLS-1$
|
return "C_FIELD"; //$NON-NLS-1$
|
||||||
case C_METHOD:
|
case C_METHOD:
|
||||||
return "C_METHOD"; //$NON-NLS-1$
|
return "C_METHOD"; //$NON-NLS-1$
|
||||||
case C_NAMESPACE:
|
case C_NAMESPACE:
|
||||||
return "C_NAMESPACE"; //$NON-NLS-1$
|
return "C_NAMESPACE"; //$NON-NLS-1$
|
||||||
case C_USING:
|
case C_USING:
|
||||||
return "C_USING"; //$NON-NLS-1$
|
return "C_USING"; //$NON-NLS-1$
|
||||||
case C_VCONTAINER:
|
case C_VCONTAINER:
|
||||||
return "C_CONTAINER"; //$NON-NLS-1$
|
return "C_CONTAINER"; //$NON-NLS-1$
|
||||||
case C_BINARY:
|
case C_BINARY:
|
||||||
|
@ -411,7 +400,7 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
*/
|
*/
|
||||||
public IOpenable getOpenableParent() {
|
public IOpenable getOpenableParent() {
|
||||||
if (fParent instanceof IOpenable) {
|
if (fParent instanceof IOpenable) {
|
||||||
return (IOpenable)fParent;
|
return (IOpenable) fParent;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -426,7 +415,8 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
* if successful, or false if an error is encountered while determining
|
* if successful, or false if an error is encountered while determining
|
||||||
* the structure of this element.
|
* the structure of this element.
|
||||||
*/
|
*/
|
||||||
protected abstract void generateInfos(CElementInfo info, Map<ICElement, CElementInfo> newElements, IProgressMonitor monitor) throws CModelException;
|
protected abstract void generateInfos(CElementInfo info, Map<ICElement, CElementInfo> newElements,
|
||||||
|
IProgressMonitor monitor) throws CModelException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a <code>IOpenable</code> that is known to be closed (no check for
|
* Open a <code>IOpenable</code> that is known to be closed (no check for
|
||||||
|
@ -441,13 +431,14 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
info = newElements.get(this);
|
info = newElements.get(this);
|
||||||
}
|
}
|
||||||
if (info == null) { // a source ref element could not be opened
|
if (info == null) {
|
||||||
// close any buffer that was opened for the openable parent
|
// A source ref element could not be opened.
|
||||||
|
// Close any buffer that was opened for the openable parent.
|
||||||
Iterator<ICElement> iterator = newElements.keySet().iterator();
|
Iterator<ICElement> iterator = newElements.keySet().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
ICElement element = iterator.next();
|
ICElement element = iterator.next();
|
||||||
if (element instanceof Openable) {
|
if (element instanceof Openable) {
|
||||||
((Openable)element).closeBuffer();
|
((Openable) element).closeBuffer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw newNotPresentException();
|
throw newNotPresentException();
|
||||||
|
@ -455,7 +446,6 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
if (!hadTemporaryCache) {
|
if (!hadTemporaryCache) {
|
||||||
manager.putInfos(this, newElements);
|
manager.putInfos(this, newElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
if (!hadTemporaryCache) {
|
if (!hadTemporaryCache) {
|
||||||
manager.resetTemporaryCache();
|
manager.resetTemporaryCache();
|
||||||
|
@ -463,7 +453,6 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ICElement
|
* @see ICElement
|
||||||
*/
|
*/
|
||||||
|
@ -519,17 +508,14 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
return Util.combineHashCodes(elem.getElementName().hashCode(), parent.hashCode());
|
return Util.combineHashCodes(elem.getElementName().hashCode(), parent.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Test to see if two objects are identical
|
* Checks if two objects are identical
|
||||||
* Subclasses should override accordingly
|
* Subclasses should override accordingly
|
||||||
*/
|
*/
|
||||||
public boolean isIdentical(CElement otherElement){
|
public boolean isIdentical(CElement otherElement){
|
||||||
return this.equals(otherElement);
|
return this.equals(otherElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.model.ICElement#accept(org.eclipse.cdt.core.model.ICElementVisitor)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(ICElementVisitor visitor) throws CoreException {
|
public void accept(ICElementVisitor visitor) throws CoreException {
|
||||||
// Visit me, return right away if the visitor doesn't want to visit my children
|
// Visit me, return right away if the visitor doesn't want to visit my children
|
||||||
|
@ -538,15 +524,13 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
|
|
||||||
// If I am a Parent, visit my children
|
// If I am a Parent, visit my children
|
||||||
if (this instanceof IParent) {
|
if (this instanceof IParent) {
|
||||||
ICElement [] children = ((IParent)this).getChildren();
|
ICElement [] children = ((IParent) this).getChildren();
|
||||||
for (int i = 0; i < children.length; ++i)
|
for (int i = 0; i < children.length; ++i) {
|
||||||
children[i].accept(visitor);
|
children[i].accept(visitor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.core.model.ICElement#getHandleIdentifier()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getHandleIdentifier() {
|
public String getHandleIdentifier() {
|
||||||
return getHandleMemento();
|
return getHandleMemento();
|
||||||
|
@ -569,7 +553,7 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
||||||
* @param buff the buffer building the memento string
|
* @param buff the buffer building the memento string
|
||||||
*/
|
*/
|
||||||
public void getHandleMemento(StringBuilder buff) {
|
public void getHandleMemento(StringBuilder buff) {
|
||||||
((CElement)getParent()).getHandleMemento(buff);
|
((CElement) getParent()).getHandleMemento(buff);
|
||||||
buff.append(getHandleMementoDelimiter());
|
buff.append(getHandleMementoDelimiter());
|
||||||
escapeMementoName(buff, getElementName());
|
escapeMementoName(buff, getElementName());
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,7 @@ public interface IIndex {
|
||||||
* index.acquireReadLock();
|
* index.acquireReadLock();
|
||||||
* try {
|
* try {
|
||||||
* ....
|
* ....
|
||||||
* }
|
* } finally {
|
||||||
* finally {
|
|
||||||
* index.releaseReadLock();
|
* index.releaseReadLock();
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -113,8 +112,7 @@ public interface IIndex {
|
||||||
* try {
|
* try {
|
||||||
* timestamp= index.getLastWriteAccess();
|
* timestamp= index.getLastWriteAccess();
|
||||||
* binding= index.findBinding(...);
|
* binding= index.findBinding(...);
|
||||||
* }
|
* } finally {
|
||||||
* finally {
|
|
||||||
* index.releaseReadLock();
|
* index.releaseReadLock();
|
||||||
* }
|
* }
|
||||||
* ...
|
* ...
|
||||||
|
@ -126,8 +124,7 @@ public interface IIndex {
|
||||||
* }
|
* }
|
||||||
* String name= binding.getName();
|
* String name= binding.getName();
|
||||||
* ...
|
* ...
|
||||||
* }
|
* } finally {
|
||||||
* finally {
|
|
||||||
* index.releaseReadLock();
|
* index.releaseReadLock();
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,11 +13,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
|
||||||
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ALLCVQ;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.*;
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getUltimateTypeUptoPointers;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -986,7 +982,8 @@ public class CPPVisitor extends ASTQueries {
|
||||||
node= node.getParent();
|
node= node.getParent();
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
} else if (prop == ICPPASTFunctionDeclarator.TRAILING_RETURN_TYPE) {
|
} else if (prop == ICPPASTFunctionDeclarator.TRAILING_RETURN_TYPE ||
|
||||||
|
prop == ICPPASTFunctionDeclarator.EXCEPTION_TYPEID) {
|
||||||
IScope result = scopeViaFunctionDtor((ICPPASTFunctionDeclarator) node.getParent());
|
IScope result = scopeViaFunctionDtor((ICPPASTFunctionDeclarator) node.getParent());
|
||||||
if (result != null)
|
if (result != null)
|
||||||
return result;
|
return result;
|
||||||
|
@ -1264,7 +1261,11 @@ public class CPPVisitor extends ASTQueries {
|
||||||
} else if (parent instanceof IASTStatement) {
|
} else if (parent instanceof IASTStatement) {
|
||||||
scope = getContainingScope((IASTStatement) parent);
|
scope = getContainingScope((IASTStatement) parent);
|
||||||
} else if (parent instanceof IASTFunctionDefinition) {
|
} else if (parent instanceof IASTFunctionDefinition) {
|
||||||
IASTFunctionDeclarator fnDeclarator = ((IASTFunctionDefinition) parent).getDeclarator();
|
final IASTFunctionDefinition fdef = (IASTFunctionDefinition) parent;
|
||||||
|
if (statement instanceof ICPPASTCatchHandler)
|
||||||
|
return fdef.getScope();
|
||||||
|
|
||||||
|
IASTFunctionDeclarator fnDeclarator = fdef.getDeclarator();
|
||||||
IASTName name = findInnermostDeclarator(fnDeclarator).getName();
|
IASTName name = findInnermostDeclarator(fnDeclarator).getName();
|
||||||
if (name instanceof ICPPASTQualifiedName) {
|
if (name instanceof ICPPASTQualifiedName) {
|
||||||
IASTName[] ns = ((ICPPASTQualifiedName) name).getNames();
|
IASTName[] ns = ((ICPPASTQualifiedName) name).getNames();
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Bryan Wilkinson (QNX) - Initial API and implementation
|
* Bryan Wilkinson (QNX) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.index;
|
package org.eclipse.cdt.internal.core.index;
|
||||||
|
|
||||||
|
|
|
@ -336,7 +336,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (binding instanceof ICPPSpecialization) {
|
if (binding instanceof ICPPSpecialization) {
|
||||||
IBinding specialized = ((ICPPSpecialization)binding).getSpecializedBinding();
|
IBinding specialized = ((ICPPSpecialization) binding).getSpecializedBinding();
|
||||||
PDOMBinding pdomSpecialized= addBinding(specialized, null);
|
PDOMBinding pdomSpecialized= addBinding(specialized, null);
|
||||||
if (pdomSpecialized == null)
|
if (pdomSpecialized == null)
|
||||||
return null;
|
return null;
|
||||||
|
@ -371,11 +371,11 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
}
|
}
|
||||||
} else if (binding instanceof ICPPConstructor) {
|
} else if (binding instanceof ICPPConstructor) {
|
||||||
if (parent instanceof PDOMCPPClassType || parent instanceof PDOMCPPClassSpecialization) {
|
if (parent instanceof PDOMCPPClassType || parent instanceof PDOMCPPClassSpecialization) {
|
||||||
pdomBinding = new PDOMCPPConstructor(this, parent, (ICPPConstructor)binding);
|
pdomBinding = new PDOMCPPConstructor(this, parent, (ICPPConstructor) binding);
|
||||||
}
|
}
|
||||||
} else if (binding instanceof ICPPMethod) {
|
} else if (binding instanceof ICPPMethod) {
|
||||||
if (parent instanceof PDOMCPPClassType || parent instanceof PDOMCPPClassSpecialization) {
|
if (parent instanceof PDOMCPPClassType || parent instanceof PDOMCPPClassSpecialization) {
|
||||||
pdomBinding = new PDOMCPPMethod(this, parent, (ICPPMethod)binding);
|
pdomBinding = new PDOMCPPMethod(this, parent, (ICPPMethod) binding);
|
||||||
}
|
}
|
||||||
} else if (binding instanceof ICPPFunction) {
|
} else if (binding instanceof ICPPFunction) {
|
||||||
pdomBinding = new PDOMCPPFunction(this, parent, (ICPPFunction) binding, true);
|
pdomBinding = new PDOMCPPFunction(this, parent, (ICPPFunction) binding, true);
|
||||||
|
@ -397,7 +397,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (binding instanceof ITypedef) {
|
} else if (binding instanceof ITypedef) {
|
||||||
pdomBinding = new PDOMCPPTypedef(this, parent, (ITypedef)binding);
|
pdomBinding = new PDOMCPPTypedef(this, parent, (ITypedef) binding);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdomBinding != null) {
|
if (pdomBinding != null) {
|
||||||
|
@ -611,7 +611,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
return adaptBinding(null, inputBinding, includeLocal ? FILE_LOCAL_REC_DUMMY : null);
|
return adaptBinding(null, inputBinding, includeLocal ? FILE_LOCAL_REC_DUMMY : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final PDOMBinding adaptBinding(final PDOMNode parent, IBinding inputBinding, long[] fileLocalRecHolder) throws CoreException {
|
private final PDOMBinding adaptBinding(final PDOMNode parent, IBinding inputBinding, long[] fileLocalRecHolder)
|
||||||
|
throws CoreException {
|
||||||
if (cannotAdapt(inputBinding)) {
|
if (cannotAdapt(inputBinding)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -639,7 +640,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
final Long key = record + CACHE_BASES;
|
final Long key = record + CACHE_BASES;
|
||||||
PDOMCPPNamespace[] result= (PDOMCPPNamespace[]) getPDOM().getCachedResult(key);
|
PDOMCPPNamespace[] result= (PDOMCPPNamespace[]) getPDOM().getCachedResult(key);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
List<PDOMCPPNamespace> nslist = PDOMCPPNamespace.collectInlineNamespaces(getDB(), getLinkage(), record+FIRST_NAMESPACE_CHILD_OFFSET);
|
List<PDOMCPPNamespace> nslist = PDOMCPPNamespace.collectInlineNamespaces(getDB(),
|
||||||
|
getLinkage(), record + FIRST_NAMESPACE_CHILD_OFFSET);
|
||||||
if (nslist == null) {
|
if (nslist == null) {
|
||||||
result= new PDOMCPPNamespace[0];
|
result= new PDOMCPPNamespace[0];
|
||||||
} else {
|
} else {
|
||||||
|
@ -651,9 +653,10 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the equivalent binding, or binding place holder within this PDOM
|
* Finds the equivalent binding, or binding placeholder within this PDOM.
|
||||||
*/
|
*/
|
||||||
private final PDOMBinding doAdaptBinding(PDOMNode parent, IBinding binding, long[] fileLocalRecHolder) throws CoreException {
|
private final PDOMBinding doAdaptBinding(PDOMNode parent, IBinding binding, long[] fileLocalRecHolder)
|
||||||
|
throws CoreException {
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
parent= adaptOrAddParent(false, binding);
|
parent= adaptOrAddParent(false, binding);
|
||||||
}
|
}
|
||||||
|
@ -935,9 +938,6 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage#getUsingDirectives()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPUsingDirective[] getUsingDirectives(PDOMFile file) throws CoreException {
|
public ICPPUsingDirective[] getUsingDirectives(PDOMFile file) throws CoreException {
|
||||||
long rec= file.getLastUsingDirectiveRec();
|
long rec= file.getLastUsingDirectiveRec();
|
||||||
|
@ -1026,7 +1026,6 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
return addBinding(type, null);
|
return addBinding(type, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IType unmarshalType(ITypeMarshalBuffer buffer) throws CoreException {
|
public IType unmarshalType(ITypeMarshalBuffer buffer) throws CoreException {
|
||||||
int firstByte= buffer.getByte();
|
int firstByte= buffer.getByte();
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Sergey Prigogin (Google) - initial API and implementation
|
* Sergey Prigogin (Google) - initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* @see ICPPUsingDeclaration
|
* @see ICPPUsingDeclaration
|
||||||
*/
|
*/
|
||||||
class PDOMCPPUsingDeclaration extends PDOMCPPBinding implements ICPPUsingDeclaration {
|
class PDOMCPPUsingDeclaration extends PDOMCPPBinding implements ICPPUsingDeclaration {
|
||||||
|
|
||||||
private static final int TARGET_BINDING = PDOMCPPBinding.RECORD_SIZE + 0;
|
private static final int TARGET_BINDING = PDOMCPPBinding.RECORD_SIZE + 0;
|
||||||
// Using declarations for functions may have multiple delegates. We model such case
|
// Using declarations for functions may have multiple delegates. We model such case
|
||||||
// by creating a chain of PDOMCPPUsingDeclaration objects linked by NEXT_DELEGATE field.
|
// by creating a chain of PDOMCPPUsingDeclaration objects linked by NEXT_DELEGATE field.
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class PDOMCPPUsingDeclarationSpecialization extends PDOMCPPSpecialization implem
|
||||||
@Override
|
@Override
|
||||||
public IBinding[] getDelegates() {
|
public IBinding[] getDelegates() {
|
||||||
if (delegates == null) {
|
if (delegates == null) {
|
||||||
PDOMNodeLinkedList list= new PDOMNodeLinkedList(getLinkage(), record+TARGET_BINDINGS);
|
PDOMNodeLinkedList list= new PDOMNodeLinkedList(getLinkage(), record+ TARGET_BINDINGS);
|
||||||
final List<IBinding> result= new ArrayList<IBinding>();
|
final List<IBinding> result= new ArrayList<IBinding>();
|
||||||
try {
|
try {
|
||||||
list.accept(new IPDOMVisitor() {
|
list.accept(new IPDOMVisitor() {
|
||||||
|
@ -78,6 +78,7 @@ class PDOMCPPUsingDeclarationSpecialization extends PDOMCPPSpecialization implem
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void leave(IPDOMNode node) {
|
public void leave(IPDOMNode node) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,24 +153,18 @@
|
||||||
<documentation>
|
<documentation>
|
||||||
Use this element to specify the context where an error parser can be used. If none is specified, a default context type will be "build".
|
Use this element to specify the context where an error parser can be used. If none is specified, a default context type will be "build".
|
||||||
|
|
||||||
An error parser can be assigned to more than one context type. For example, an error parser can have two "context" elements, one for "build" and one for "codan".
|
An example of context type is "build". Only error parsers in this context are used to parse build output. You can see these error parsers in the "C/C++" > "Build" > "Settings" preference page.
|
||||||
|
|
||||||
|
An error parser can be assigned to more than one context type. Clients contributing error parsers are free to define their own context types.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
<complexType>
|
<complexType>
|
||||||
<attribute name="type" use="required">
|
<attribute name="type" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
The type of context where an error parser can be used. Valid values are "build" and "codan".
|
The type of context where an error parser can be used.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
<simpleType>
|
|
||||||
<restriction base="string">
|
|
||||||
<enumeration value="build">
|
|
||||||
</enumeration>
|
|
||||||
<enumeration value="codan">
|
|
||||||
</enumeration>
|
|
||||||
</restriction>
|
|
||||||
</simpleType>
|
|
||||||
</attribute>
|
</attribute>
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2012 Google, Inc 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:
|
|
||||||
* Alex Ruiz (Google) - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.core;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates the context in which <code>{@link org.eclipse.cdt.core.IErrorParser}</code>s can be
|
|
||||||
* used.
|
|
||||||
*
|
|
||||||
* @since 5.4
|
|
||||||
*/
|
|
||||||
public class ErrorParserContext {
|
|
||||||
public static final int BUILD = 1 << 0;
|
|
||||||
public static final int CODAN = 1 << 1;
|
|
||||||
|
|
||||||
public static int getValue(String text) {
|
|
||||||
if ("build".equals(text)) { //$NON-NLS-1$
|
|
||||||
return BUILD;
|
|
||||||
}
|
|
||||||
if ("codan".equals(text)) { //$NON-NLS-1$
|
|
||||||
return CODAN;
|
|
||||||
}
|
|
||||||
throw new IllegalArgumentException("Unknown context value: " + text); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -11,11 +11,10 @@
|
||||||
* James Blackburn (Broadcom) - Bug 247838
|
* James Blackburn (Broadcom) - Bug 247838
|
||||||
* Andrew Gvozdev (Quoin Inc)
|
* Andrew Gvozdev (Quoin Inc)
|
||||||
* Dmitry Kozlov (CodeSourcery) - Build error highlighting and navigation
|
* Dmitry Kozlov (CodeSourcery) - Build error highlighting and navigation
|
||||||
|
* Alex Ruiz (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core;
|
package org.eclipse.cdt.core;
|
||||||
|
|
||||||
import static org.eclipse.cdt.core.ErrorParserContext.BUILD;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -68,6 +67,11 @@ public class ErrorParserManager extends OutputStream implements IConsoleParser,
|
||||||
*/
|
*/
|
||||||
public final static char ERROR_PARSER_DELIMITER = ';';
|
public final static char ERROR_PARSER_DELIMITER = ';';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 5.4
|
||||||
|
*/
|
||||||
|
public static final String BUILD_CONTEXT = "build"; //$NON-NLS-1$
|
||||||
|
|
||||||
private int nOpens;
|
private int nOpens;
|
||||||
private int lineCounter=0;
|
private int lineCounter=0;
|
||||||
|
|
||||||
|
@ -75,7 +79,7 @@ public class ErrorParserManager extends OutputStream implements IConsoleParser,
|
||||||
private final IMarkerGenerator fMarkerGenerator;
|
private final IMarkerGenerator fMarkerGenerator;
|
||||||
|
|
||||||
private Map<String, IErrorParser[]> fErrorParsers;
|
private Map<String, IErrorParser[]> fErrorParsers;
|
||||||
private final ArrayList<ProblemMarkerInfo> fErrors;
|
private final List<ProblemMarkerInfo> fErrors;
|
||||||
|
|
||||||
private final Vector<URI> fDirectoryStack;
|
private final Vector<URI> fDirectoryStack;
|
||||||
private final URI fBaseDirectoryURI;
|
private final URI fBaseDirectoryURI;
|
||||||
|
@ -149,28 +153,11 @@ public class ErrorParserManager extends OutputStream implements IConsoleParser,
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
public ErrorParserManager(IProject project, URI baseDirectoryURI, IMarkerGenerator markerGenerator, String[] parsersIDs) {
|
public ErrorParserManager(IProject project, URI baseDirectoryURI, IMarkerGenerator markerGenerator, String[] parsersIDs) {
|
||||||
this(project, baseDirectoryURI, markerGenerator, parsersIDs, BUILD);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* URI based constructor.
|
|
||||||
*
|
|
||||||
* @param project - project being built.
|
|
||||||
* @param baseDirectoryURI - absolute location URI of working directory of where the build is performed.
|
|
||||||
* @param markerGenerator - marker generator able to create markers.
|
|
||||||
* @param parsersIDs - array of error parsers' IDs.
|
|
||||||
* @param context - context where the error parser will be used. Valid values are defined by
|
|
||||||
* <code>{@link ErrorParserContext}</code>.
|
|
||||||
* @see ErrorParserContext
|
|
||||||
* @since 5.4
|
|
||||||
*/
|
|
||||||
public ErrorParserManager(IProject project, URI baseDirectoryURI,
|
|
||||||
IMarkerGenerator markerGenerator, String[] parsersIDs, int context) {
|
|
||||||
fProject = project;
|
fProject = project;
|
||||||
fMarkerGenerator = markerGenerator;
|
fMarkerGenerator = markerGenerator;
|
||||||
fDirectoryStack = new Vector<URI>();
|
fDirectoryStack = new Vector<URI>();
|
||||||
fErrors = new ArrayList<ProblemMarkerInfo>();
|
fErrors = new ArrayList<ProblemMarkerInfo>();
|
||||||
enableErrorParsers(parsersIDs, context);
|
enableErrorParsers(parsersIDs);
|
||||||
|
|
||||||
if (baseDirectoryURI != null) {
|
if (baseDirectoryURI != null) {
|
||||||
fBaseDirectoryURI = baseDirectoryURI;
|
fBaseDirectoryURI = baseDirectoryURI;
|
||||||
|
@ -182,13 +169,13 @@ public class ErrorParserManager extends OutputStream implements IConsoleParser,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableErrorParsers(String[] parsersIDs, int context) {
|
private void enableErrorParsers(String[] parserIDs) {
|
||||||
if (parsersIDs == null) {
|
if (parserIDs == null) {
|
||||||
parsersIDs = ErrorParserExtensionManager.getDefaultErrorParserIds();
|
parserIDs = ErrorParserExtensionManager.getDefaultErrorParserIds();
|
||||||
}
|
}
|
||||||
fErrorParsers = new LinkedHashMap<String, IErrorParser[]>(parsersIDs.length);
|
fErrorParsers = new LinkedHashMap<String, IErrorParser[]>(parserIDs.length);
|
||||||
for (String parsersID : parsersIDs) {
|
for (String parsersID : parserIDs) {
|
||||||
IErrorParser errorParser = getErrorParserCopy(parsersID, context);
|
IErrorParser errorParser = getErrorParserCopy(parsersID);
|
||||||
if (errorParser!=null) {
|
if (errorParser!=null) {
|
||||||
fErrorParsers.put(parsersID, new IErrorParser[] {errorParser} );
|
fErrorParsers.put(parsersID, new IErrorParser[] {errorParser} );
|
||||||
}
|
}
|
||||||
|
@ -375,7 +362,7 @@ outer:
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
String id = ""; //$NON-NLS-1$
|
String id = ""; //$NON-NLS-1$
|
||||||
if (parser instanceof IErrorParserNamed) {
|
if (parser instanceof IErrorParserNamed) {
|
||||||
id = ((IErrorParserNamed)parser).getId();
|
id = ((IErrorParserNamed) parser).getId();
|
||||||
}
|
}
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
String message = "Errorparser " + id + " failed parsing line [" + lineToParse + "]";
|
String message = "Errorparser " + id + " failed parsing line [" + lineToParse + "]";
|
||||||
|
@ -832,6 +819,16 @@ outer:
|
||||||
return ErrorParserExtensionManager.getErrorParserAvailableIds();
|
return ErrorParserExtensionManager.getErrorParserAvailableIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context - indicates the context in which an error parser can be used.
|
||||||
|
* @return available error parsers ID, which include contributed through extension and user-
|
||||||
|
* defined ones from workspace, that can be used in the given context.
|
||||||
|
* @since 5.4
|
||||||
|
*/
|
||||||
|
public static String[] getErrorParserAvailableIdsInContext(String context) {
|
||||||
|
return ErrorParserExtensionManager.getErrorParserAvailableIdsInContext(context);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return IDs of error parsers contributed through error parser extension point.
|
* @return IDs of error parsers contributed through error parser extension point.
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
|
@ -870,20 +867,6 @@ outer:
|
||||||
return ErrorParserExtensionManager.getErrorParserCopy(id, false);
|
return ErrorParserExtensionManager.getErrorParserCopy(id, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param id - ID of error parser
|
|
||||||
* @param context - context where the error parser will be used. Valid values are defined by
|
|
||||||
* <code>{@link ErrorParserContext}</code>.
|
|
||||||
* @return cloned copy of error parser or {@code null}.
|
|
||||||
* Note that {@link ErrorParserNamedWrapper} returns shallow copy with the same instance
|
|
||||||
* of underlying error parser.
|
|
||||||
* @see ErrorParserContext
|
|
||||||
* @since 5.4
|
|
||||||
*/
|
|
||||||
public static IErrorParserNamed getErrorParserCopy(String id, int context) {
|
|
||||||
return ErrorParserExtensionManager.getErrorParserCopy(id, false, context);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id - ID of error parser
|
* @param id - ID of error parser
|
||||||
* @return cloned copy of error parser as defined by its extension point or {@code null}.
|
* @return cloned copy of error parser as defined by its extension point or {@code null}.
|
||||||
|
|
|
@ -11,12 +11,14 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.errorparsers;
|
package org.eclipse.cdt.internal.errorparsers;
|
||||||
|
|
||||||
import static org.eclipse.cdt.core.ErrorParserContext.BUILD;
|
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -25,7 +27,6 @@ import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.ErrorParserContext;
|
|
||||||
import org.eclipse.cdt.core.ErrorParserManager;
|
import org.eclipse.cdt.core.ErrorParserManager;
|
||||||
import org.eclipse.cdt.core.IErrorParser;
|
import org.eclipse.cdt.core.IErrorParser;
|
||||||
import org.eclipse.cdt.core.IErrorParserNamed;
|
import org.eclipse.cdt.core.IErrorParserNamed;
|
||||||
|
@ -33,7 +34,6 @@ import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
import org.eclipse.cdt.core.errorparsers.ErrorParserNamedWrapper;
|
import org.eclipse.cdt.core.errorparsers.ErrorParserNamedWrapper;
|
||||||
import org.eclipse.cdt.core.errorparsers.RegexErrorParser;
|
import org.eclipse.cdt.core.errorparsers.RegexErrorParser;
|
||||||
import org.eclipse.cdt.core.errorparsers.RegexErrorPattern;
|
import org.eclipse.cdt.core.errorparsers.RegexErrorPattern;
|
||||||
import org.eclipse.cdt.internal.core.Pair;
|
|
||||||
import org.eclipse.cdt.internal.core.XmlUtil;
|
import org.eclipse.cdt.internal.core.XmlUtil;
|
||||||
import org.eclipse.core.filesystem.URIUtil;
|
import org.eclipse.core.filesystem.URIUtil;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -71,7 +71,6 @@ public class ErrorParserExtensionManager {
|
||||||
private static final String ATTR_POINT = "point"; //$NON-NLS-1$
|
private static final String ATTR_POINT = "point"; //$NON-NLS-1$
|
||||||
private static final String ATTR_TYPE = "type"; //$NON-NLS-1$
|
private static final String ATTR_TYPE = "type"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
private static final String ATTR_REGEX = "regex"; //$NON-NLS-1$
|
private static final String ATTR_REGEX = "regex"; //$NON-NLS-1$
|
||||||
private static final String ATTR_SEVERITY = "severity"; //$NON-NLS-1$
|
private static final String ATTR_SEVERITY = "severity"; //$NON-NLS-1$
|
||||||
private static final String ATTR_FILE = "file-expr"; //$NON-NLS-1$
|
private static final String ATTR_FILE = "file-expr"; //$NON-NLS-1$
|
||||||
|
@ -85,10 +84,9 @@ public class ErrorParserExtensionManager {
|
||||||
private static final String ATTR_VALUE_INFO = "Info"; //$NON-NLS-1$
|
private static final String ATTR_VALUE_INFO = "Info"; //$NON-NLS-1$
|
||||||
private static final String ATTR_VALUE_IGNORE = "Ignore"; //$NON-NLS-1$
|
private static final String ATTR_VALUE_IGNORE = "Ignore"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Key: error parser id. Value: pair of error parser and contexts value
|
private static final LinkedHashMap<String, IErrorParserNamed> fExtensionErrorParsers = new LinkedHashMap<String, IErrorParserNamed>();
|
||||||
private static final LinkedHashMap<String, Pair<IErrorParserNamed, Integer>> fExtensionErrorParsers = new LinkedHashMap<String, Pair<IErrorParserNamed, Integer>>();
|
private static final LinkedHashMap<String, IErrorParserNamed> fAvailableErrorParsers = new LinkedHashMap<String, IErrorParserNamed>();
|
||||||
// Key: error parser id. Value: pair of error parser and contexts value
|
private static final Map<String, Set<String>> fErrorParserContexts = new HashMap<String, Set<String>>();
|
||||||
private static final LinkedHashMap<String, Pair<IErrorParserNamed, Integer>> fAvailableErrorParsers = new LinkedHashMap<String, Pair<IErrorParserNamed, Integer>>();
|
|
||||||
private static LinkedHashMap<String, IErrorParserNamed> fUserDefinedErrorParsers = null;
|
private static LinkedHashMap<String, IErrorParserNamed> fUserDefinedErrorParsers = null;
|
||||||
private static List<String> fDefaultErrorParserIds = null;
|
private static List<String> fDefaultErrorParserIds = null;
|
||||||
|
|
||||||
|
@ -121,18 +119,6 @@ public class ErrorParserExtensionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ErrorParserAndContextComparator implements Comparator<Pair<IErrorParserNamed, Integer>> {
|
|
||||||
private static final ErrorParserComparator DELEGATE = new ErrorParserComparator();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compare(Pair<IErrorParserNamed, Integer> pair1,
|
|
||||||
Pair<IErrorParserNamed, Integer> pair2) {
|
|
||||||
IErrorParserNamed parser1 = pair1.first;
|
|
||||||
IErrorParserNamed parser2 = pair2.first;
|
|
||||||
return DELEGATE.compare(parser1, parser2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
loadUserDefinedErrorParsers();
|
loadUserDefinedErrorParsers();
|
||||||
loadDefaultErrorParserIds();
|
loadDefaultErrorParserIds();
|
||||||
|
@ -223,13 +209,12 @@ public class ErrorParserExtensionManager {
|
||||||
* @noreference This method is not intended to be referenced by clients.
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
synchronized public static void loadErrorParserExtensions() {
|
synchronized public static void loadErrorParserExtensions() {
|
||||||
Set<Pair<IErrorParserNamed, Integer>> sortedErrorParsers =
|
Set<IErrorParserNamed> sortedErrorParsers = new TreeSet<IErrorParserNamed>(new ErrorParserComparator());
|
||||||
new TreeSet<Pair<IErrorParserNamed, Integer>>(new ErrorParserAndContextComparator());
|
|
||||||
loadErrorParserExtensions(Platform.getExtensionRegistry(), sortedErrorParsers);
|
loadErrorParserExtensions(Platform.getExtensionRegistry(), sortedErrorParsers);
|
||||||
|
|
||||||
fExtensionErrorParsers.clear();
|
fExtensionErrorParsers.clear();
|
||||||
for (Pair<IErrorParserNamed, Integer> pair : sortedErrorParsers) {
|
for (IErrorParserNamed errorParser : sortedErrorParsers) {
|
||||||
fExtensionErrorParsers.put(pair.first.getId(), pair);
|
fExtensionErrorParsers.put(errorParser.getId(), errorParser);
|
||||||
}
|
}
|
||||||
recalculateAvailableErrorParsers();
|
recalculateAvailableErrorParsers();
|
||||||
}
|
}
|
||||||
|
@ -240,8 +225,7 @@ public class ErrorParserExtensionManager {
|
||||||
* @param registry - extension registry
|
* @param registry - extension registry
|
||||||
* @param errorParsers - resulting set of error parsers
|
* @param errorParsers - resulting set of error parsers
|
||||||
*/
|
*/
|
||||||
private static void loadErrorParserExtensions(IExtensionRegistry registry,
|
private static void loadErrorParserExtensions(IExtensionRegistry registry, Set<IErrorParserNamed> errorParsers) {
|
||||||
Set<Pair<IErrorParserNamed, Integer>> errorParsers) {
|
|
||||||
errorParsers.clear();
|
errorParsers.clear();
|
||||||
IExtensionPoint extension = registry.getExtensionPoint(CCorePlugin.PLUGIN_ID, CCorePlugin.ERROR_PARSER_SIMPLE_ID);
|
IExtensionPoint extension = registry.getExtensionPoint(CCorePlugin.PLUGIN_ID, CCorePlugin.ERROR_PARSER_SIMPLE_ID);
|
||||||
if (extension != null) {
|
if (extension != null) {
|
||||||
|
@ -255,9 +239,8 @@ public class ErrorParserExtensionManager {
|
||||||
if (cfgEl.getName().equals(ELEM_ERRORPARSER)) {
|
if (cfgEl.getName().equals(ELEM_ERRORPARSER)) {
|
||||||
IErrorParserNamed errorParser = createErrorParserCarcass(oldStyleId, oldStyleName, cfgEl);
|
IErrorParserNamed errorParser = createErrorParserCarcass(oldStyleId, oldStyleName, cfgEl);
|
||||||
if (errorParser!=null) {
|
if (errorParser!=null) {
|
||||||
Pair<IErrorParserNamed, Integer> configured =
|
configureErrorParser(errorParser, cfgEl);
|
||||||
configureErrorParser(errorParser, cfgEl);
|
errorParsers.add(errorParser);
|
||||||
errorParsers.add(configured);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,50 +261,42 @@ public class ErrorParserExtensionManager {
|
||||||
List<String> ids = new ArrayList<String>();
|
List<String> ids = new ArrayList<String>();
|
||||||
if (fDefaultErrorParserIds!=null) {
|
if (fDefaultErrorParserIds!=null) {
|
||||||
for (String id : fDefaultErrorParserIds) {
|
for (String id : fDefaultErrorParserIds) {
|
||||||
Pair<IErrorParserNamed, Integer> pair = null;
|
|
||||||
IErrorParserNamed errorParser = null;
|
IErrorParserNamed errorParser = null;
|
||||||
if (fUserDefinedErrorParsers!=null) {
|
if (fUserDefinedErrorParsers!=null) {
|
||||||
errorParser = fUserDefinedErrorParsers.get(id);
|
errorParser = fUserDefinedErrorParsers.get(id);
|
||||||
}
|
}
|
||||||
if (errorParser != null) {
|
if (errorParser==null) {
|
||||||
pair = errorParserForBuild(errorParser);
|
errorParser = fExtensionErrorParsers.get(id);
|
||||||
} else {
|
|
||||||
pair = fExtensionErrorParsers.get(id);
|
|
||||||
}
|
}
|
||||||
if (pair != null) {
|
if (errorParser!=null) {
|
||||||
fAvailableErrorParsers.put(id, pair);
|
fAvailableErrorParsers.put(id, errorParser);
|
||||||
ids.add(id);
|
ids.add(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// then the rest in the order defined by comparator
|
// then the rest in the order defined by comparator
|
||||||
Set<Pair<IErrorParserNamed, Integer>> sortedErrorParsers =
|
Set<IErrorParserNamed> sortedErrorParsers = new TreeSet<IErrorParserNamed>(new ErrorParserComparator());
|
||||||
new TreeSet<Pair<IErrorParserNamed, Integer>>(new ErrorParserAndContextComparator());
|
|
||||||
|
|
||||||
if (fUserDefinedErrorParsers!=null) {
|
if (fUserDefinedErrorParsers!=null) {
|
||||||
for (String id : fUserDefinedErrorParsers.keySet()) {
|
for (String id : fUserDefinedErrorParsers.keySet()) {
|
||||||
if (!ids.contains(id)) {
|
if (!ids.contains(id)) {
|
||||||
IErrorParserNamed errorParser = fUserDefinedErrorParsers.get(id);
|
IErrorParserNamed errorParser = fUserDefinedErrorParsers.get(id);
|
||||||
sortedErrorParsers.add(errorParserForBuild(errorParser));
|
sortedErrorParsers.add(errorParser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String id : fExtensionErrorParsers.keySet()) {
|
for (String id : fExtensionErrorParsers.keySet()) {
|
||||||
if (!ids.contains(id)) {
|
if (!ids.contains(id)) {
|
||||||
Pair<IErrorParserNamed, Integer> pair = fExtensionErrorParsers.get(id);
|
IErrorParserNamed errorParser = fExtensionErrorParsers.get(id);
|
||||||
sortedErrorParsers.add(pair);
|
sortedErrorParsers.add(errorParser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Pair<IErrorParserNamed, Integer> pairs : sortedErrorParsers) {
|
for (IErrorParserNamed errorParser : sortedErrorParsers) {
|
||||||
fAvailableErrorParsers.put(pairs.first.getId(), pairs);
|
fAvailableErrorParsers.put(errorParser.getId(), errorParser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Pair<IErrorParserNamed, Integer> errorParserForBuild(IErrorParserNamed errorParser) {
|
|
||||||
return new Pair<IErrorParserNamed, Integer>(errorParser, ErrorParserContext.BUILD);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serialize error parsers in workspace level storage.
|
* Serialize error parsers in workspace level storage.
|
||||||
*
|
*
|
||||||
|
@ -576,8 +551,7 @@ public class ErrorParserExtensionManager {
|
||||||
* @param cfgEl - extension configuration element
|
* @param cfgEl - extension configuration element
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
private static Pair<IErrorParserNamed, Integer> configureErrorParser(
|
private static void configureErrorParser(IErrorParserNamed errorParser, IConfigurationElement cfgEl) throws CoreException {
|
||||||
IErrorParserNamed errorParser, IConfigurationElement cfgEl) throws CoreException {
|
|
||||||
String id = cfgEl.getAttribute(ATTR_ID);
|
String id = cfgEl.getAttribute(ATTR_ID);
|
||||||
if (id!=null && id.length()>0)
|
if (id!=null && id.length()>0)
|
||||||
errorParser.setId(id);
|
errorParser.setId(id);
|
||||||
|
@ -602,31 +576,37 @@ public class ErrorParserExtensionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int contexts = contextTypes(cfgEl);
|
findContexts(id, cfgEl);
|
||||||
return new Pair<IErrorParserNamed, Integer>(errorParser, contexts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a bit mask of contexts where an error parser can be used. Valid values for context
|
* Finds the contexts where an error parser can be used. Clients determine whether the found
|
||||||
* are defined in <code>{@link ErrorParserContext}</code>.
|
* context values are valid.
|
||||||
*
|
*
|
||||||
|
* @param errorParserId the error parser id.
|
||||||
* @param errorParserElement represents an "errorparser" element in the extension point
|
* @param errorParserElement represents an "errorparser" element in the extension point
|
||||||
* "org.eclipse.cdt.core.ErrorParser".
|
* "org.eclipse.cdt.core.ErrorParser".
|
||||||
* @return the contexts in which an error parser can be used, or
|
|
||||||
* <code>{@link ErrorParserContext#BUILD BUILD}</code> is none is specified.
|
|
||||||
* @see ErrorParserContext
|
|
||||||
*/
|
*/
|
||||||
private static int contextTypes(IConfigurationElement errorParserElement) {
|
private static void findContexts(String errorParserId, IConfigurationElement errorParserElement) {
|
||||||
|
Set<String> contexts = fErrorParserContexts.get(errorParserId);
|
||||||
IConfigurationElement[] contextElements = errorParserElement.getChildren(ELEM_CONTEXT);
|
IConfigurationElement[] contextElements = errorParserElement.getChildren(ELEM_CONTEXT);
|
||||||
if (contextElements.length == 0) {
|
if (contextElements.length == 0) {
|
||||||
return BUILD;
|
return;
|
||||||
|
}
|
||||||
|
boolean newContextCreated = false;
|
||||||
|
if (contexts == null) {
|
||||||
|
contexts = new HashSet<String>();
|
||||||
|
newContextCreated = true;
|
||||||
}
|
}
|
||||||
int contexts = 0;
|
|
||||||
for (IConfigurationElement contextElement : contextElements) {
|
for (IConfigurationElement contextElement : contextElements) {
|
||||||
String contextType = contextElement.getAttribute(ATTR_TYPE);
|
String context = contextElement.getAttribute(ATTR_TYPE);
|
||||||
contexts = contexts | ErrorParserContext.getValue(contextType);
|
if (context != null) {
|
||||||
|
contexts.add(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (newContextCreated && !contexts.isEmpty()) {
|
||||||
|
fErrorParserContexts.put(errorParserId, contexts);
|
||||||
}
|
}
|
||||||
return contexts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -639,8 +619,7 @@ public class ErrorParserExtensionManager {
|
||||||
* @return internal instance of error parser
|
* @return internal instance of error parser
|
||||||
*/
|
*/
|
||||||
public static IErrorParser getErrorParserInternal(String id) {
|
public static IErrorParser getErrorParserInternal(String id) {
|
||||||
Pair<IErrorParserNamed, Integer> pair = fAvailableErrorParsers.get(id);
|
IErrorParserNamed errorParser = fAvailableErrorParsers.get(id);
|
||||||
IErrorParserNamed errorParser = pair.first;
|
|
||||||
if (errorParser instanceof ErrorParserNamedWrapper)
|
if (errorParser instanceof ErrorParserNamedWrapper)
|
||||||
return ((ErrorParserNamedWrapper) errorParser).getErrorParser();
|
return ((ErrorParserNamedWrapper) errorParser).getErrorParser();
|
||||||
return errorParser;
|
return errorParser;
|
||||||
|
@ -685,25 +664,14 @@ public class ErrorParserExtensionManager {
|
||||||
* from workspace
|
* from workspace
|
||||||
*/
|
*/
|
||||||
public static String[] getErrorParserAvailableIds() {
|
public static String[] getErrorParserAvailableIds() {
|
||||||
return getErrorParserIds(fAvailableErrorParsers, BUILD);
|
return fAvailableErrorParsers.keySet().toArray(new String[fAvailableErrorParsers.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return IDs of error parsers contributed through error parser extension point.
|
* @return IDs of error parsers contributed through error parser extension point.
|
||||||
*/
|
*/
|
||||||
public static String[] getErrorParserExtensionIds() {
|
public static String[] getErrorParserExtensionIds() {
|
||||||
return getErrorParserIds(fExtensionErrorParsers, BUILD);
|
return fExtensionErrorParsers.keySet().toArray(new String[fExtensionErrorParsers.size()]);
|
||||||
}
|
|
||||||
|
|
||||||
private static String[] getErrorParserIds(
|
|
||||||
Map<String, Pair<IErrorParserNamed, Integer>> parsers, int context) {
|
|
||||||
List<String> ids = new ArrayList<String>();
|
|
||||||
for (Map.Entry<String, Pair<IErrorParserNamed, Integer>> entry : parsers.entrySet()) {
|
|
||||||
if (isInContext(entry.getValue(), context)) {
|
|
||||||
ids.add(entry.getKey());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ids.toArray(new String[ids.size()]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -748,7 +716,7 @@ public class ErrorParserExtensionManager {
|
||||||
*/
|
*/
|
||||||
public static String[] getDefaultErrorParserIds() {
|
public static String[] getDefaultErrorParserIds() {
|
||||||
if (fDefaultErrorParserIds == null) {
|
if (fDefaultErrorParserIds == null) {
|
||||||
return getErrorParserIds(fAvailableErrorParsers, BUILD);
|
return fAvailableErrorParsers.keySet().toArray(new String[fAvailableErrorParsers.size()]);
|
||||||
}
|
}
|
||||||
return fDefaultErrorParserIds.toArray(new String[fDefaultErrorParserIds.size()]);
|
return fDefaultErrorParserIds.toArray(new String[fDefaultErrorParserIds.size()]);
|
||||||
}
|
}
|
||||||
|
@ -760,26 +728,8 @@ public class ErrorParserExtensionManager {
|
||||||
* shallow copy with the same instance of underlying error parser.
|
* shallow copy with the same instance of underlying error parser.
|
||||||
*/
|
*/
|
||||||
public static IErrorParserNamed getErrorParserCopy(String id, boolean isExtension) {
|
public static IErrorParserNamed getErrorParserCopy(String id, boolean isExtension) {
|
||||||
return getErrorParserCopy(id, isExtension, BUILD);
|
IErrorParserNamed errorParser = isExtension ? fExtensionErrorParsers.get(id) : fAvailableErrorParsers.get(id);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param id - ID of error parser
|
|
||||||
* @param isExtension - if {@code true} get unmodified copy of error parser defined as extension
|
|
||||||
* @param context - context where the error parser will be used. Valid values are defined by
|
|
||||||
* <code>{@link ErrorParserContext}</code>.
|
|
||||||
* @return cloned copy of error parser. Note that {@link ErrorParserNamedWrapper} returns
|
|
||||||
* shallow copy with the same instance of underlying error parser.
|
|
||||||
* @see ErrorParserContext
|
|
||||||
*/
|
|
||||||
public static IErrorParserNamed getErrorParserCopy(String id, boolean isExtension,
|
|
||||||
int context) {
|
|
||||||
Pair<IErrorParserNamed, Integer> pair =
|
|
||||||
isExtension ? fExtensionErrorParsers.get(id) : fAvailableErrorParsers.get(id);
|
|
||||||
if (pair == null || !isInContext(pair, context)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
IErrorParserNamed errorParser = pair.first;
|
|
||||||
try {
|
try {
|
||||||
if (errorParser instanceof RegexErrorParser) {
|
if (errorParser instanceof RegexErrorParser) {
|
||||||
return (RegexErrorParser) ((RegexErrorParser) errorParser).clone();
|
return (RegexErrorParser) ((RegexErrorParser) errorParser).clone();
|
||||||
|
@ -792,7 +742,37 @@ public class ErrorParserExtensionManager {
|
||||||
return errorParser;
|
return errorParser;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isInContext(Pair<IErrorParserNamed, Integer> pair, int context) {
|
/**
|
||||||
return (pair.second & context) != 0;
|
* @param context - indicates the context in which an error parser can be used.
|
||||||
|
* @return available error parsers ID, which include contributed through extension and user-
|
||||||
|
* defined ones from workspace, that can be used in the given context.
|
||||||
|
*/
|
||||||
|
public static String[] getErrorParserAvailableIdsInContext(String context) {
|
||||||
|
List<String> ids = new ArrayList<String>();
|
||||||
|
for (String id : fAvailableErrorParsers.keySet()) {
|
||||||
|
if (getErrorParserContexts(id).contains(context)) {
|
||||||
|
ids.add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ids.toArray(new String[ids.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all the contexts of the error parser with the given ID. Contexts are {@code String}
|
||||||
|
* values belonging to an error parser, defined as part the "errorparser" extension point
|
||||||
|
* element.
|
||||||
|
* <p>
|
||||||
|
* If an error parser does not have an explicit context, it is assumed that the error parser
|
||||||
|
* can be used in the "build" context.
|
||||||
|
* </p>
|
||||||
|
* @param id the id of the error parser.
|
||||||
|
* @return the contexts of the error parser with the given ID.
|
||||||
|
*/
|
||||||
|
private static Collection<String> getErrorParserContexts(String id) {
|
||||||
|
Set<String> contexts = fErrorParserContexts.get(id);
|
||||||
|
if (contexts == null) {
|
||||||
|
return Collections.singletonList(ErrorParserManager.BUILD_CONTEXT);
|
||||||
|
}
|
||||||
|
return contexts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,14 @@
|
||||||
<artifactId>org.eclipse.cdt.ui.tests</artifactId>
|
<artifactId>org.eclipse.cdt.ui.tests</artifactId>
|
||||||
<packaging>eclipse-test-plugin</packaging>
|
<packaging>eclipse-test-plugin</packaging>
|
||||||
|
|
||||||
<repositories>
|
<!-- Uncommenting this is useful when the repo is built first then you want to run tests on this plugin only -->
|
||||||
|
<!-- <repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>cdt.repo</id>
|
<id>cdt.repo</id>
|
||||||
<url>file:/${basedir}/../../releng/org.eclipse.cdt.repo/target/repository</url>
|
<url>file:/${basedir}/../../releng/org.eclipse.cdt.repo/target/repository</url>
|
||||||
<layout>p2</layout>
|
<layout>p2</layout>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>-->
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class RefactoringTests extends BaseTestFramework {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
|
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
|
||||||
fBufferSize= FileCharSequenceProvider.BUFFER_SIZE;
|
fBufferSize= FileCharSequenceProvider.BUFFER_SIZE;
|
||||||
FileCharSequenceProvider.BUFFER_SIZE= 1024*4;
|
FileCharSequenceProvider.BUFFER_SIZE= 1024 * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -65,7 +65,7 @@ public class RefactoringTests extends BaseTestFramework {
|
||||||
|
|
||||||
protected void assertTotalChanges(int numChanges, int potChanges, int commentCh,
|
protected void assertTotalChanges(int numChanges, int potChanges, int commentCh,
|
||||||
Change changes) throws Exception {
|
Change changes) throws Exception {
|
||||||
int count[]= {0,0,0};
|
int count[]= { 0, 0, 0 };
|
||||||
if (changes != null) {
|
if (changes != null) {
|
||||||
countChanges(changes, count);
|
countChanges(changes, count);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests.refactoring.rename;
|
package org.eclipse.cdt.ui.tests.refactoring.rename;
|
||||||
|
|
||||||
|
@ -21,12 +21,14 @@ import org.eclipse.ltk.core.refactoring.RefactoringStatus;
|
||||||
|
|
||||||
public class RenameFunctionTests extends RenameTests {
|
public class RenameFunctionTests extends RenameTests {
|
||||||
|
|
||||||
public RenameFunctionTests(String name) {
|
public RenameFunctionTests(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite(){
|
public static Test suite(){
|
||||||
return suite(true);
|
return suite(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite( boolean cleanup ) {
|
public static Test suite( boolean cleanup ) {
|
||||||
TestSuite suite = new TestSuite(RenameFunctionTests.class);
|
TestSuite suite = new TestSuite(RenameFunctionTests.class);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests.refactoring.rename;
|
package org.eclipse.cdt.ui.tests.refactoring.rename;
|
||||||
|
|
||||||
|
@ -24,9 +24,11 @@ public class RenameMacroTests extends RenameTests {
|
||||||
public RenameMacroTests(String name) {
|
public RenameMacroTests(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite(){
|
public static Test suite(){
|
||||||
return suite(true);
|
return suite(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite( boolean cleanup ) {
|
public static Test suite( boolean cleanup ) {
|
||||||
TestSuite suite = new TestSuite(RenameMacroTests.class);
|
TestSuite suite = new TestSuite(RenameMacroTests.class);
|
||||||
if (cleanup) {
|
if (cleanup) {
|
||||||
|
@ -35,7 +37,6 @@ public class RenameMacroTests extends RenameTests {
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void testMacroRename() throws Exception {
|
public void testMacroRename() throws Exception {
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
writer.write("#define HALLO x \n"); //$NON-NLS-1$
|
writer.write("#define HALLO x \n"); //$NON-NLS-1$
|
||||||
|
|
|
@ -6,9 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.ui.tests.refactoring.rename;
|
package org.eclipse.cdt.ui.tests.refactoring.rename;
|
||||||
|
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
@ -28,9 +27,11 @@ public class RenameTemplatesTests extends RenameTests {
|
||||||
public RenameTemplatesTests(String name) {
|
public RenameTemplatesTests(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite(){
|
public static Test suite(){
|
||||||
return suite(true);
|
return suite(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite( boolean cleanup ) {
|
public static Test suite( boolean cleanup ) {
|
||||||
TestSuite suite = new TestSuite(RenameTemplatesTests.class);
|
TestSuite suite = new TestSuite(RenameTemplatesTests.class);
|
||||||
if (cleanup) {
|
if (cleanup) {
|
||||||
|
@ -39,7 +40,6 @@ public class RenameTemplatesTests extends RenameTests {
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void testClassTemplate() throws Exception {
|
public void testClassTemplate() throws Exception {
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
writer.write("template <class Type> \n"); //$NON-NLS-1$
|
writer.write("template <class Type> \n"); //$NON-NLS-1$
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.tests.refactoring.rename;
|
package org.eclipse.cdt.ui.tests.refactoring.rename;
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ import org.eclipse.cdt.internal.ui.refactoring.rename.TextSearchWrapper;
|
||||||
* @author markus.schorn@windriver.com
|
* @author markus.schorn@windriver.com
|
||||||
*/
|
*/
|
||||||
public class RenameTests extends RefactoringTests {
|
public class RenameTests extends RefactoringTests {
|
||||||
|
|
||||||
private static final IProgressMonitor NPM = new NullProgressMonitor();
|
private static final IProgressMonitor NPM = new NullProgressMonitor();
|
||||||
|
|
||||||
public RenameTests(String name) {
|
public RenameTests(String name) {
|
||||||
|
@ -58,7 +57,7 @@ public class RenameTests extends RefactoringTests {
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
fail ("Input check on "+ newName + " failed. "+rs.getEntryMatchingSeverity(RefactoringStatus.ERROR) ); //$NON-NLS-1$ //$NON-NLS-2$
|
fail ("Input check on " + newName + " failed. "+rs.getEntryMatchingSeverity(RefactoringStatus.ERROR) ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
//rs.getFirstMessage(RefactoringStatus.ERROR) is not the message displayed in
|
//rs.getFirstMessage(RefactoringStatus.ERROR) is not the message displayed in
|
||||||
//the UI for renaming a method to a constructor, the first message which is only
|
//the UI for renaming a method to a constructor, the first message which is only
|
||||||
//a warning is shown in the UI. If you click preview, then the error and the warning
|
//a warning is shown in the UI. If you click preview, then the error and the warning
|
||||||
|
@ -153,8 +152,7 @@ public class RenameTests extends RefactoringTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IFile importFile(String fileName, String contents)
|
protected IFile importFile(String fileName, String contents) throws Exception {
|
||||||
throws Exception {
|
|
||||||
IFile result= super.importFile(fileName, contents);
|
IFile result= super.importFile(fileName, contents);
|
||||||
waitForIndexer();
|
waitForIndexer();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2008 Wind River Systems, Inc.
|
* Copyright (c) 2005, 2012 Wind River Systems, Inc.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.ui.tests.refactoring.rename;
|
package org.eclipse.cdt.ui.tests.refactoring.rename;
|
||||||
|
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
@ -28,18 +28,19 @@ public class RenameTypeTests extends RenameTests {
|
||||||
public RenameTypeTests(String name) {
|
public RenameTypeTests(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
public static Test suite(){
|
|
||||||
|
public static Test suite() {
|
||||||
return suite(true);
|
return suite(true);
|
||||||
}
|
}
|
||||||
public static Test suite( boolean cleanup ) {
|
|
||||||
|
public static Test suite(boolean cleanup) {
|
||||||
TestSuite suite = new TestSuite(RenameTypeTests.class);
|
TestSuite suite = new TestSuite(RenameTypeTests.class);
|
||||||
if (cleanup) {
|
if (cleanup) {
|
||||||
suite.addTest( new RefactoringTests("cleanupProject") ); //$NON-NLS-1$
|
suite.addTest(new RefactoringTests("cleanupProject")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void testClassNameConflicts() throws Exception {
|
public void testClassNameConflicts() throws Exception {
|
||||||
createCppFwdDecls("cpp_fwd.hh"); //$NON-NLS-1$
|
createCppFwdDecls("cpp_fwd.hh"); //$NON-NLS-1$
|
||||||
createCppDefs("cpp_def.hh"); //$NON-NLS-1$
|
createCppDefs("cpp_def.hh"); //$NON-NLS-1$
|
||||||
|
@ -75,7 +76,7 @@ public class RenameTypeTests extends RenameTests {
|
||||||
writer.write(" } \n"); //$NON-NLS-1$
|
writer.write(" } \n"); //$NON-NLS-1$
|
||||||
writer.write("} \n"); //$NON-NLS-1$
|
writer.write("} \n"); //$NON-NLS-1$
|
||||||
String contents = writer.toString();
|
String contents = writer.toString();
|
||||||
IFile cpp= importFile("test.cpp", contents ); //$NON-NLS-1$
|
IFile cpp= importFile("test.cpp", contents); //$NON-NLS-1$
|
||||||
|
|
||||||
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
||||||
int offset2= contents.indexOf("v2"); //$NON-NLS-1$
|
int offset2= contents.indexOf("v2"); //$NON-NLS-1$
|
||||||
|
@ -417,7 +418,7 @@ public class RenameTypeTests extends RenameTests {
|
||||||
writer.write(" } \n"); //$NON-NLS-1$
|
writer.write(" } \n"); //$NON-NLS-1$
|
||||||
writer.write("} \n"); //$NON-NLS-1$
|
writer.write("} \n"); //$NON-NLS-1$
|
||||||
String contents = writer.toString();
|
String contents = writer.toString();
|
||||||
IFile cpp= importFile("test.cpp", contents ); //$NON-NLS-1$
|
IFile cpp= importFile("test.cpp", contents); //$NON-NLS-1$
|
||||||
|
|
||||||
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
||||||
int offset2= contents.indexOf("v2"); //$NON-NLS-1$
|
int offset2= contents.indexOf("v2"); //$NON-NLS-1$
|
||||||
|
@ -755,7 +756,7 @@ public class RenameTypeTests extends RenameTests {
|
||||||
writer.write(" } \n"); //$NON-NLS-1$
|
writer.write(" } \n"); //$NON-NLS-1$
|
||||||
writer.write("} \n"); //$NON-NLS-1$
|
writer.write("} \n"); //$NON-NLS-1$
|
||||||
String contents = writer.toString();
|
String contents = writer.toString();
|
||||||
IFile cpp= importFile("test.cpp", contents ); //$NON-NLS-1$
|
IFile cpp= importFile("test.cpp", contents); //$NON-NLS-1$
|
||||||
|
|
||||||
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
||||||
int offset2= contents.indexOf("v2"); //$NON-NLS-1$
|
int offset2= contents.indexOf("v2"); //$NON-NLS-1$
|
||||||
|
@ -1079,7 +1080,7 @@ public class RenameTypeTests extends RenameTests {
|
||||||
writer.write(" } \n"); //$NON-NLS-1$
|
writer.write(" } \n"); //$NON-NLS-1$
|
||||||
writer.write("} \n"); //$NON-NLS-1$
|
writer.write("} \n"); //$NON-NLS-1$
|
||||||
String contents = writer.toString();
|
String contents = writer.toString();
|
||||||
IFile cpp= importFile("test.cpp", contents ); //$NON-NLS-1$
|
IFile cpp= importFile("test.cpp", contents); //$NON-NLS-1$
|
||||||
|
|
||||||
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -1176,7 +1177,7 @@ public class RenameTypeTests extends RenameTests {
|
||||||
writer.write(" } \n"); //$NON-NLS-1$
|
writer.write(" } \n"); //$NON-NLS-1$
|
||||||
writer.write("} \n"); //$NON-NLS-1$
|
writer.write("} \n"); //$NON-NLS-1$
|
||||||
String contents = writer.toString();
|
String contents = writer.toString();
|
||||||
IFile cpp= importFile("test.cpp", contents ); //$NON-NLS-1$
|
IFile cpp= importFile("test.cpp", contents); //$NON-NLS-1$
|
||||||
|
|
||||||
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
||||||
int offset2= contents.indexOf("v2"); //$NON-NLS-1$
|
int offset2= contents.indexOf("v2"); //$NON-NLS-1$
|
||||||
|
@ -1493,7 +1494,7 @@ public class RenameTypeTests extends RenameTests {
|
||||||
writer.write(" int w1; vv1.v++; \n"); //$NON-NLS-1$
|
writer.write(" int w1; vv1.v++; \n"); //$NON-NLS-1$
|
||||||
writer.write("} \n"); //$NON-NLS-1$
|
writer.write("} \n"); //$NON-NLS-1$
|
||||||
String contents = writer.toString();
|
String contents = writer.toString();
|
||||||
IFile cpp= importFile("test.c", contents ); //$NON-NLS-1$
|
IFile cpp= importFile("test.c", contents); //$NON-NLS-1$
|
||||||
|
|
||||||
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -1580,7 +1581,7 @@ public class RenameTypeTests extends RenameTests {
|
||||||
writer.write(" int w3; v3 v; \n"); //$NON-NLS-1$
|
writer.write(" int w3; v3 v; \n"); //$NON-NLS-1$
|
||||||
writer.write("} \n"); //$NON-NLS-1$
|
writer.write("} \n"); //$NON-NLS-1$
|
||||||
String contents = writer.toString();
|
String contents = writer.toString();
|
||||||
IFile cpp= importFile("test.cpp", contents ); //$NON-NLS-1$
|
IFile cpp= importFile("test.cpp", contents); //$NON-NLS-1$
|
||||||
|
|
||||||
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
||||||
int offset2= contents.indexOf("v2"); //$NON-NLS-1$
|
int offset2= contents.indexOf("v2"); //$NON-NLS-1$
|
||||||
|
@ -1837,7 +1838,7 @@ public class RenameTypeTests extends RenameTests {
|
||||||
writer.write(" int w1; enum v1 v; \n"); //$NON-NLS-1$
|
writer.write(" int w1; enum v1 v; \n"); //$NON-NLS-1$
|
||||||
writer.write("} \n"); //$NON-NLS-1$
|
writer.write("} \n"); //$NON-NLS-1$
|
||||||
String contents = writer.toString();
|
String contents = writer.toString();
|
||||||
IFile cpp= importFile("test.c", contents ); //$NON-NLS-1$
|
IFile cpp= importFile("test.c", contents); //$NON-NLS-1$
|
||||||
|
|
||||||
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -1925,7 +1926,7 @@ public class RenameTypeTests extends RenameTests {
|
||||||
writer.write(" } \n"); //$NON-NLS-1$
|
writer.write(" } \n"); //$NON-NLS-1$
|
||||||
writer.write("} \n"); //$NON-NLS-1$
|
writer.write("} \n"); //$NON-NLS-1$
|
||||||
String contents = writer.toString();
|
String contents = writer.toString();
|
||||||
IFile cpp= importFile("test.cpp", contents ); //$NON-NLS-1$
|
IFile cpp= importFile("test.cpp", contents); //$NON-NLS-1$
|
||||||
|
|
||||||
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
||||||
int offset2= contents.indexOf("v2"); //$NON-NLS-1$
|
int offset2= contents.indexOf("v2"); //$NON-NLS-1$
|
||||||
|
@ -2176,7 +2177,7 @@ public class RenameTypeTests extends RenameTests {
|
||||||
writer.write(" int w1; v1 v; \n"); //$NON-NLS-1$
|
writer.write(" int w1; v1 v; \n"); //$NON-NLS-1$
|
||||||
writer.write("} \n"); //$NON-NLS-1$
|
writer.write("} \n"); //$NON-NLS-1$
|
||||||
String contents = writer.toString();
|
String contents = writer.toString();
|
||||||
IFile cpp= importFile("test.c", contents ); //$NON-NLS-1$
|
IFile cpp= importFile("test.c", contents); //$NON-NLS-1$
|
||||||
|
|
||||||
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
int offset1= contents.indexOf("v1"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -2257,42 +2258,61 @@ public class RenameTypeTests extends RenameTests {
|
||||||
writer.write(" String(); \n"); //$NON-NLS-1$
|
writer.write(" String(); \n"); //$NON-NLS-1$
|
||||||
writer.write(" String(const String &other); \n"); //$NON-NLS-1$
|
writer.write(" String(const String &other); \n"); //$NON-NLS-1$
|
||||||
writer.write(" ~String(); \n"); //$NON-NLS-1$
|
writer.write(" ~String(); \n"); //$NON-NLS-1$
|
||||||
writer.write(" String &operator=( const String &other ); \n"); //$NON-NLS-1$
|
writer.write(" String &operator=(const String &other); \n"); //$NON-NLS-1$
|
||||||
writer.write("}; \n"); //$NON-NLS-1$
|
writer.write("}; \n"); //$NON-NLS-1$
|
||||||
writer.write(" String::String(){} \n"); //$NON-NLS-1$
|
writer.write(" String::String() {} \n"); //$NON-NLS-1$
|
||||||
writer.write(" String::String(const String &other){}; \n"); //$NON-NLS-1$
|
writer.write(" String::String(const String &other) {}; \n"); //$NON-NLS-1$
|
||||||
writer.write(" String::~String(){}; \n"); //$NON-NLS-1$
|
writer.write(" String::~String() {}; \n"); //$NON-NLS-1$
|
||||||
writer.write(" String& String::operator=( const String &other ) \n"); //$NON-NLS-1$
|
writer.write(" String& String::operator=(const String &other) \n"); //$NON-NLS-1$
|
||||||
writer.write(" {return *this;} \n"); //$NON-NLS-1$
|
writer.write(" {return *this;} \n"); //$NON-NLS-1$
|
||||||
String contents = writer.toString();
|
String contents = writer.toString();
|
||||||
IFile cpp= importFile("test.cpp", contents ); //$NON-NLS-1$
|
IFile cpp= importFile("test.cpp", contents); //$NON-NLS-1$
|
||||||
|
|
||||||
int offset1= contents.indexOf("String"); //$NON-NLS-1$
|
int offset= contents.indexOf("String"); //$NON-NLS-1$
|
||||||
|
|
||||||
// conflicting renamings
|
// conflicting renamings
|
||||||
RefactoringStatus status= checkConditions(cpp, offset1, "CString"); //$NON-NLS-1$
|
RefactoringStatus status= checkConditions(cpp, offset, "CString"); //$NON-NLS-1$
|
||||||
assertRefactoringOk(status);
|
assertRefactoringOk(status);
|
||||||
Change ch= getRefactorChanges(cpp, offset1, "CString"); //$NON-NLS-1$
|
Change ch= getRefactorChanges(cpp, offset, "CString"); //$NON-NLS-1$
|
||||||
assertTotalChanges(countOccurrences(contents, "String"), ch); //$NON-NLS-1$
|
assertTotalChanges(countOccurrences(contents, "String"), ch); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testUsingDeclaration_332895() throws Exception {
|
||||||
|
StringWriter writer = new StringWriter();
|
||||||
|
writer.write("namespace ns { \n"); //$NON-NLS-1$
|
||||||
|
writer.write("typedef int MyType; \n"); //$NON-NLS-1$
|
||||||
|
writer.write("} \n"); //$NON-NLS-1$
|
||||||
|
writer.write(" \n"); //$NON-NLS-1$
|
||||||
|
writer.write("using ns::MyType; \n"); //$NON-NLS-1$
|
||||||
|
writer.write("MyType a; \n"); //$NON-NLS-1$
|
||||||
|
String contents = writer.toString();
|
||||||
|
IFile cpp= importFile("test.cpp", contents); //$NON-NLS-1$
|
||||||
|
|
||||||
|
int offset= contents.indexOf("MyType"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
RefactoringStatus status= checkConditions(cpp, offset, "YourType"); //$NON-NLS-1$
|
||||||
|
assertRefactoringOk(status);
|
||||||
|
Change ch= getRefactorChanges(cpp, offset, "YourType"); //$NON-NLS-1$
|
||||||
|
assertTotalChanges(countOccurrences(contents, "MyType"), ch); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
public void testBug72888() throws Exception {
|
public void testBug72888() throws Exception {
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
writer.write("class MyEx {}; \n"); //$NON-NLS-1$
|
writer.write("class MyEx {}; \n"); //$NON-NLS-1$
|
||||||
writer.write("void someFunc() { \n"); //$NON-NLS-1$
|
writer.write("void someFunc() { \n"); //$NON-NLS-1$
|
||||||
writer.write(" throw MyEx(); \n"); //$NON-NLS-1$
|
writer.write(" throw MyEx(); \n"); //$NON-NLS-1$
|
||||||
writer.write("}; \n"); //$NON-NLS-1$
|
writer.write("}; \n"); //$NON-NLS-1$
|
||||||
writer.write("int main(){ \n"); //$NON-NLS-1$
|
writer.write("int main(){ \n"); //$NON-NLS-1$
|
||||||
writer.write(" try{ \n"); //$NON-NLS-1$
|
writer.write(" try { \n"); //$NON-NLS-1$
|
||||||
writer.write(" someFunc(); \n"); //$NON-NLS-1$
|
writer.write(" someFunc(); \n"); //$NON-NLS-1$
|
||||||
writer.write(" } catch(MyEx &e) {} \n"); //$NON-NLS-1$
|
writer.write(" } catch(MyEx &e) {} \n"); //$NON-NLS-1$
|
||||||
writer.write(" return 0; \n"); //$NON-NLS-1$
|
writer.write(" return 0; \n"); //$NON-NLS-1$
|
||||||
writer.write("} \n"); //$NON-NLS-1$
|
writer.write("} \n"); //$NON-NLS-1$
|
||||||
String contents = writer.toString();
|
String contents = writer.toString();
|
||||||
IFile cpp= importFile("test.cpp", contents ); //$NON-NLS-1$
|
IFile cpp= importFile("test.cpp", contents); //$NON-NLS-1$
|
||||||
|
|
||||||
int offset = contents.indexOf("MyEx") ; //$NON-NLS-1$
|
int offset = contents.indexOf("MyEx") ; //$NON-NLS-1$
|
||||||
Change changes = getRefactorChanges(cpp, offset, "xx"); //$NON-NLS-1$
|
Change changes = getRefactorChanges(cpp, offset, "xx"); //$NON-NLS-1$
|
||||||
assertTotalChanges( 3, changes );
|
assertTotalChanges(3, changes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.ui.tests.refactoring.rename;
|
package org.eclipse.cdt.ui.tests.refactoring.rename;
|
||||||
|
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
@ -28,9 +27,11 @@ public class RenameVariableTests extends RenameTests {
|
||||||
public RenameVariableTests(String name) {
|
public RenameVariableTests(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite(){
|
public static Test suite(){
|
||||||
return suite(true);
|
return suite(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite( boolean cleanup ) {
|
public static Test suite( boolean cleanup ) {
|
||||||
TestSuite suite = new TestSuite(RenameVariableTests.class);
|
TestSuite suite = new TestSuite(RenameVariableTests.class);
|
||||||
|
|
||||||
|
|
|
@ -6,20 +6,24 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.ui.tests.refactoring.rename;
|
package org.eclipse.cdt.ui.tests.refactoring.rename;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.*;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.ltk.core.refactoring.*;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.ltk.core.refactoring.participants.*;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
|
import org.eclipse.ltk.core.refactoring.Change;
|
||||||
|
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
|
||||||
|
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
|
||||||
|
import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
|
||||||
|
import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
|
||||||
|
|
||||||
public class TestRenameParticipant extends RenameParticipant {
|
public class TestRenameParticipant extends RenameParticipant {
|
||||||
private static Object sElement= null;
|
private static Object sElement;
|
||||||
private static RenameArguments sArguments= null;
|
private static RenameArguments sArguments;
|
||||||
private static int sConditionCheck= 0;
|
private static int sConditionCheck;
|
||||||
private static int sCreateChange= 0;
|
private static int sCreateChange;
|
||||||
|
|
||||||
public static int getConditionCheckCount() {
|
public static int getConditionCheckCount() {
|
||||||
return sConditionCheck;
|
return sConditionCheck;
|
||||||
|
@ -40,7 +44,8 @@ public class TestRenameParticipant extends RenameParticipant {
|
||||||
public static void reset() {
|
public static void reset() {
|
||||||
sElement= null;
|
sElement= null;
|
||||||
sArguments= null;
|
sArguments= null;
|
||||||
sConditionCheck= sCreateChange= 0;
|
sConditionCheck= 0;
|
||||||
|
sCreateChange= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2011 Wind River Systems, Inc. and others.
|
* Copyright (c) 2005, 2012 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -97,6 +97,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
import org.eclipse.cdt.core.index.IIndexName;
|
import org.eclipse.cdt.core.index.IIndexName;
|
||||||
|
@ -1208,18 +1209,27 @@ public class ASTManager implements IDisposable {
|
||||||
} else {
|
} else {
|
||||||
final IASTTranslationUnit tu = name.getTranslationUnit();
|
final IASTTranslationUnit tu = name.getTranslationUnit();
|
||||||
final IIndex index= tu != null ? tu.getIndex() : null;
|
final IIndex index= tu != null ? tu.getIndex() : null;
|
||||||
for (IBinding renameBinding : fValidBindings) {
|
IBinding[] bindings = binding instanceof ICPPUsingDeclaration ?
|
||||||
try {
|
((ICPPUsingDeclaration) binding).getDelegates() : new IBinding[] { binding };
|
||||||
int cmp0= isSameBinding(index, binding, renameBinding);
|
// When a 'using' declaration has multiple delegate bindings and only some of them
|
||||||
if (cmp0 != FALSE) {
|
// are being renamed, to preserve correctness of the code we would have to split
|
||||||
cmp= cmp0;
|
// the 'using' declaration into two separate ones. We currently don't do that and
|
||||||
}
|
// rename the 'using' declaration if at least one of its delegate bindings is being
|
||||||
if (cmp0 == TRUE) {
|
// renamed.
|
||||||
break;
|
outer: for (IBinding b : bindings) {
|
||||||
}
|
for (IBinding renameBinding : fValidBindings) {
|
||||||
} catch (DOMException e) {
|
try {
|
||||||
handleDOMException(name.getTranslationUnit(), e, status);
|
int cmp0= isSameBinding(index, b, renameBinding);
|
||||||
cmp= UNKNOWN;
|
if (cmp0 != FALSE) {
|
||||||
|
cmp= cmp0;
|
||||||
|
}
|
||||||
|
if (cmp0 == TRUE) {
|
||||||
|
break outer;
|
||||||
|
}
|
||||||
|
} catch (DOMException e) {
|
||||||
|
handleDOMException(name.getTranslationUnit(), e, status);
|
||||||
|
cmp= UNKNOWN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.refactoring.rename;
|
package org.eclipse.cdt.internal.ui.refactoring.rename;
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class CRefactoringMatch {
|
||||||
return fFile;
|
return fFile;
|
||||||
}
|
}
|
||||||
public void setASTInformation(int val) {
|
public void setASTInformation(int val) {
|
||||||
switch(fAstInformation) {
|
switch (fAstInformation) {
|
||||||
case AST_REFERENCE:
|
case AST_REFERENCE:
|
||||||
case AST_REFERENCE_OTHER:
|
case AST_REFERENCE_OTHER:
|
||||||
case AST_REFEREENCE_CONFLICTING:
|
case AST_REFEREENCE_CONFLICTING:
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.refactoring.rename;
|
package org.eclipse.cdt.internal.ui.refactoring.rename;
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processor adding constructor and destructor to the bindings to be renamed.
|
* Processor adding constructor and destructor to the bindings to be renamed.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.refactoring.rename;
|
package org.eclipse.cdt.internal.ui.refactoring.rename;
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,7 @@ public class ErrorParsTab extends AbstractCPropertyTab {
|
||||||
}
|
}
|
||||||
fAvailableErrorParsers.clear();
|
fAvailableErrorParsers.clear();
|
||||||
fOptionsPageMap.clear();
|
fOptionsPageMap.clear();
|
||||||
for (String id : ErrorParserManager.getErrorParserAvailableIds()) {
|
for (String id : ErrorParserManager.getErrorParserAvailableIdsInContext(ErrorParserManager.BUILD_CONTEXT)) {
|
||||||
IErrorParserNamed errorParser = ErrorParserManager.getErrorParserCopy(id);
|
IErrorParserNamed errorParser = ErrorParserManager.getErrorParserCopy(id);
|
||||||
fAvailableErrorParsers.put(id, errorParser);
|
fAvailableErrorParsers.put(id, errorParser);
|
||||||
initializeOptionsPage(id);
|
initializeOptionsPage(id);
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
label="%featureName"
|
label="%featureName"
|
||||||
version="1.1.0.qualifier"
|
version="1.1.0.qualifier"
|
||||||
provider-name="%providerName"
|
provider-name="%providerName"
|
||||||
plugin="org.eclipse.cdt.build.crossgcc"
|
plugin="org.eclipse.cdt.build.crossgcc">
|
||||||
license-feature="org.eclipse.cdt.license"
|
|
||||||
license-feature-version="1.0.0.qualifier">
|
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
%description
|
%description
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
id="org.eclipse.cdt.launch.remote"
|
id="org.eclipse.cdt.launch.remote"
|
||||||
label="%featureName"
|
label="%featureName"
|
||||||
version="6.0.0.qualifier"
|
version="6.0.0.qualifier"
|
||||||
provider-name="%providerName"
|
provider-name="%providerName">
|
||||||
license-feature="org.eclipse.cdt.license"
|
|
||||||
license-feature-version="1.0.0.qualifier">
|
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
%description
|
%description
|
||||||
|
|
|
@ -18,7 +18,6 @@ bin.includes = META-INF/,\
|
||||||
about.ini,\
|
about.ini,\
|
||||||
about.mappings,\
|
about.mappings,\
|
||||||
about.properties,\
|
about.properties,\
|
||||||
eclipse32.png,\
|
|
||||||
plugin.properties,\
|
plugin.properties,\
|
||||||
plugin.xml,\
|
plugin.xml,\
|
||||||
remotecdt.html,\
|
remotecdt.html,\
|
||||||
|
|
|
@ -22,7 +22,12 @@ Export-Package: org.eclipse.cdt.debug.core,
|
||||||
org.eclipse.cdt.debug.internal.core.breakpoints;x-friends:="org.eclipse.cdt.debug.edc,org.eclipse.cdt.dsf.gdb",
|
org.eclipse.cdt.debug.internal.core.breakpoints;x-friends:="org.eclipse.cdt.debug.edc,org.eclipse.cdt.dsf.gdb",
|
||||||
org.eclipse.cdt.debug.internal.core.executables;x-internal:=true,
|
org.eclipse.cdt.debug.internal.core.executables;x-internal:=true,
|
||||||
org.eclipse.cdt.debug.internal.core.model;x-internal:=true,
|
org.eclipse.cdt.debug.internal.core.model;x-internal:=true,
|
||||||
org.eclipse.cdt.debug.internal.core.sourcelookup;x-friends:="org.eclipse.cdt.dsf.ui,org.eclipse.cdt.debug.edc,org.eclipse.cdt.debug.gdbjtag.core"
|
org.eclipse.cdt.debug.internal.core.sourcelookup;
|
||||||
|
x-friends:="org.eclipse.cdt.dsf.ui,
|
||||||
|
org.eclipse.cdt.debug.edc,
|
||||||
|
org.eclipse.cdt.debug.gdbjtag.core,
|
||||||
|
org.eclipse.cdt.dsf.gdb,
|
||||||
|
org.eclipse.cdt.dsf"
|
||||||
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
|
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)",
|
org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)",
|
org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)",
|
||||||
|
|
|
@ -10,9 +10,9 @@ Export-Package:
|
||||||
org.eclipse.cdt.debug.internal.ui;x-internal:x-friends:="org.eclipse.cdt.dsf.ui";x-friends:="org.eclipse.cdt.dsf.ui",
|
org.eclipse.cdt.debug.internal.ui;x-internal:x-friends:="org.eclipse.cdt.dsf.ui";x-friends:="org.eclipse.cdt.dsf.ui",
|
||||||
org.eclipse.cdt.debug.internal.ui.actions;x-friends:="org.eclipse.cdt.dsf.ui,org.eclipse.cdt.debug.ui.memory.memorybrowser",
|
org.eclipse.cdt.debug.internal.ui.actions;x-friends:="org.eclipse.cdt.dsf.ui,org.eclipse.cdt.debug.ui.memory.memorybrowser",
|
||||||
org.eclipse.cdt.debug.internal.ui.actions.breakpoints;x-internal:=true,
|
org.eclipse.cdt.debug.internal.ui.actions.breakpoints;x-internal:=true,
|
||||||
org.eclipse.cdt.debug.internal.ui.breakpoints;x-internal:=true,
|
org.eclipse.cdt.debug.internal.ui.breakpoints;x-friends:="org.eclipse.cdt.dsf.ui",
|
||||||
org.eclipse.cdt.debug.internal.ui.commands;x-internal:=true,
|
org.eclipse.cdt.debug.internal.ui.commands;x-internal:=true,
|
||||||
org.eclipse.cdt.debug.internal.ui.dialogfields;x-internal:=true,
|
org.eclipse.cdt.debug.internal.ui.dialogfields;x-friends:="org.eclipse.cdt.dsf.gdb.ui",
|
||||||
org.eclipse.cdt.debug.internal.ui.dialogs;x-internal:=true,
|
org.eclipse.cdt.debug.internal.ui.dialogs;x-internal:=true,
|
||||||
org.eclipse.cdt.debug.internal.ui.disassembly.commands;x-internal:=true,
|
org.eclipse.cdt.debug.internal.ui.disassembly.commands;x-internal:=true,
|
||||||
org.eclipse.cdt.debug.internal.ui.disassembly.dsf;x-friends:="org.eclipse.cdt.dsf.ui",
|
org.eclipse.cdt.debug.internal.ui.disassembly.dsf;x-friends:="org.eclipse.cdt.dsf.ui",
|
||||||
|
|
|
@ -32,10 +32,9 @@
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<!-- Change to groupId org.eclipse.tycho.extra after upgrade to Tycho 0.14 -->
|
<groupId>org.eclipse.tycho.extras</groupId>
|
||||||
<groupId>com.google.code.tycho-eclipserun-plugin</groupId>
|
|
||||||
<artifactId>tycho-eclipserun-plugin</artifactId>
|
<artifactId>tycho-eclipserun-plugin</artifactId>
|
||||||
<version>${tycho-version}</version>
|
<version>${tycho-extras-version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<appArgLine>-application org.eclipse.ant.core.antRunner -buildfile buildDoc.xml</appArgLine>
|
<appArgLine>-application org.eclipse.ant.core.antRunner -buildfile buildDoc.xml</appArgLine>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -32,10 +32,9 @@
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<!-- Change to groupId org.eclipse.tycho.extra after upgrade to Tycho 0.14 -->
|
<groupId>org.eclipse.tycho.extras</groupId>
|
||||||
<groupId>com.google.code.tycho-eclipserun-plugin</groupId>
|
|
||||||
<artifactId>tycho-eclipserun-plugin</artifactId>
|
<artifactId>tycho-eclipserun-plugin</artifactId>
|
||||||
<version>${tycho-version}</version>
|
<version>${tycho-extras-version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<appArgLine>-application org.eclipse.ant.core.antRunner -buildfile customBuildCallbacks.xml build.index</appArgLine>
|
<appArgLine>-application org.eclipse.ant.core.antRunner -buildfile customBuildCallbacks.xml build.index</appArgLine>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010 Ericsson and others.
|
* Copyright (c) 2010, 2012 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Ericsson - initial API and implementation
|
* Ericsson - initial API and implementation
|
||||||
|
* Marc Khouzam (Ericsson) - Added support for collecting char pointers as strings (bug 373707)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.ui.tracepointactions;
|
package org.eclipse.cdt.dsf.gdb.internal.ui.tracepointactions;
|
||||||
|
|
||||||
|
@ -14,9 +15,16 @@ import org.eclipse.cdt.debug.core.breakpointactions.IBreakpointAction;
|
||||||
import org.eclipse.cdt.debug.ui.breakpointactions.IBreakpointActionPage;
|
import org.eclipse.cdt.debug.ui.breakpointactions.IBreakpointActionPage;
|
||||||
import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.CollectAction;
|
import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.CollectAction;
|
||||||
import org.eclipse.core.runtime.PlatformObject;
|
import org.eclipse.core.runtime.PlatformObject;
|
||||||
|
import org.eclipse.jface.fieldassist.ControlDecoration;
|
||||||
|
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
@ -26,7 +34,20 @@ import org.eclipse.swt.widgets.Text;
|
||||||
*/
|
*/
|
||||||
public class CollectActionPage extends PlatformObject implements IBreakpointActionPage {
|
public class CollectActionPage extends PlatformObject implements IBreakpointActionPage {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An exception to indicate that the user-specified string limit is invalid
|
||||||
|
*/
|
||||||
|
private class IllegalCollectStringLimitException extends Exception {
|
||||||
|
private static final long serialVersionUID = -2087722354642237691L;
|
||||||
|
public IllegalCollectStringLimitException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Text fCollectString;
|
private Text fCollectString;
|
||||||
|
private Button fTreatCharPtrAsStrings;
|
||||||
|
private Text fTreatCharPtrAsStringsLimit;
|
||||||
|
|
||||||
private CollectAction fCollectAction;
|
private CollectAction fCollectAction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,13 +57,72 @@ public class CollectActionPage extends PlatformObject implements IBreakpointActi
|
||||||
Composite composite = new Composite(parent, style);
|
Composite composite = new Composite(parent, style);
|
||||||
composite.setLayout(new GridLayout(2, false));
|
composite.setLayout(new GridLayout(2, false));
|
||||||
|
|
||||||
|
// The label asking for what to collect
|
||||||
final Label collectLabel = new Label(composite, SWT.NONE);
|
final Label collectLabel = new Label(composite, SWT.NONE);
|
||||||
collectLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
|
collectLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
|
||||||
collectLabel.setText(MessagesForTracepointActions.TracepointActions_Collect_Label);
|
collectLabel.setText(MessagesForTracepointActions.TracepointActions_Collect_Label);
|
||||||
|
|
||||||
|
// The user-specified string of what to collect
|
||||||
fCollectString = new Text(composite, SWT.BORDER);
|
fCollectString = new Text(composite, SWT.BORDER);
|
||||||
fCollectString.setText(fCollectAction.getCollectString());
|
fCollectString.setText(fCollectAction.getCollectString());
|
||||||
fCollectString.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
|
fCollectString.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
|
||||||
|
|
||||||
|
// An option to collect character pointers as strings
|
||||||
|
fTreatCharPtrAsStrings = new Button(composite, SWT.CHECK);
|
||||||
|
GridData gd = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
|
||||||
|
gd.verticalIndent = 15;
|
||||||
|
// Store the button width before we add the text as we only care about the checkbox width
|
||||||
|
int buttonWidth = fTreatCharPtrAsStrings.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
|
||||||
|
fTreatCharPtrAsStrings.setText(MessagesForTracepointActions.TracepointActions_Collect_Strings_Label);
|
||||||
|
fTreatCharPtrAsStrings.setLayoutData(gd);
|
||||||
|
fTreatCharPtrAsStrings.setSelection(fCollectAction.getCharPtrAsStrings());
|
||||||
|
fTreatCharPtrAsStrings.addSelectionListener(new SelectionListener() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
// Disable/enable the limit field
|
||||||
|
fTreatCharPtrAsStringsLimit.setEnabled(fTreatCharPtrAsStrings.getSelection());
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
// Disable/enable the limit field
|
||||||
|
fTreatCharPtrAsStringsLimit.setEnabled(fTreatCharPtrAsStrings.getSelection());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// A label asking for an optional limit of bytes of collected strings
|
||||||
|
final Label limitLabel = new Label(composite, SWT.NONE);
|
||||||
|
gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
|
||||||
|
gd.horizontalIndent = buttonWidth;
|
||||||
|
limitLabel.setLayoutData(gd);
|
||||||
|
limitLabel.setText(MessagesForTracepointActions.TracepointActions_Collect_Strings_Limit_Label);
|
||||||
|
|
||||||
|
// A user-specified limit of bytes
|
||||||
|
fTreatCharPtrAsStringsLimit = new Text(composite, SWT.BORDER);
|
||||||
|
fTreatCharPtrAsStringsLimit.setText(getCharPtrAsStringLimit(fCollectAction.getCharPtrAsStringsLimit()));
|
||||||
|
|
||||||
|
gd = new GridData(SWT.FILL, SWT.CENTER, false, false);
|
||||||
|
gd.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
|
||||||
|
fTreatCharPtrAsStringsLimit.setLayoutData(gd);
|
||||||
|
fTreatCharPtrAsStringsLimit.setEnabled(fTreatCharPtrAsStrings.getSelection());
|
||||||
|
|
||||||
|
final ControlDecoration decoration = new ControlDecoration(fTreatCharPtrAsStringsLimit, SWT.TOP | SWT.LEFT, composite );
|
||||||
|
decoration.hide();
|
||||||
|
fTreatCharPtrAsStringsLimit.addModifyListener(new ModifyListener() {
|
||||||
|
@Override
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
try {
|
||||||
|
getCharPtrAsStringLimit(fTreatCharPtrAsStringsLimit.getText());
|
||||||
|
decoration.hide();
|
||||||
|
} catch (IllegalCollectStringLimitException exception) {
|
||||||
|
decoration.setImage(
|
||||||
|
FieldDecorationRegistry.getDefault().getFieldDecoration(
|
||||||
|
FieldDecorationRegistry.DEC_ERROR).getImage());
|
||||||
|
decoration.setDescriptionText(exception.getMessage());
|
||||||
|
decoration.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
return composite;
|
return composite;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +138,14 @@ public class CollectActionPage extends PlatformObject implements IBreakpointActi
|
||||||
@Override
|
@Override
|
||||||
public void actionDialogOK() {
|
public void actionDialogOK() {
|
||||||
fCollectAction.setCollectString(fCollectString.getText());
|
fCollectAction.setCollectString(fCollectString.getText());
|
||||||
|
fCollectAction.setCharPtrAsStrings(fTreatCharPtrAsStrings.getSelection());
|
||||||
|
|
||||||
|
try {
|
||||||
|
Integer limit = getCharPtrAsStringLimit(fTreatCharPtrAsStringsLimit.getText());
|
||||||
|
fCollectAction.setCharPtrAsStringsLimit(limit);
|
||||||
|
} catch (IllegalCollectStringLimitException e) {
|
||||||
|
// ignore and keep old value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,4 +154,37 @@ public class CollectActionPage extends PlatformObject implements IBreakpointActi
|
||||||
return createCollectActionComposite(composite, style);
|
return createCollectActionComposite(composite, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the user-specified string into an integer.
|
||||||
|
* If the string is not valid, disable the limit by using null.
|
||||||
|
* @param limitStr The string provided by the user
|
||||||
|
* @return An non-negative integer limit, or null for no limit.
|
||||||
|
*/
|
||||||
|
private Integer getCharPtrAsStringLimit(String limitStr) throws IllegalCollectStringLimitException {
|
||||||
|
limitStr = limitStr.trim();
|
||||||
|
Integer limit = null;
|
||||||
|
try {
|
||||||
|
limit = Integer.parseInt(limitStr);
|
||||||
|
if (limit < 0) {
|
||||||
|
throw new IllegalCollectStringLimitException(MessagesForTracepointActions.TracepointActions_Collect_Strings_Limit_Error);
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
if (!limitStr.isEmpty()) {
|
||||||
|
// We only accept an empty string, which means no limit
|
||||||
|
throw new IllegalCollectStringLimitException(MessagesForTracepointActions.TracepointActions_Collect_Strings_Limit_Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the integer limit into a string.
|
||||||
|
* If the string is not valid, disable the limit by using null.
|
||||||
|
* @param limit The integer limit to convert. Can be null for no limit.
|
||||||
|
* @return The limit as a string, where no limit or a negative limit is the empty string.
|
||||||
|
*/
|
||||||
|
private String getCharPtrAsStringLimit(Integer limit) {
|
||||||
|
if (limit == null || limit < 0) return ""; //$NON-NLS-1$
|
||||||
|
return Integer.toString(limit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010 Ericsson and others.
|
* Copyright (c) 2010, 2012 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Ericsson - initial API and implementation
|
* Ericsson - initial API and implementation
|
||||||
|
* Marc Khouzam (Ericsson) - Added support for collecting char pointers as strings (bug 373707)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.ui.tracepointactions;
|
package org.eclipse.cdt.dsf.gdb.internal.ui.tracepointactions;
|
||||||
|
|
||||||
|
@ -39,6 +40,9 @@ class MessagesForTracepointActions extends NLS {
|
||||||
public static String TracepointActions_Collect_Label;
|
public static String TracepointActions_Collect_Label;
|
||||||
public static String TracepointActions_Evaluate_Label;
|
public static String TracepointActions_Evaluate_Label;
|
||||||
public static String TracepointActions_WhileStepping_Sub_Actions;
|
public static String TracepointActions_WhileStepping_Sub_Actions;
|
||||||
|
public static String TracepointActions_Collect_Strings_Label;
|
||||||
|
public static String TracepointActions_Collect_Strings_Limit_Label;
|
||||||
|
public static String TracepointActions_Collect_Strings_Limit_Error;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// initialize resource bundle
|
// initialize resource bundle
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Copyright (c) 2010 Ericsson and others.
|
# Copyright (c) 2010, 2012 Ericsson and others.
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
# which accompanies this distribution, and is available at
|
# which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
#
|
#
|
||||||
# Contributors:
|
# Contributors:
|
||||||
# Ericsson - initial API and implementation
|
# Ericsson - initial API and implementation
|
||||||
|
# Marc Khouzam (Ericsson) - Added support for collecting char pointers as strings (bug 373707)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
TracepointActions_Actions_for_this_tracepoint=Actions for this tracepoint:
|
TracepointActions_Actions_for_this_tracepoint=Actions for this tracepoint:
|
||||||
|
@ -29,3 +30,6 @@ TracepointActions_ActionDialog_Type=Action type:
|
||||||
TracepointActions_Collect_Label=Data to collect (comma-separated list):
|
TracepointActions_Collect_Label=Data to collect (comma-separated list):
|
||||||
TracepointActions_Evaluate_Label=Expressions to evaluate (comma-separated list):
|
TracepointActions_Evaluate_Label=Expressions to evaluate (comma-separated list):
|
||||||
TracepointActions_WhileStepping_Sub_Actions=Sub-actions for While-stepping
|
TracepointActions_WhileStepping_Sub_Actions=Sub-actions for While-stepping
|
||||||
|
TracepointActions_Collect_Strings_Label=Collect all character pointers as strings
|
||||||
|
TracepointActions_Collect_Strings_Limit_Label=with optional string size limit (bytes):
|
||||||
|
TracepointActions_Collect_Strings_Limit_Error=Only non-negative integers can be used. Current value will be ignored.
|
||||||
|
|
|
@ -20,10 +20,10 @@ Export-Package: org.eclipse.cdt.dsf.gdb,
|
||||||
org.eclipse.cdt.dsf.gdb.actions,
|
org.eclipse.cdt.dsf.gdb.actions,
|
||||||
org.eclipse.cdt.dsf.gdb.breakpoints,
|
org.eclipse.cdt.dsf.gdb.breakpoints,
|
||||||
org.eclipse.cdt.dsf.gdb.internal;x-friends:="org.eclipse.cdt.dsf.gdb.ui,org.eclipse.cdt.debug.gdbjtag.ui",
|
org.eclipse.cdt.dsf.gdb.internal;x-friends:="org.eclipse.cdt.dsf.gdb.ui,org.eclipse.cdt.debug.gdbjtag.ui",
|
||||||
org.eclipse.cdt.dsf.gdb.internal.commands;x-internal:=true,
|
org.eclipse.cdt.dsf.gdb.internal.commands;x-friends:="org.eclipse.cdt.dsf.gdb.ui",
|
||||||
org.eclipse.cdt.dsf.gdb.internal.memory;x-internal:=true,
|
org.eclipse.cdt.dsf.gdb.internal.memory;x-internal:=true,
|
||||||
org.eclipse.cdt.dsf.gdb.internal.service.command.events;x-internal:=true,
|
org.eclipse.cdt.dsf.gdb.internal.service.command.events;x-internal:=true,
|
||||||
org.eclipse.cdt.dsf.gdb.internal.tracepointactions;x-internal:=true,
|
org.eclipse.cdt.dsf.gdb.internal.tracepointactions;x-friends:="org.eclipse.cdt.dsf.gdb.ui",
|
||||||
org.eclipse.cdt.dsf.gdb.launching,
|
org.eclipse.cdt.dsf.gdb.launching,
|
||||||
org.eclipse.cdt.dsf.gdb.service,
|
org.eclipse.cdt.dsf.gdb.service,
|
||||||
org.eclipse.cdt.dsf.gdb.service.command,
|
org.eclipse.cdt.dsf.gdb.service.command,
|
||||||
|
|
|
@ -159,4 +159,45 @@ public class GdbPlugin extends Plugin {
|
||||||
return traceBuilder.toString();
|
return traceBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience method which returns the unique identifier of this plugin.
|
||||||
|
*/
|
||||||
|
public static String getUniqueIdentifier() {
|
||||||
|
if (getDefault() == null) {
|
||||||
|
// If the default instance is not yet initialized,
|
||||||
|
// return a static identifier. This identifier must
|
||||||
|
// match the plugin id defined in plugin.xml
|
||||||
|
return PLUGIN_ID;
|
||||||
|
}
|
||||||
|
return getDefault().getBundle().getSymbolicName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs the specified status with this plug-in's log.
|
||||||
|
*
|
||||||
|
* @param status
|
||||||
|
* status to log
|
||||||
|
*/
|
||||||
|
public static void log(IStatus status) {
|
||||||
|
getDefault().getLog().log(status);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Logs an internal error with the specified message.
|
||||||
|
*
|
||||||
|
* @param message
|
||||||
|
* the error message to log
|
||||||
|
*/
|
||||||
|
public static void logErrorMessage(String message) {
|
||||||
|
log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, message, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs an internal error with the specified throwable
|
||||||
|
*
|
||||||
|
* @param e
|
||||||
|
* the exception to be logged
|
||||||
|
*/
|
||||||
|
public static void log(Throwable e) {
|
||||||
|
log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e.getMessage(), e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010 Ericsson and others.
|
* Copyright (c) 2010, 2012 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Ericsson - initial API and implementation
|
* Ericsson - initial API and implementation
|
||||||
|
* Marc Khouzam (Ericsson) - Added support for collecting char pointers as strings (bug 373707)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.tracepointactions;
|
package org.eclipse.cdt.dsf.gdb.internal.tracepointactions;
|
||||||
|
|
||||||
|
@ -21,21 +22,43 @@ import javax.xml.transform.TransformerFactory;
|
||||||
import javax.xml.transform.dom.DOMSource;
|
import javax.xml.transform.dom.DOMSource;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.helpers.DefaultHandler;
|
import org.xml.sax.helpers.DefaultHandler;
|
||||||
|
|
||||||
import com.ibm.icu.text.MessageFormat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Action used to tell GDB to collect different values from a tracepoint.
|
||||||
|
* It corresponds to GDB's 'collect' action.
|
||||||
|
*
|
||||||
|
* As for GDB 7.4:
|
||||||
|
* collect[/s] EXPRESSIONS
|
||||||
|
* The tracepoint collect command now takes an optional modifier "/s"
|
||||||
|
* that directs it to dereference pointer-to-character types and
|
||||||
|
* collect the bytes of memory up to a zero byte. The behavior is
|
||||||
|
* similar to what you see when you use the regular print command on a
|
||||||
|
* string. An optional integer following the "/s" sets a bound on the
|
||||||
|
* number of bytes that will be collected.
|
||||||
|
*
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class CollectAction extends AbstractTracepointAction {
|
public class CollectAction extends AbstractTracepointAction {
|
||||||
|
|
||||||
private static final String COLLECT_ACTION_ID = "org.eclipse.cdt.dsf.gdb.tracepointactions.CollectAction"; //$NON-NLS-1$
|
private static final String COLLECT_ACTION_ID = "org.eclipse.cdt.dsf.gdb.tracepointactions.CollectAction"; //$NON-NLS-1$
|
||||||
|
private static final String COLLECT_ACTION_ELEMENT_NAME = "collectData"; //$NON-NLS-1$
|
||||||
|
private static final String COLLECT_STRING_ATTR = "collectString"; //$NON-NLS-1$
|
||||||
|
private static final String COLLECT_AS_STRING_ATTR = "collectAsString"; //$NON-NLS-1$
|
||||||
|
private static final String COLLECT_AS_STRING_LIMIT_ATTR = "collectAsStringLimit"; //$NON-NLS-1$
|
||||||
|
|
||||||
private String fCollectString = ""; //$NON-NLS-1$
|
private String fCollectString = ""; //$NON-NLS-1$
|
||||||
|
/** Indicates if we should ask GDB to collect character pointers as strings */
|
||||||
|
private boolean fCharPtrAsStrings;
|
||||||
|
/**
|
||||||
|
* Optional limit of the size of the string to collect for character pointers.
|
||||||
|
* Null will indicate that no limit is to be used.
|
||||||
|
* This value should be non-negative. */
|
||||||
|
private Integer fCharPtrAsStringsLimit;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDefaultName() {
|
public String getDefaultName() {
|
||||||
|
@ -50,6 +73,45 @@ public class CollectAction extends AbstractTracepointAction {
|
||||||
fCollectString = str;
|
fCollectString = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if this collect action will treat character pointers as strings.
|
||||||
|
* @since 4.1
|
||||||
|
*/
|
||||||
|
public boolean getCharPtrAsStrings() {
|
||||||
|
return fCharPtrAsStrings;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify if this collect action should treat character pointers as strings.
|
||||||
|
* @since 4.1
|
||||||
|
*/
|
||||||
|
public void setCharPtrAsStrings(boolean enable) {
|
||||||
|
fCharPtrAsStrings = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the maximum number of bytes that should be collected
|
||||||
|
* when treating character pointers as strings
|
||||||
|
* @return null if no limit is to be used
|
||||||
|
* @return a non-negative integer indicating the limit
|
||||||
|
*
|
||||||
|
* @since 4.1
|
||||||
|
*/
|
||||||
|
public Integer getCharPtrAsStringsLimit() {
|
||||||
|
return fCharPtrAsStringsLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specify the maximum number of bytes that should be collected when
|
||||||
|
* when treating character pointers as strings.
|
||||||
|
* @param limit A non-negative integer, or null of no limit should be used.
|
||||||
|
*
|
||||||
|
* @since 4.1
|
||||||
|
*/
|
||||||
|
public void setCharPtrAsStringsLimit(Integer limit) {
|
||||||
|
fCharPtrAsStringsLimit = limit;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getIdentifier() {
|
public String getIdentifier() {
|
||||||
return COLLECT_ACTION_ID;
|
return COLLECT_ACTION_ID;
|
||||||
|
@ -65,8 +127,12 @@ public class CollectAction extends AbstractTracepointAction {
|
||||||
docBuilder = dfactory.newDocumentBuilder();
|
docBuilder = dfactory.newDocumentBuilder();
|
||||||
Document doc = docBuilder.newDocument();
|
Document doc = docBuilder.newDocument();
|
||||||
|
|
||||||
Element rootElement = doc.createElement("collectData"); //$NON-NLS-1$
|
Element rootElement = doc.createElement(COLLECT_ACTION_ELEMENT_NAME);
|
||||||
rootElement.setAttribute("collectString", fCollectString); //$NON-NLS-1$
|
|
||||||
|
// Store the different attributes of this collect action
|
||||||
|
rootElement.setAttribute(COLLECT_STRING_ATTR, fCollectString);
|
||||||
|
rootElement.setAttribute(COLLECT_AS_STRING_ATTR, Boolean.toString(fCharPtrAsStrings));
|
||||||
|
rootElement.setAttribute(COLLECT_AS_STRING_LIMIT_ATTR, fCharPtrAsStringsLimit == null ? "" : fCharPtrAsStringsLimit.toString()); //$NON-NLS-1$
|
||||||
|
|
||||||
doc.appendChild(rootElement);
|
doc.appendChild(rootElement);
|
||||||
|
|
||||||
|
@ -84,14 +150,29 @@ public class CollectAction extends AbstractTracepointAction {
|
||||||
collectData = s.toString("UTF8"); //$NON-NLS-1$
|
collectData = s.toString("UTF8"); //$NON-NLS-1$
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
GdbPlugin.log(e);
|
||||||
}
|
}
|
||||||
return collectData;
|
return collectData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSummary() {
|
public String getSummary() {
|
||||||
return MessageFormat.format(MessagesForTracepointActions.TracepointActions_Collect_text, new Object[] { fCollectString });
|
// Return the exact format that will be sent to GDB.
|
||||||
|
|
||||||
|
StringBuffer collectCmd = new StringBuffer("collect "); //$NON-NLS-1$
|
||||||
|
if (fCharPtrAsStrings) {
|
||||||
|
collectCmd.append("/s"); //$NON-NLS-1$
|
||||||
|
if (fCharPtrAsStringsLimit != null) {
|
||||||
|
// No space between /s and the limit
|
||||||
|
collectCmd.append(fCharPtrAsStringsLimit.toString());
|
||||||
|
}
|
||||||
|
// Now add the space before we append what to collect.
|
||||||
|
collectCmd.append(" "); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
// Finally, actually add what to collect
|
||||||
|
collectCmd.append(fCollectString);
|
||||||
|
|
||||||
|
return collectCmd.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -107,16 +188,33 @@ public class CollectAction extends AbstractTracepointAction {
|
||||||
parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
parser.setErrorHandler(new DefaultHandler());
|
parser.setErrorHandler(new DefaultHandler());
|
||||||
root = parser.parse(new InputSource(new StringReader(data))).getDocumentElement();
|
root = parser.parse(new InputSource(new StringReader(data))).getDocumentElement();
|
||||||
fCollectString = root.getAttribute("collectString"); //$NON-NLS-1$
|
|
||||||
if (fCollectString == null)
|
fCollectString = root.getAttribute(COLLECT_STRING_ATTR);
|
||||||
throw new Exception();
|
if (fCollectString == null) fCollectString = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
|
String asStrings = root.getAttribute(COLLECT_AS_STRING_ATTR);
|
||||||
|
if (asStrings != null) {
|
||||||
|
fCharPtrAsStrings = Boolean.valueOf(asStrings);
|
||||||
|
} else {
|
||||||
|
fCharPtrAsStrings = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fCharPtrAsStringsLimit = null;
|
||||||
|
String asStringsLimit = root.getAttribute(COLLECT_AS_STRING_LIMIT_ATTR);
|
||||||
|
if (asStringsLimit != null) {
|
||||||
|
try {
|
||||||
|
fCharPtrAsStringsLimit = Integer.valueOf(asStringsLimit);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// leave as null to disable
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
GdbPlugin.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return MessageFormat.format(MessagesForTracepointActions.TracepointActions_Collect_text, new Object[] { fCollectString });
|
return getSummary();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010 Ericsson and others.
|
* Copyright (c) 2010, 2012 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Ericsson - initial API and implementation
|
* Ericsson - initial API and implementation
|
||||||
|
* Marc Khouzam (Ericsson) - Don't use translatable strings for the command summary
|
||||||
|
* since it will be send directly to GDB
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.tracepointactions;
|
package org.eclipse.cdt.dsf.gdb.internal.tracepointactions;
|
||||||
|
|
||||||
|
@ -21,13 +23,12 @@ import javax.xml.transform.TransformerFactory;
|
||||||
import javax.xml.transform.dom.DOMSource;
|
import javax.xml.transform.dom.DOMSource;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.helpers.DefaultHandler;
|
import org.xml.sax.helpers.DefaultHandler;
|
||||||
|
|
||||||
import com.ibm.icu.text.MessageFormat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
|
@ -83,14 +84,15 @@ public class EvaluateAction extends AbstractTracepointAction {
|
||||||
collectData = s.toString("UTF8"); //$NON-NLS-1$
|
collectData = s.toString("UTF8"); //$NON-NLS-1$
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
GdbPlugin.log(e);
|
||||||
}
|
}
|
||||||
return collectData;
|
return collectData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSummary() {
|
public String getSummary() {
|
||||||
return MessageFormat.format(MessagesForTracepointActions.TracepointActions_Evaluate_text, new Object[] { fEvalString });
|
// Create command to be sent to GDB
|
||||||
|
return String.format("teval %s", fEvalString); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -110,12 +112,12 @@ public class EvaluateAction extends AbstractTracepointAction {
|
||||||
if (fEvalString == null)
|
if (fEvalString == null)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
GdbPlugin.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return MessageFormat.format(MessagesForTracepointActions.TracepointActions_Evaluate_text, new Object[] { fEvalString });
|
return getSummary();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010 Ericsson and others.
|
* Copyright (c) 2010, 2012 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Ericsson - initial API and implementation
|
* Ericsson - initial API and implementation
|
||||||
|
* Marc Khouzam (Ericsson) - Remove strings that should not be translated
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.tracepointactions;
|
package org.eclipse.cdt.dsf.gdb.internal.tracepointactions;
|
||||||
|
|
||||||
|
@ -25,9 +26,6 @@ class MessagesForTracepointActions extends NLS {
|
||||||
public static String TracepointActions_Collect_Name;
|
public static String TracepointActions_Collect_Name;
|
||||||
public static String TracepointActions_Evaluate_Name;
|
public static String TracepointActions_Evaluate_Name;
|
||||||
public static String TracepointActions_WhileStepping_Name;
|
public static String TracepointActions_WhileStepping_Name;
|
||||||
public static String TracepointActions_Collect_text;
|
|
||||||
public static String TracepointActions_Evaluate_text;
|
|
||||||
public static String TracepointActions_WhileStepping_text;
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// initialize resource bundle
|
// initialize resource bundle
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010 Ericsson and others.
|
* Copyright (c) 2010, 2012 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Ericsson - initial API and implementation
|
* Ericsson - initial API and implementation
|
||||||
|
* Marc Khouzam (Ericsson) - Don't use translatable strings for the command summary
|
||||||
|
* since it will be send directly to GDB
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.tracepointactions;
|
package org.eclipse.cdt.dsf.gdb.internal.tracepointactions;
|
||||||
|
|
||||||
|
@ -21,13 +23,12 @@ import javax.xml.transform.TransformerFactory;
|
||||||
import javax.xml.transform.dom.DOMSource;
|
import javax.xml.transform.dom.DOMSource;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.helpers.DefaultHandler;
|
import org.xml.sax.helpers.DefaultHandler;
|
||||||
|
|
||||||
import com.ibm.icu.text.MessageFormat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
|
@ -120,14 +121,15 @@ public class WhileSteppingAction extends AbstractTracepointAction {
|
||||||
collectData = s.toString("UTF8"); //$NON-NLS-1$
|
collectData = s.toString("UTF8"); //$NON-NLS-1$
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
GdbPlugin.log(e);
|
||||||
}
|
}
|
||||||
return collectData;
|
return collectData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSummary() {
|
public String getSummary() {
|
||||||
return MessageFormat.format(MessagesForTracepointActions.TracepointActions_WhileStepping_text, new Object[] { fStepCount, fSubActionContent });
|
// Create command to be sent to GDB
|
||||||
|
return String.format("while-stepping %s %s", fStepCount, fSubActionContent); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -149,12 +151,12 @@ public class WhileSteppingAction extends AbstractTracepointAction {
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
setSubActionsContent(fSubActionNames);
|
setSubActionsContent(fSubActionNames);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
GdbPlugin.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return MessageFormat.format(MessagesForTracepointActions.TracepointActions_WhileStepping_text, new Object[] { fStepCount, fSubActionContent });
|
return getSummary();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Copyright (c) 2010 Ericsson and others.
|
# Copyright (c) 2010, 2012 Ericsson and others.
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
# which accompanies this distribution, and is available at
|
# which accompanies this distribution, and is available at
|
||||||
|
@ -16,8 +16,3 @@ TracepointActions_Untitled_WhileStepping=Untitled While-Stepping Action
|
||||||
TracepointActions_Collect_Name=Collect Action
|
TracepointActions_Collect_Name=Collect Action
|
||||||
TracepointActions_Evaluate_Name=Evaluate Action
|
TracepointActions_Evaluate_Name=Evaluate Action
|
||||||
TracepointActions_WhileStepping_Name=While-Stepping Action
|
TracepointActions_WhileStepping_Name=While-Stepping Action
|
||||||
# START NON-TRANSLATABLE
|
|
||||||
TracepointActions_Collect_text=collect {0}
|
|
||||||
TracepointActions_Evaluate_text=teval {0}
|
|
||||||
TracepointActions_WhileStepping_text=while-stepping {0} {1}
|
|
||||||
# END NON-TRANSLATABLE
|
|
||||||
|
|
|
@ -9,14 +9,18 @@
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
* Ericsson AB - Modified for handling of multiple threads
|
* Ericsson AB - Modified for handling of multiple threads
|
||||||
* Indel AG - [369622] fixed moveToLine using MinGW
|
* Indel AG - [369622] fixed moveToLine using MinGW
|
||||||
|
* Marc Khouzam (Ericsson) - Support for operations on multiple execution contexts (bug 330974)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.dsf.gdb.service;
|
package org.eclipse.cdt.dsf.gdb.service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -42,6 +46,7 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IBreakpointsExtension.IBreakpointHitDMEvent;
|
import org.eclipse.cdt.dsf.debug.service.IBreakpointsExtension.IBreakpointHitDMEvent;
|
||||||
import org.eclipse.cdt.dsf.debug.service.ICachingService;
|
import org.eclipse.cdt.dsf.debug.service.ICachingService;
|
||||||
|
import org.eclipse.cdt.dsf.debug.service.IMultiRunControl;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
||||||
|
@ -104,7 +109,7 @@ import org.osgi.framework.BundleContext;
|
||||||
* sync with the service state.
|
* sync with the service state.
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunControl, ICachingService
|
public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunControl, IMultiRunControl, ICachingService
|
||||||
{
|
{
|
||||||
@Immutable
|
@Immutable
|
||||||
private static class ExecutionData implements IExecutionDMData2 {
|
private static class ExecutionData implements IExecutionDMData2 {
|
||||||
|
@ -396,7 +401,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
|
||||||
private void doInitialize(final RequestMonitor rm) {
|
private void doInitialize(final RequestMonitor rm) {
|
||||||
register(new String[]{ IRunControl.class.getName(),
|
register(new String[]{ IRunControl.class.getName(),
|
||||||
IRunControl2.class.getName(),
|
IRunControl2.class.getName(),
|
||||||
IMIRunControl.class.getName()},
|
IMIRunControl.class.getName(),
|
||||||
|
IMultiRunControl.class.getName() },
|
||||||
new Hashtable<String,String>());
|
new Hashtable<String,String>());
|
||||||
fConnection = getServicesTracker().getService(ICommandControlService.class);
|
fConnection = getServicesTracker().getService(ICommandControlService.class);
|
||||||
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
|
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
|
||||||
|
@ -1878,4 +1884,293 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// IMultiRunControl implementation
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Although multi-process in only supported for GDB >= 7.2, it is simpler
|
||||||
|
// to code for the multi-process case all the time, since it is a superset
|
||||||
|
// of the single-process case.
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// Multi-resume implementation:
|
||||||
|
//
|
||||||
|
// If one or more more threads of one or many processes are selected, we want to
|
||||||
|
// resume each thread (once).
|
||||||
|
//
|
||||||
|
// If one or more more processes are selected, we want to resume each process (once).
|
||||||
|
//
|
||||||
|
// If a process is selected along with one or more threads of that same process,
|
||||||
|
// what does the user want us to do? Selecting the process will resume all its
|
||||||
|
// threads, but what do we do with the selected threads? Why are they
|
||||||
|
// selected? In an attempt to be user friendly, lets assume that the user
|
||||||
|
// wants to resume the entire process, so we ignore the selected threads part of that
|
||||||
|
// process since they will be resumed anyway.
|
||||||
|
//
|
||||||
|
// The same logic applies to multi-suspend.
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/** @since 4.1 */
|
||||||
|
@Override
|
||||||
|
public void canResumeSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
|
||||||
|
assert contexts != null;
|
||||||
|
|
||||||
|
if (fRunControlOperationsEnabled == false) {
|
||||||
|
rm.done(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IExecutionDMContext> execDmcToResumeList = extractContextsForOperation(contexts);
|
||||||
|
|
||||||
|
// If any of the threads or processes can be resumed, we allow
|
||||||
|
// the user to perform the operation.
|
||||||
|
for (IExecutionDMContext execDmc : execDmcToResumeList) {
|
||||||
|
if (doCanResume(execDmc)) {
|
||||||
|
rm.done(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Didn't find anything that could be resumed.
|
||||||
|
rm.done(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since 4.1 */
|
||||||
|
@Override
|
||||||
|
public void canResumeAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
|
||||||
|
assert contexts != null;
|
||||||
|
|
||||||
|
if (fRunControlOperationsEnabled == false) {
|
||||||
|
rm.done(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IExecutionDMContext> execDmcToResumeList = extractContextsForOperation(contexts);
|
||||||
|
|
||||||
|
// If any of the threads or processes cannot be resumed, we don't allow
|
||||||
|
// the user to perform the operation.
|
||||||
|
for (IExecutionDMContext execDmc : execDmcToResumeList) {
|
||||||
|
if (!doCanResume(execDmc)) {
|
||||||
|
rm.done(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Everything can be resumed
|
||||||
|
rm.done(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*
|
||||||
|
* For GDB, a separate resume command will be sent, one for each context
|
||||||
|
* that can be resumed.
|
||||||
|
* @since 4.1
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void resume(IExecutionDMContext[] contexts, RequestMonitor rm) {
|
||||||
|
assert contexts != null;
|
||||||
|
|
||||||
|
List<IExecutionDMContext> execDmcToResumeList = extractContextsForOperation(contexts);
|
||||||
|
|
||||||
|
CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
// Perform resume operation on each thread or process that can be resumed
|
||||||
|
for (IExecutionDMContext execDmc : execDmcToResumeList) {
|
||||||
|
if (doCanResume(execDmc)) {
|
||||||
|
count++;
|
||||||
|
resume(execDmc, crm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
crm.setDoneCount(count);
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// Multi-suspend implementation:
|
||||||
|
// see details of the multi-resume implementation above.
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/** @since 4.1 */
|
||||||
|
@Override
|
||||||
|
public void canSuspendSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
|
||||||
|
assert contexts != null;
|
||||||
|
|
||||||
|
if (fRunControlOperationsEnabled == false) {
|
||||||
|
rm.done(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IExecutionDMContext> execDmcToSuspendList = extractContextsForOperation(contexts);
|
||||||
|
|
||||||
|
// If any of the threads or processes can be suspended, we allow
|
||||||
|
// the user to perform the operation.
|
||||||
|
for (IExecutionDMContext execDmc : execDmcToSuspendList) {
|
||||||
|
if (doCanSuspend(execDmc)) {
|
||||||
|
rm.done(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Didn't find anything that could be suspended.
|
||||||
|
rm.done(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since 4.1 */
|
||||||
|
@Override
|
||||||
|
public void canSuspendAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
|
||||||
|
assert contexts != null;
|
||||||
|
|
||||||
|
if (fRunControlOperationsEnabled == false) {
|
||||||
|
rm.done(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IExecutionDMContext> execDmcToSuspendList = extractContextsForOperation(contexts);
|
||||||
|
|
||||||
|
// If any of the threads or processes cannot be suspended, we don't allow
|
||||||
|
// the user to perform the operation.
|
||||||
|
for (IExecutionDMContext execDmc : execDmcToSuspendList) {
|
||||||
|
if (!doCanSuspend(execDmc)) {
|
||||||
|
rm.done(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Everything can be suspended
|
||||||
|
rm.done(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since 4.1 */
|
||||||
|
@Override
|
||||||
|
public void isSuspendedSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
|
||||||
|
assert contexts != null;
|
||||||
|
|
||||||
|
List<IExecutionDMContext> execDmcSuspendedList = extractContextsForOperation(contexts);
|
||||||
|
|
||||||
|
// Look for any thread or process that is suspended
|
||||||
|
for (IExecutionDMContext execDmc : execDmcSuspendedList) {
|
||||||
|
if (isSuspended(execDmc)) {
|
||||||
|
rm.done(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Didn't find anything that was suspended.
|
||||||
|
rm.done(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since 4.1 */
|
||||||
|
@Override
|
||||||
|
public void isSuspendedAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
|
||||||
|
assert contexts != null;
|
||||||
|
|
||||||
|
List<IExecutionDMContext> execDmcSuspendedList = extractContextsForOperation(contexts);
|
||||||
|
|
||||||
|
// Look for any thread or process that is not suspended
|
||||||
|
for (IExecutionDMContext execDmc : execDmcSuspendedList) {
|
||||||
|
if (!isSuspended(execDmc)) {
|
||||||
|
rm.done(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Everything is suspended.
|
||||||
|
rm.done(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*
|
||||||
|
* For GDB, a separate suspend command will be sent, one for each context
|
||||||
|
* that can be suspended.
|
||||||
|
* @since 4.1
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void suspend(IExecutionDMContext[] contexts, RequestMonitor rm) {
|
||||||
|
assert contexts != null;
|
||||||
|
|
||||||
|
List<IExecutionDMContext> execDmcToSuspendList = extractContextsForOperation(contexts);
|
||||||
|
|
||||||
|
CountingRequestMonitor crm = new CountingRequestMonitor(getExecutor(), rm);
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
// Perform resume operation on each thread or process that can be resumed
|
||||||
|
for (IExecutionDMContext execDmc : execDmcToSuspendList) {
|
||||||
|
if (doCanSuspend(execDmc)) {
|
||||||
|
count++;
|
||||||
|
suspend(execDmc, crm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
crm.setDoneCount(count);
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// Multi-step implementation. Not implemented yet. See bug 330974.
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/** @since 4.1 */
|
||||||
|
@Override
|
||||||
|
public void canStepSome(IExecutionDMContext[] contexts, StepType stepType, DataRequestMonitor<Boolean> rm) {
|
||||||
|
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since 4.1 */
|
||||||
|
@Override
|
||||||
|
public void canStepAll(IExecutionDMContext[] contexts, StepType stepType, DataRequestMonitor<Boolean> rm) {
|
||||||
|
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since 4.1 */
|
||||||
|
@Override
|
||||||
|
public void isSteppingSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
|
||||||
|
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since 4.1 */
|
||||||
|
@Override
|
||||||
|
public void isSteppingAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
|
||||||
|
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since 4.1 */
|
||||||
|
@Override
|
||||||
|
public void step(IExecutionDMContext[] contexts, StepType stepType, RequestMonitor rm) {
|
||||||
|
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not implemented.", null)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes duplicates from the list of execution contexts, in case the same thread
|
||||||
|
* or process is present more than once.
|
||||||
|
*
|
||||||
|
* Also, remove any thread that is part of a process that is also present. This is
|
||||||
|
* because an operation on the process will affect all its threads anyway.
|
||||||
|
*/
|
||||||
|
private List<IExecutionDMContext> extractContextsForOperation(IExecutionDMContext[] contexts) {
|
||||||
|
// Remove duplicate contexts by using a set
|
||||||
|
Set<IExecutionDMContext> specifiedExedDmcSet = new HashSet<IExecutionDMContext>(Arrays.asList(contexts));
|
||||||
|
|
||||||
|
// A list that ignores threads for which the process is also present
|
||||||
|
List<IExecutionDMContext> execDmcForOperationList = new ArrayList<IExecutionDMContext>(specifiedExedDmcSet.size());
|
||||||
|
|
||||||
|
// Check for the case of a process selected along with some of its threads
|
||||||
|
for (IExecutionDMContext execDmc : specifiedExedDmcSet) {
|
||||||
|
if (execDmc instanceof IContainerDMContext) {
|
||||||
|
// This is a process: it is automatically part of our list
|
||||||
|
execDmcForOperationList.add(execDmc);
|
||||||
|
} else {
|
||||||
|
// Get the process for this thread
|
||||||
|
IContainerDMContext containerDmc = DMContexts.getAncestorOfType(execDmc, IContainerDMContext.class);
|
||||||
|
// Check if that process is also present
|
||||||
|
if (specifiedExedDmcSet.contains(containerDmc) == false) {
|
||||||
|
// This thread does not belong to a process that is selected, so we keep it.
|
||||||
|
execDmcForOperationList.add(execDmc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return execDmcForOperationList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2011 Ericsson and others.
|
* Copyright (c) 2011, 2012 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
|
import org.eclipse.cdt.dsf.debug.service.IMultiRunControl;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl2;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl2;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
|
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
|
||||||
|
@ -72,6 +73,7 @@ public class GDBRunControl_7_2_NS extends GDBRunControl_7_0_NS
|
||||||
register(new String[]{ IRunControl.class.getName(),
|
register(new String[]{ IRunControl.class.getName(),
|
||||||
IRunControl2.class.getName(),
|
IRunControl2.class.getName(),
|
||||||
IMIRunControl.class.getName(),
|
IMIRunControl.class.getName(),
|
||||||
|
IMultiRunControl.class.getName(),
|
||||||
GDBRunControl_7_0_NS.class.getName(),
|
GDBRunControl_7_0_NS.class.getName(),
|
||||||
GDBRunControl_7_2_NS.class.getName(),
|
GDBRunControl_7_2_NS.class.getName(),
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#include <process.h> // MinGW has no POSIX support; use MSVC runtime
|
||||||
|
#else
|
||||||
|
#include <pthread.h>
|
||||||
|
#endif
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "Sleep.h"
|
||||||
|
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
typedef unsigned int TID;
|
||||||
|
#else
|
||||||
|
typedef pthread_t TID;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Set a breakpoint here so that both threads stop.
|
||||||
|
void firstBreakpoint(int id)
|
||||||
|
{
|
||||||
|
printf("First breakpoint method from thread %d\n", id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
unsigned int __stdcall PrintHello(void *threadid)
|
||||||
|
#else
|
||||||
|
void *PrintHello(void *threadId)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int tId = (int)threadId;
|
||||||
|
firstBreakpoint(tId); // Stop a first time
|
||||||
|
|
||||||
|
SLEEP(1); // Keep state running a little
|
||||||
|
|
||||||
|
firstBreakpoint(tId); // Stop a second time
|
||||||
|
|
||||||
|
SLEEP(3); // Resuming past this will give us a running thread
|
||||||
|
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
pthread_exit(NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
TID thread;
|
||||||
|
int tId = 1; // Break at main will stop here: we have a single thread stopped
|
||||||
|
|
||||||
|
SLEEP(1); // When resuming past here, we have a single thread running
|
||||||
|
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
uintptr_t rc = _beginthreadex(NULL, 0, PrintHello, (void*)tId, 0, &thread);
|
||||||
|
if (rc == 0)
|
||||||
|
{
|
||||||
|
printf("ERROR; _beginthreadex() failed. errno = %d\n", errno);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
int rc = pthread_create(&thread, NULL, PrintHello, (void *)tId);
|
||||||
|
if (rc)
|
||||||
|
{
|
||||||
|
printf("ERROR; return code from pthread_create() is %d\n", rc);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
firstBreakpoint(0);
|
||||||
|
|
||||||
|
SLEEP(1); // Resuming past this will make this thread run, while we stop the second thread
|
||||||
|
|
||||||
|
SLEEP(3); // Resuming past this will make this thread run, while we also run the second thread
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 Ericsson and others.
|
* Copyright (c) 2007, 2012 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,9 +7,13 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Ericsson - Initial Implementation
|
* Ericsson - Initial Implementation
|
||||||
|
* Marc Khouzam (Ericsson) - Add support to receive multiple events
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.tests.dsf.gdb.framework;
|
package org.eclipse.cdt.tests.dsf.gdb.framework;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
|
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
|
||||||
|
@ -17,7 +21,7 @@ import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
|
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* This class provides a way to wait for an asynchronous ServerEvent
|
* This class provides a way to wait for an asynchronous ServerEvent
|
||||||
* to occur. The user of this class specifies which event is of
|
* to occur. The user of this class specifies which event is of
|
||||||
* interest . waitForEvent() can then be called to block until the event occurs or
|
* interest . waitForEvent() can then be called to block until the event occurs or
|
||||||
|
@ -40,7 +44,9 @@ public class ServiceEventWaitor<V> {
|
||||||
/* The type of event to wait for */
|
/* The type of event to wait for */
|
||||||
private Class<V> fEventTypeClass;
|
private Class<V> fEventTypeClass;
|
||||||
private DsfSession fSession;
|
private DsfSession fSession;
|
||||||
private V fEvent;
|
|
||||||
|
// Queue of events. This allows to receive multiple events and keep them.
|
||||||
|
private List<V> fEventQueue = Collections.synchronizedList(new LinkedList<V>());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trace option for wait metrics
|
* Trace option for wait metrics
|
||||||
|
@ -59,7 +65,6 @@ public class ServiceEventWaitor<V> {
|
||||||
assert eventClass != null;
|
assert eventClass != null;
|
||||||
fSession = session;
|
fSession = session;
|
||||||
fEventTypeClass = eventClass;
|
fEventTypeClass = eventClass;
|
||||||
fEvent = null;
|
|
||||||
Runnable runnable = new Runnable() {
|
Runnable runnable = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -102,10 +107,9 @@ public class ServiceEventWaitor<V> {
|
||||||
|
|
||||||
long startMs = System.currentTimeMillis();
|
long startMs = System.currentTimeMillis();
|
||||||
|
|
||||||
// The event might have already been received
|
if (fEventQueue.isEmpty()) {
|
||||||
if (fEvent == null) {
|
|
||||||
wait(timeout);
|
wait(timeout);
|
||||||
if (fEvent == null) {
|
if (fEventQueue.isEmpty()) {
|
||||||
throw new Exception("Timed out waiting for ServiceEvent: " + fEventTypeClass.getName());
|
throw new Exception("Timed out waiting for ServiceEvent: " + fEventTypeClass.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,14 +163,7 @@ public class ServiceEventWaitor<V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark that we have consumed the event.
|
return fEventQueue.remove(0);
|
||||||
// This will allow to wait for the next similar event.
|
|
||||||
// For example, for a restart, there could be more than one
|
|
||||||
// stopped event, and we need to wait for the second one.
|
|
||||||
V event = fEvent;
|
|
||||||
fEvent = null;
|
|
||||||
|
|
||||||
return event;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -177,7 +174,7 @@ public class ServiceEventWaitor<V> {
|
||||||
public void eventDispatched(V event) {
|
public void eventDispatched(V event) {
|
||||||
if (fEventTypeClass.isAssignableFrom(event.getClass())) {
|
if (fEventTypeClass.isAssignableFrom(event.getClass())) {
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
fEvent = event;
|
fEventQueue.add(event);
|
||||||
notifyAll();
|
notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,17 +593,17 @@ public class SyncUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method to return the execution DM context.
|
* Utility method to return all thread execution contexts.
|
||||||
*/
|
*/
|
||||||
@ThreadSafeAndProhibitedFromDsfExecutor("fSession.getExecutor()")
|
@ThreadSafeAndProhibitedFromDsfExecutor("fSession.getExecutor()")
|
||||||
public static IMIExecutionDMContext getExecutionContext(final int threadIndex) throws InterruptedException {
|
public static IMIExecutionDMContext[] getExecutionContexts() throws InterruptedException {
|
||||||
assert !fProcessesService.getExecutor().isInExecutorThread();
|
assert !fProcessesService.getExecutor().isInExecutorThread();
|
||||||
|
|
||||||
final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
|
final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
|
||||||
|
|
||||||
Query<IMIExecutionDMContext> query = new Query<IMIExecutionDMContext>() {
|
Query<IMIExecutionDMContext[]> query = new Query<IMIExecutionDMContext[]>() {
|
||||||
@Override
|
@Override
|
||||||
protected void execute(final DataRequestMonitor<IMIExecutionDMContext> rm) {
|
protected void execute(final DataRequestMonitor<IMIExecutionDMContext[]> rm) {
|
||||||
fProcessesService.getProcessesBeingDebugged(
|
fProcessesService.getProcessesBeingDebugged(
|
||||||
containerDmc,
|
containerDmc,
|
||||||
new ImmediateDataRequestMonitor<IDMContext[]>() {
|
new ImmediateDataRequestMonitor<IDMContext[]>() {
|
||||||
|
@ -612,10 +612,7 @@ public class SyncUtil {
|
||||||
if (isSuccess()) {
|
if (isSuccess()) {
|
||||||
IDMContext[] threads = getData();
|
IDMContext[] threads = getData();
|
||||||
Assert.assertNotNull("invalid return value from service", threads);
|
Assert.assertNotNull("invalid return value from service", threads);
|
||||||
Assert.assertTrue("unexpected number of threads", threadIndex < threads.length);
|
rm.setData((IMIExecutionDMContext[])threads);
|
||||||
IDMContext thread = threads[threadIndex];
|
|
||||||
Assert.assertNotNull("unexpected thread context type ", thread);
|
|
||||||
rm.setData((IMIExecutionDMContext)thread);
|
|
||||||
} else {
|
} else {
|
||||||
rm.setStatus(getStatus());
|
rm.setStatus(getStatus());
|
||||||
}
|
}
|
||||||
|
@ -633,6 +630,16 @@ public class SyncUtil {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Utility method to return a specific execution DM context.
|
||||||
|
*/
|
||||||
|
@ThreadSafeAndProhibitedFromDsfExecutor("fSession.getExecutor()")
|
||||||
|
public static IMIExecutionDMContext getExecutionContext(int threadIndex) throws InterruptedException {
|
||||||
|
IMIExecutionDMContext[] threads = getExecutionContexts();
|
||||||
|
Assert.assertTrue("unexpected number of threads", threadIndex < threads.length);
|
||||||
|
Assert.assertNotNull("unexpected thread context type ", threads[threadIndex]);
|
||||||
|
return threads[threadIndex];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the restart operation is supported
|
* Check if the restart operation is supported
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -68,33 +68,33 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
||||||
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_THEN_NORMAL);
|
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_THEN_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DsfSession fSession;
|
protected DsfSession fSession;
|
||||||
private DsfServicesTracker fServicesTracker;
|
protected DsfServicesTracker fServicesTracker;
|
||||||
private IBreakpoints fBreakpointService;
|
protected IBreakpoints fBreakpointService;
|
||||||
// private ITraceControl fTraceService;
|
// private ITraceControl fTraceService;
|
||||||
private IBreakpointsTargetDMContext fBreakpointsDmc;
|
protected IBreakpointsTargetDMContext fBreakpointsDmc;
|
||||||
// private ITraceTargetDMContext fTraceTargetDmc;
|
// private ITraceTargetDMContext fTraceTargetDmc;
|
||||||
|
|
||||||
// private int fTotalTracingBufferSize = 0;
|
// private int fTotalTracingBufferSize = 0;
|
||||||
|
|
||||||
private static final String SOURCE_FILE = "TracepointTestApp.cc";
|
protected static final String SOURCE_FILE = "TracepointTestApp.cc";
|
||||||
private static final String METHOD_NAME = "testTracepoints";
|
protected static final String METHOD_NAME = "testTracepoints";
|
||||||
private static final int LINE_NUMBER_1 = 97;
|
protected static final int LINE_NUMBER_1 = 97;
|
||||||
private static final int LINE_NUMBER_2 = 75;
|
protected static final int LINE_NUMBER_2 = 75;
|
||||||
private static final int LINE_NUMBER_3 = 76;
|
protected static final int LINE_NUMBER_3 = 76;
|
||||||
private static final int LINE_NUMBER_4 = 85;
|
protected static final int LINE_NUMBER_4 = 85;
|
||||||
private static final int LINE_LOOP_2 = 109;
|
protected static final int LINE_LOOP_2 = 109;
|
||||||
private static final String NO_CONDITION = "";
|
protected static final String NO_CONDITION = "";
|
||||||
private static final String NO_COMMANDS = "";
|
protected static final String NO_COMMANDS = "";
|
||||||
// private static final int LAST_LINE_NUMBER = 94;
|
// private static final int LAST_LINE_NUMBER = 94;
|
||||||
//
|
//
|
||||||
// private static final int TOTAL_FRAMES_TO_BE_COLLECTED = 1 + 1 + 10 + 1 + 10000;
|
// private static final int TOTAL_FRAMES_TO_BE_COLLECTED = 1 + 1 + 10 + 1 + 10000;
|
||||||
|
|
||||||
private final static int[] PASS_COUNTS = {12, 2, 32, 6, 128, 0, 0, 0, 0, 0, 0, 0};
|
protected final static int[] PASS_COUNTS = {12, 2, 32, 6, 128, 0, 0, 0, 0, 0, 0, 0};
|
||||||
private final static String[] CONDITIONS = {"gIntVar == 543", "gBoolVar == false", "counter == 3", "counter > 4", "counter > 2 && lIntVar == 12345"};
|
protected final static String[] CONDITIONS = {"gIntVar == 543", "gBoolVar == false", "counter == 3", "counter > 4", "counter > 2 && lIntVar == 12345"};
|
||||||
|
|
||||||
private static CollectAction[] COLLECT_ACTIONS = new CollectAction[10];
|
protected static CollectAction[] COLLECT_ACTIONS = new CollectAction[10];
|
||||||
private static EvaluateAction[] EVAL_ACTIONS = new EvaluateAction[10];
|
protected static EvaluateAction[] EVAL_ACTIONS = new EvaluateAction[10];
|
||||||
// private static WhileSteppingAction[] STEPPING_ACTION_1 = new WhileSteppingAction[3];
|
// private static WhileSteppingAction[] STEPPING_ACTION_1 = new WhileSteppingAction[3];
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -248,7 +248,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clears the counters
|
// Clears the counters
|
||||||
private void clearEventCounters() {
|
protected void clearEventCounters() {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
for (int i = 0; i < fBreakpointEvents.length; i++) {
|
for (int i = 0; i < fBreakpointEvents.length; i++) {
|
||||||
fBreakpointEvents[i] = 0;
|
fBreakpointEvents[i] = 0;
|
||||||
|
@ -259,7 +259,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the breakpoint hit count
|
// Get the breakpoint hit count
|
||||||
private int getBreakpointEventCount(int event) {
|
protected int getBreakpointEventCount(int event) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
count = fBreakpointEvents[event];
|
count = fBreakpointEvents[event];
|
||||||
|
@ -269,7 +269,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
||||||
|
|
||||||
// Suspends the thread until an event is flagged
|
// Suspends the thread until an event is flagged
|
||||||
// NOTE: too simple for real life but good enough for this test suite
|
// NOTE: too simple for real life but good enough for this test suite
|
||||||
private void waitForBreakpointEvent() {
|
protected void waitForBreakpointEvent() {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
while (!fBreakpointEvent) {
|
while (!fBreakpointEvent) {
|
||||||
try {
|
try {
|
||||||
|
@ -291,7 +291,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
||||||
// Breakpoint service methods (to use with tracepoints).
|
// Breakpoint service methods (to use with tracepoints).
|
||||||
// *********************************************************************
|
// *********************************************************************
|
||||||
|
|
||||||
private IBreakpointDMContext insertBreakpoint(final IBreakpointsTargetDMContext context,
|
protected IBreakpointDMContext insertBreakpoint(final IBreakpointsTargetDMContext context,
|
||||||
final Map<String,Object> attributes) throws InterruptedException
|
final Map<String,Object> attributes) throws InterruptedException
|
||||||
{
|
{
|
||||||
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
||||||
|
@ -317,7 +317,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
||||||
return (IBreakpointDMContext)wait.getReturnInfo();
|
return (IBreakpointDMContext)wait.getReturnInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException
|
protected void removeBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException
|
||||||
{
|
{
|
||||||
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
||||||
assertTrue(wait.getMessage(), wait.isOK());
|
assertTrue(wait.getMessage(), wait.isOK());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBreakpoint(final IBreakpointDMContext breakpoint,
|
protected void updateBreakpoint(final IBreakpointDMContext breakpoint,
|
||||||
final Map<String, Object> delta) throws InterruptedException
|
final Map<String, Object> delta) throws InterruptedException
|
||||||
{
|
{
|
||||||
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
||||||
|
@ -360,7 +360,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
||||||
assertTrue(wait.getMessage(), wait.isOK());
|
assertTrue(wait.getMessage(), wait.isOK());
|
||||||
}
|
}
|
||||||
|
|
||||||
private IBreakpointDMData getBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException
|
protected IBreakpointDMData getBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException
|
||||||
{
|
{
|
||||||
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
||||||
return (IBreakpointDMData)wait.getReturnInfo();
|
return (IBreakpointDMData)wait.getReturnInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private IBreakpointDMContext[] getBreakpoints(final IBreakpointsTargetDMContext context) throws InterruptedException
|
protected IBreakpointDMContext[] getBreakpoints(final IBreakpointsTargetDMContext context) throws InterruptedException
|
||||||
{
|
{
|
||||||
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
||||||
// Below are the tests for the control of tracepoints.
|
// Below are the tests for the control of tracepoints.
|
||||||
// *********************************************************************
|
// *********************************************************************
|
||||||
|
|
||||||
private IBreakpointDMContext[] fTracepoints = null;
|
protected IBreakpointDMContext[] fTracepoints = null;
|
||||||
|
|
||||||
// private void checkTraceStatus(boolean supported, boolean active, int frames,
|
// private void checkTraceStatus(boolean supported, boolean active, int frames,
|
||||||
// STOP_REASON_ENUM reason, Integer stoppingTracepoint) throws Throwable {
|
// STOP_REASON_ENUM reason, Integer stoppingTracepoint) throws Throwable {
|
||||||
|
@ -592,7 +592,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
||||||
// GDB 7.0 does not support fast tracepoints, but GDB 7.2 will
|
// GDB 7.0 does not support fast tracepoints, but GDB 7.2 will
|
||||||
protected boolean fastTracepointsSupported() { return false; }
|
protected boolean fastTracepointsSupported() { return false; }
|
||||||
|
|
||||||
private class TracepointData {
|
protected class TracepointData {
|
||||||
String sourceFile;
|
String sourceFile;
|
||||||
int lineNumber;
|
int lineNumber;
|
||||||
String condition;
|
String condition;
|
||||||
|
@ -616,7 +616,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkTracepoints(TracepointData[] dataArray) throws Throwable {
|
protected void checkTracepoints(TracepointData[] dataArray) throws Throwable {
|
||||||
int numTracepoints = dataArray.length;
|
int numTracepoints = dataArray.length;
|
||||||
|
|
||||||
// Fetch the tp list from the backend
|
// Fetch the tp list from the backend
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.junit.runners.Suite;
|
||||||
OperationsWhileTargetIsRunningNonStopTest_7_0.class,
|
OperationsWhileTargetIsRunningNonStopTest_7_0.class,
|
||||||
PostMortemCoreTest_7_0.class,
|
PostMortemCoreTest_7_0.class,
|
||||||
CommandTimeoutTest_7_0.class,
|
CommandTimeoutTest_7_0.class,
|
||||||
|
GDBMultiNonStopRunControlTest_7_0.class,
|
||||||
Suite_Sessionless_Tests.class,
|
Suite_Sessionless_Tests.class,
|
||||||
/* Add your test class here */
|
/* Add your test class here */
|
||||||
})
|
})
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.junit.runners.Suite;
|
||||||
OperationsWhileTargetIsRunningTest_7_0.class,
|
OperationsWhileTargetIsRunningTest_7_0.class,
|
||||||
OperationsWhileTargetIsRunningNonStopTest_7_0.class,
|
OperationsWhileTargetIsRunningNonStopTest_7_0.class,
|
||||||
CommandTimeoutTest_7_0.class,
|
CommandTimeoutTest_7_0.class,
|
||||||
|
GDBMultiNonStopRunControlTest_7_0.class,
|
||||||
Suite_Sessionless_Tests.class,
|
Suite_Sessionless_Tests.class,
|
||||||
/* Add your test class here */
|
/* Add your test class here */
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2012 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 implementation of Test cases
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1;
|
||||||
|
|
||||||
|
|
||||||
|
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
||||||
|
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
||||||
|
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_0.GDBMultiNonStopRunControlTest_7_0;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests IMultiRunControl class for Non-stop multi-threaded application.
|
||||||
|
*/
|
||||||
|
@RunWith(BackgroundRunner.class)
|
||||||
|
public class GDBMultiNonStopRunControlTest_7_1 extends GDBMultiNonStopRunControlTest_7_0 {
|
||||||
|
@BeforeClass
|
||||||
|
public static void beforeClassMethod_7_1() {
|
||||||
|
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_1);
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,6 +41,7 @@ import org.junit.runners.Suite;
|
||||||
OperationsWhileTargetIsRunningNonStopTest_7_1.class,
|
OperationsWhileTargetIsRunningNonStopTest_7_1.class,
|
||||||
PostMortemCoreTest_7_1.class,
|
PostMortemCoreTest_7_1.class,
|
||||||
CommandTimeoutTest_7_1.class,
|
CommandTimeoutTest_7_1.class,
|
||||||
|
GDBMultiNonStopRunControlTest_7_1.class,
|
||||||
Suite_Sessionless_Tests.class,
|
Suite_Sessionless_Tests.class,
|
||||||
/* Add your test class here */
|
/* Add your test class here */
|
||||||
})
|
})
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.junit.runners.Suite;
|
||||||
OperationsWhileTargetIsRunningTest_7_1.class,
|
OperationsWhileTargetIsRunningTest_7_1.class,
|
||||||
OperationsWhileTargetIsRunningNonStopTest_7_1.class,
|
OperationsWhileTargetIsRunningNonStopTest_7_1.class,
|
||||||
CommandTimeoutTest_7_1.class,
|
CommandTimeoutTest_7_1.class,
|
||||||
|
GDBMultiNonStopRunControlTest_7_1.class,
|
||||||
Suite_Sessionless_Tests.class,
|
Suite_Sessionless_Tests.class,
|
||||||
/* Add your test class here */
|
/* Add your test class here */
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2012 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 implementation of Test cases
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2;
|
||||||
|
|
||||||
|
|
||||||
|
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
||||||
|
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
||||||
|
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1.GDBMultiNonStopRunControlTest_7_1;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests IMultiRunControl class for Non-stop multi-threaded application.
|
||||||
|
*/
|
||||||
|
@RunWith(BackgroundRunner.class)
|
||||||
|
public class GDBMultiNonStopRunControlTest_7_2 extends GDBMultiNonStopRunControlTest_7_1 {
|
||||||
|
@BeforeClass
|
||||||
|
public static void beforeClassMethod_7_2() {
|
||||||
|
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_2);
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,6 +41,7 @@ import org.junit.runners.Suite;
|
||||||
OperationsWhileTargetIsRunningNonStopTest_7_2.class,
|
OperationsWhileTargetIsRunningNonStopTest_7_2.class,
|
||||||
PostMortemCoreTest_7_2.class,
|
PostMortemCoreTest_7_2.class,
|
||||||
CommandTimeoutTest_7_2.class,
|
CommandTimeoutTest_7_2.class,
|
||||||
|
GDBMultiNonStopRunControlTest_7_2.class,
|
||||||
Suite_Sessionless_Tests.class,
|
Suite_Sessionless_Tests.class,
|
||||||
/* Add your test class here */
|
/* Add your test class here */
|
||||||
})
|
})
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.junit.runners.Suite;
|
||||||
OperationsWhileTargetIsRunningTest_7_2.class,
|
OperationsWhileTargetIsRunningTest_7_2.class,
|
||||||
OperationsWhileTargetIsRunningNonStopTest_7_2.class,
|
OperationsWhileTargetIsRunningNonStopTest_7_2.class,
|
||||||
CommandTimeoutTest_7_2.class,
|
CommandTimeoutTest_7_2.class,
|
||||||
|
GDBMultiNonStopRunControlTest_7_2.class,
|
||||||
Suite_Sessionless_Tests.class,
|
Suite_Sessionless_Tests.class,
|
||||||
/* Add your test class here */
|
/* Add your test class here */
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2012 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 implementation of Test cases
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3;
|
||||||
|
|
||||||
|
|
||||||
|
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
||||||
|
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
||||||
|
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2.GDBMultiNonStopRunControlTest_7_2;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests IMultiRunControl class for Non-stop multi-threaded application.
|
||||||
|
*/
|
||||||
|
@RunWith(BackgroundRunner.class)
|
||||||
|
public class GDBMultiNonStopRunControlTest_7_3 extends GDBMultiNonStopRunControlTest_7_2 {
|
||||||
|
@BeforeClass
|
||||||
|
public static void beforeClassMethod_7_3() {
|
||||||
|
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_3);
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,6 +41,7 @@ import org.junit.runners.Suite;
|
||||||
OperationsWhileTargetIsRunningNonStopTest_7_3.class,
|
OperationsWhileTargetIsRunningNonStopTest_7_3.class,
|
||||||
PostMortemCoreTest_7_3.class,
|
PostMortemCoreTest_7_3.class,
|
||||||
CommandTimeoutTest_7_3.class,
|
CommandTimeoutTest_7_3.class,
|
||||||
|
GDBMultiNonStopRunControlTest_7_3.class,
|
||||||
Suite_Sessionless_Tests.class,
|
Suite_Sessionless_Tests.class,
|
||||||
/* Add your test class here */
|
/* Add your test class here */
|
||||||
})
|
})
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.junit.runners.Suite;
|
||||||
OperationsWhileTargetIsRunningTest_7_3.class,
|
OperationsWhileTargetIsRunningTest_7_3.class,
|
||||||
OperationsWhileTargetIsRunningNonStopTest_7_3.class,
|
OperationsWhileTargetIsRunningNonStopTest_7_3.class,
|
||||||
CommandTimeoutTest_7_3.class,
|
CommandTimeoutTest_7_3.class,
|
||||||
|
GDBMultiNonStopRunControlTest_7_3.class,
|
||||||
Suite_Sessionless_Tests.class,
|
Suite_Sessionless_Tests.class,
|
||||||
/* Add your test class here */
|
/* Add your test class here */
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2012 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 implementation of Test cases
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
|
||||||
|
|
||||||
|
|
||||||
|
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
||||||
|
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
||||||
|
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.GDBMultiNonStopRunControlTest_7_3;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests IMultiRunControl class for Non-stop multi-threaded application.
|
||||||
|
*/
|
||||||
|
@RunWith(BackgroundRunner.class)
|
||||||
|
public class GDBMultiNonStopRunControlTest_7_4 extends GDBMultiNonStopRunControlTest_7_3 {
|
||||||
|
@BeforeClass
|
||||||
|
public static void beforeClassMethod_7_4() {
|
||||||
|
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,10 +11,18 @@
|
||||||
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
|
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.CollectAction;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.TracepointActionManager;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.GDBRemoteTracepointsTest_7_3;
|
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.GDBRemoteTracepointsTest_7_3;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
@RunWith(BackgroundRunner.class)
|
@RunWith(BackgroundRunner.class)
|
||||||
|
@ -30,4 +38,46 @@ public class GDBRemoteTracepointsTest_7_4 extends GDBRemoteTracepointsTest_7_3 {
|
||||||
// instruction of 4 bytes or more, instead of 5.
|
// instruction of 4 bytes or more, instead of 5.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test sets the different types of tracepoints and then sets some string collection actions
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void tracepointActionsWithCollectStrings() throws Throwable {
|
||||||
|
TracepointActionManager tracepointActionMgr = TracepointActionManager.getInstance();
|
||||||
|
|
||||||
|
CollectAction action1 = new CollectAction();
|
||||||
|
action1.setCollectString("/s $locals");
|
||||||
|
action1.setName("Collect string locals");
|
||||||
|
tracepointActionMgr.addAction(action1);
|
||||||
|
|
||||||
|
CollectAction action2 = new CollectAction();
|
||||||
|
action2.setCollectString("/s3 $locals, $reg");
|
||||||
|
action2.setName("Collect string locals, reg");
|
||||||
|
tracepointActionMgr.addAction(action2);
|
||||||
|
|
||||||
|
createTracepoints();
|
||||||
|
|
||||||
|
Map<String, Object> delta = new HashMap<String, Object>();
|
||||||
|
// Set conditions for all tracepoints
|
||||||
|
delta.put(MIBreakpoints.COMMANDS, action1.getName());
|
||||||
|
updateBreakpoint(fTracepoints[0], delta);
|
||||||
|
delta.put(MIBreakpoints.COMMANDS, action2.getName());
|
||||||
|
updateBreakpoint(fTracepoints[1], delta);
|
||||||
|
delta.put(MIBreakpoints.COMMANDS, action1.getName());
|
||||||
|
updateBreakpoint(fTracepoints[2], delta);
|
||||||
|
delta.put(MIBreakpoints.COMMANDS, action1.getName());
|
||||||
|
updateBreakpoint(fTracepoints[3], delta);
|
||||||
|
delta.put(MIBreakpoints.COMMANDS, action2.getName());
|
||||||
|
updateBreakpoint(fTracepoints[4], delta);
|
||||||
|
|
||||||
|
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
||||||
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, action1.toString(), false));
|
||||||
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, action2.toString(), false));
|
||||||
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, true, action1.toString(), true));
|
||||||
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, action1.toString(), true));
|
||||||
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, action2.toString(), acceptsFastTpOnFourBytes()));
|
||||||
|
|
||||||
|
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.junit.runners.Suite;
|
||||||
OperationsWhileTargetIsRunningNonStopTest_7_4.class,
|
OperationsWhileTargetIsRunningNonStopTest_7_4.class,
|
||||||
PostMortemCoreTest_7_4.class,
|
PostMortemCoreTest_7_4.class,
|
||||||
CommandTimeoutTest_7_4.class,
|
CommandTimeoutTest_7_4.class,
|
||||||
|
GDBMultiNonStopRunControlTest_7_4.class,
|
||||||
Suite_Sessionless_Tests.class,
|
Suite_Sessionless_Tests.class,
|
||||||
/* Add your test class here */
|
/* Add your test class here */
|
||||||
})
|
})
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.junit.runners.Suite;
|
||||||
OperationsWhileTargetIsRunningTest_7_4.class,
|
OperationsWhileTargetIsRunningTest_7_4.class,
|
||||||
OperationsWhileTargetIsRunningNonStopTest_7_4.class,
|
OperationsWhileTargetIsRunningNonStopTest_7_4.class,
|
||||||
CommandTimeoutTest_7_4.class,
|
CommandTimeoutTest_7_4.class,
|
||||||
|
GDBMultiNonStopRunControlTest_7_4.class,
|
||||||
Suite_Sessionless_Tests.class
|
Suite_Sessionless_Tests.class
|
||||||
/* Add your test class here */
|
/* Add your test class here */
|
||||||
})
|
})
|
||||||
|
|
|
@ -34,7 +34,7 @@ Export-Package: org.eclipse.cdt.dsf.debug.internal.ui;x-internal:=true,
|
||||||
org.eclipse.cdt.dsf.debug.internal.ui.disassembly.util;x-internal:=true,
|
org.eclipse.cdt.dsf.debug.internal.ui.disassembly.util;x-internal:=true,
|
||||||
org.eclipse.cdt.dsf.debug.internal.ui.preferences;x-internal:=true,
|
org.eclipse.cdt.dsf.debug.internal.ui.preferences;x-internal:=true,
|
||||||
org.eclipse.cdt.dsf.debug.internal.ui.viewmodel;x-internal:=true,
|
org.eclipse.cdt.dsf.debug.internal.ui.viewmodel;x-internal:=true,
|
||||||
org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.actions;x-internal:=true,
|
org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.actions;x-friends:="org.eclipse.cdt.dsf.gdb.ui",
|
||||||
org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport;x-internal:=true,
|
org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport;x-internal:=true,
|
||||||
org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.numberformat.detail;x-internal:=true,
|
org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.numberformat.detail;x-internal:=true,
|
||||||
org.eclipse.cdt.dsf.debug.ui,
|
org.eclipse.cdt.dsf.debug.ui,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2009 Wind River Systems and others.
|
* Copyright (c) 2006, 2012 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,9 +7,13 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
|
* Marc Khouzam (Ericsson) - Added support for multiple selection (bug 330974)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.ui.actions;
|
package org.eclipse.cdt.dsf.debug.ui.actions;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
||||||
import org.eclipse.cdt.dsf.concurrent.Immutable;
|
import org.eclipse.cdt.dsf.concurrent.Immutable;
|
||||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
|
@ -29,11 +33,18 @@ import org.eclipse.debug.core.commands.IDebugCommandRequest;
|
||||||
*/
|
*/
|
||||||
@Immutable
|
@Immutable
|
||||||
public abstract class DsfCommandRunnable extends DsfRunnable {
|
public abstract class DsfCommandRunnable extends DsfRunnable {
|
||||||
private final IExecutionDMContext fContext;
|
private final IExecutionDMContext[] fContexts;
|
||||||
private final DsfServicesTracker fTracker;
|
private final DsfServicesTracker fTracker;
|
||||||
private final IDebugCommandRequest fRequest;
|
private final IDebugCommandRequest fRequest;
|
||||||
|
|
||||||
public IExecutionDMContext getContext() { return fContext; }
|
// For backwards compatibility, keep this method that returns the first selection. This method
|
||||||
|
// is meaningful when we only support a single selection.
|
||||||
|
public IExecutionDMContext getContext() { return (fContexts != null && fContexts.length > 0) ? fContexts[0] : null; }
|
||||||
|
/**
|
||||||
|
* Return all selected contexts.
|
||||||
|
* @since 2.3
|
||||||
|
*/
|
||||||
|
public IExecutionDMContext[] getContexts() { return fContexts; }
|
||||||
public IRunControl getRunControl() {
|
public IRunControl getRunControl() {
|
||||||
return fTracker.getService(IRunControl.class);
|
return fTracker.getService(IRunControl.class);
|
||||||
}
|
}
|
||||||
|
@ -42,8 +53,8 @@ public abstract class DsfCommandRunnable extends DsfRunnable {
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
public SteppingController getSteppingController() {
|
public SteppingController getSteppingController() {
|
||||||
if (fContext != null) {
|
if (fContexts != null && fContexts.length > 0) {
|
||||||
return (SteppingController) fContext.getAdapter(SteppingController.class);
|
return (SteppingController) fContexts[0].getAdapter(SteppingController.class);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -56,15 +67,33 @@ public abstract class DsfCommandRunnable extends DsfRunnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public DsfCommandRunnable(DsfServicesTracker servicesTracker, Object element, IDebugCommandRequest request) {
|
public DsfCommandRunnable(DsfServicesTracker servicesTracker, Object element, IDebugCommandRequest request) {
|
||||||
fTracker = servicesTracker;
|
this(servicesTracker, new Object[] { element }, request);
|
||||||
if (element instanceof IDMVMContext) {
|
}
|
||||||
IDMVMContext vmc = (IDMVMContext)element;
|
|
||||||
fContext = DMContexts.getAncestorOfType(vmc.getDMContext(), IExecutionDMContext.class);
|
|
||||||
} else {
|
|
||||||
fContext = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
fRequest = request;
|
/** @since 2.3 */
|
||||||
|
public DsfCommandRunnable(DsfServicesTracker servicesTracker, Object[] elements, IDebugCommandRequest request) {
|
||||||
|
fTracker = servicesTracker;
|
||||||
|
fRequest = request;
|
||||||
|
|
||||||
|
// Extract all selected execution contexts, using a set to avoid duplicates. Duplicates will
|
||||||
|
// happen if multiple stack frames of the same thread are selected.
|
||||||
|
Set<IExecutionDMContext> execDmcSet = new HashSet<IExecutionDMContext>(request.getElements().length);
|
||||||
|
for (Object element : request.getElements()) {
|
||||||
|
if (element instanceof IDMVMContext) {
|
||||||
|
IDMVMContext vmc = (IDMVMContext)element;
|
||||||
|
IExecutionDMContext execDmc = DMContexts.getAncestorOfType(vmc.getDMContext(), IExecutionDMContext.class);
|
||||||
|
if (execDmc != null) {
|
||||||
|
// We have a thread or a process
|
||||||
|
execDmcSet.add(execDmc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (execDmcSet.size() == 0) {
|
||||||
|
fContexts = null;
|
||||||
|
} else {
|
||||||
|
fContexts = execDmcSet.toArray(new IExecutionDMContext[execDmcSet.size()]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,8 +102,8 @@ public abstract class DsfCommandRunnable extends DsfRunnable {
|
||||||
fRequest.done();
|
fRequest.done();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (getContext() == null) {
|
if (getContexts() == null || getContexts().length == 0) {
|
||||||
fRequest.setStatus(makeError("Selected object does not support run control.", null)); //$NON-NLS-1$
|
fRequest.setStatus(makeError("Selected objects do not support run control.", null)); //$NON-NLS-1$
|
||||||
} else if (getRunControl() == null || getSteppingController() == null) {
|
} else if (getRunControl() == null || getSteppingController() == null) {
|
||||||
fRequest.setStatus(makeError("Run Control not available", null)); //$NON-NLS-1$
|
fRequest.setStatus(makeError("Run Control not available", null)); //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2009 Wind River Systems and others.
|
* Copyright (c) 2006, 2012 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,14 +7,16 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
|
* Marc Khouzam (Ericsson) - Added support for multi-selection (Bug 330974)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.ui.actions;
|
package org.eclipse.cdt.dsf.debug.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.Immutable;
|
import org.eclipse.cdt.dsf.concurrent.Immutable;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.debug.service.IMultiRunControl;
|
||||||
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
||||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
|
@ -43,17 +45,42 @@ public class DsfResumeCommand implements IResumeHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void canExecute(final IEnabledStateRequest request) {
|
public void canExecute(final IEnabledStateRequest request) {
|
||||||
if (request.getElements().length != 1) {
|
if (request.getElements().length == 1) {
|
||||||
request.setEnabled(false);
|
canExecuteSingle(request);
|
||||||
request.done();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle multi-selection
|
||||||
|
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements(), request) {
|
||||||
|
@Override public void doExecute() {
|
||||||
|
final IMultiRunControl multiRun = fTracker.getService(IMultiRunControl.class);
|
||||||
|
if (multiRun == null) {
|
||||||
|
// No multi run control service: multi selection not allowed
|
||||||
|
request.setEnabled(false);
|
||||||
|
request.done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if some of the selections can be resumed
|
||||||
|
multiRun.canResumeSome(
|
||||||
|
getContexts(),
|
||||||
|
new ImmediateDataRequestMonitor<Boolean>() {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
request.setEnabled(isSuccess() && getData());
|
||||||
|
request.done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void canExecuteSingle(final IEnabledStateRequest request) {
|
||||||
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
||||||
@Override public void doExecute() {
|
@Override public void doExecute() {
|
||||||
getRunControl().canResume(
|
getRunControl().canResume(
|
||||||
getContext(),
|
getContext(),
|
||||||
new DataRequestMonitor<Boolean>(ImmediateExecutor.getInstance(), null) {
|
new ImmediateDataRequestMonitor<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
protected void handleCompleted() {
|
protected void handleCompleted() {
|
||||||
request.setEnabled(isSuccess() && getData());
|
request.setEnabled(isSuccess() && getData());
|
||||||
|
@ -66,17 +93,32 @@ public class DsfResumeCommand implements IResumeHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final IDebugCommandRequest request) {
|
public boolean execute(final IDebugCommandRequest request) {
|
||||||
if (request.getElements().length != 1) {
|
if (request.getElements().length == 1) {
|
||||||
request.done();
|
executeSingle(request);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle multi-selection
|
||||||
|
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements(), request) {
|
||||||
|
@Override public void doExecute() {
|
||||||
|
final IMultiRunControl multiRun = fTracker.getService(IMultiRunControl.class);
|
||||||
|
if (multiRun == null) {
|
||||||
|
// No multi run control service: multi selection not allowed
|
||||||
|
request.done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
multiRun.resume(getContexts(), new ImmediateRequestMonitor());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeSingle(IDebugCommandRequest request) {
|
||||||
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
||||||
@Override public void doExecute() {
|
@Override public void doExecute() {
|
||||||
getRunControl().resume(getContext(), new RequestMonitor(fExecutor, null));
|
getRunControl().resume(getContext(), new RequestMonitor(fExecutor, null));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2009 Wind River Systems and others.
|
* Copyright (c) 2006, 2012 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,14 +7,16 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
|
* Marc Khouzam (Ericsson) - Added support for multi-selection (Bug 330974)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.ui.actions;
|
package org.eclipse.cdt.dsf.debug.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.Immutable;
|
import org.eclipse.cdt.dsf.concurrent.Immutable;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.debug.service.IMultiRunControl;
|
||||||
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
||||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
|
@ -42,17 +44,42 @@ public class DsfSuspendCommand implements ISuspendHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void canExecute(final IEnabledStateRequest request) {
|
public void canExecute(final IEnabledStateRequest request) {
|
||||||
if (request.getElements().length != 1) {
|
if (request.getElements().length == 1) {
|
||||||
request.setEnabled(false);
|
canExecuteSingle(request);
|
||||||
request.done();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle multi-selection
|
||||||
|
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements(), request) {
|
||||||
|
@Override public void doExecute() {
|
||||||
|
final IMultiRunControl multiRun = fTracker.getService(IMultiRunControl.class);
|
||||||
|
if (multiRun == null) {
|
||||||
|
// No multi run control service: multi selection not allowed
|
||||||
|
request.setEnabled(false);
|
||||||
|
request.done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if some of the selections can be suspended
|
||||||
|
multiRun.canSuspendSome(
|
||||||
|
getContexts(),
|
||||||
|
new ImmediateDataRequestMonitor<Boolean>() {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
request.setEnabled(isSuccess() && getData());
|
||||||
|
request.done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void canExecuteSingle(final IEnabledStateRequest request) {
|
||||||
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
||||||
@Override public void doExecute() {
|
@Override public void doExecute() {
|
||||||
getRunControl().canSuspend(
|
getRunControl().canSuspend(
|
||||||
getContext(),
|
getContext(),
|
||||||
new DataRequestMonitor<Boolean>(ImmediateExecutor.getInstance(), null) {
|
new ImmediateDataRequestMonitor<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
protected void handleCompleted() {
|
protected void handleCompleted() {
|
||||||
request.setEnabled(isSuccess() && getData());
|
request.setEnabled(isSuccess() && getData());
|
||||||
|
@ -65,17 +92,32 @@ public class DsfSuspendCommand implements ISuspendHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final IDebugCommandRequest request) {
|
public boolean execute(final IDebugCommandRequest request) {
|
||||||
if (request.getElements().length != 1) {
|
if (request.getElements().length == 1) {
|
||||||
request.done();
|
executeSingle(request);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle multi-selection
|
||||||
|
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements(), request) {
|
||||||
|
@Override public void doExecute() {
|
||||||
|
final IMultiRunControl multiRun = fTracker.getService(IMultiRunControl.class);
|
||||||
|
if (multiRun == null) {
|
||||||
|
// No multi run control service: multi selection not allowed
|
||||||
|
request.done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
multiRun.suspend(getContexts(), new ImmediateRequestMonitor());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeSingle(IDebugCommandRequest request) {
|
||||||
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
||||||
@Override public void doExecute() {
|
@Override public void doExecute() {
|
||||||
getRunControl().suspend(getContext(), new RequestMonitor(fExecutor, null));
|
getRunControl().suspend(getContext(), new RequestMonitor(fExecutor, null));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,134 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2012 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.dsf.debug.service;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface provides the ability to perform run control operations on multiple contexts.
|
||||||
|
*
|
||||||
|
* @see org.eclipse.cdt.dsf.debug.service.IRunControl
|
||||||
|
*
|
||||||
|
* @since 2.3
|
||||||
|
*/
|
||||||
|
public interface IMultiRunControl extends IRunControl
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Check if at least one of the specified contexts can be resumed
|
||||||
|
* @param context List of execution contexts that want to be resumed
|
||||||
|
* @param rm Request monitor returning:
|
||||||
|
* true if at least one of the specified contexts can be resumed
|
||||||
|
* false if none of the specified contexts can be resumed
|
||||||
|
*/
|
||||||
|
void canResumeSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if all of the specified contexts can be resumed
|
||||||
|
* @param context List of execution contexts that want to be resumed
|
||||||
|
* @param rm Request monitor returning:
|
||||||
|
* true if all of the specified contexts can be resumed
|
||||||
|
* false if any of the specified contexts cannot be resumed
|
||||||
|
*/
|
||||||
|
void canResumeAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if at least one of the specified contexts can be suspended
|
||||||
|
* @param context List of execution contexts that want to be suspended
|
||||||
|
* @param rm Request monitor returning:
|
||||||
|
* true if at least one of the specified contexts can be suspended
|
||||||
|
* false if none of the specified contexts can be suspended
|
||||||
|
*/
|
||||||
|
void canSuspendSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if all of the specified contexts can be suspended
|
||||||
|
* @param context List of execution contexts that want to be suspended
|
||||||
|
* @param rm Request monitor returning:
|
||||||
|
* true if all of the specified contexts can be suspended
|
||||||
|
* false if any of the specified contexts cannot be suspended
|
||||||
|
*/
|
||||||
|
void canSuspendAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if any of the specified contexts is suspended.
|
||||||
|
* @param context List of execution contexts that are to be checked for being suspended
|
||||||
|
* @param rm Request monitor returning:
|
||||||
|
* true if any of the specified contexts is suspended, false otherwise
|
||||||
|
*/
|
||||||
|
void isSuspendedSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if all of the specified contexts are suspended.
|
||||||
|
* @param context List of execution contexts that are to be checked for being suspended
|
||||||
|
* @param rm Request monitor returning:
|
||||||
|
* true if all of the specified contexts are suspended, false otherwise
|
||||||
|
*/
|
||||||
|
void isSuspendedAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if any of the specified contexts can be stepped using stepType
|
||||||
|
* @param context List of execution contexts that want to be stepped
|
||||||
|
* @param stepStype The type of step to be used.
|
||||||
|
* @param rm Request monitor returning:
|
||||||
|
* true if any of the specified contexts can be stepped
|
||||||
|
* false if none of the specified contexts can be stepped
|
||||||
|
*/
|
||||||
|
void canStepSome(IExecutionDMContext[] contexts, StepType stepType, DataRequestMonitor<Boolean> rm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if all of the specified contexts can be stepped using stepType
|
||||||
|
* @param context List of execution contexts that want to be stepped
|
||||||
|
* @param stepStype The type of step to be used.
|
||||||
|
* @param rm Request monitor returning:
|
||||||
|
* true if all of the specified contexts can be stepped
|
||||||
|
* false if any of the specified contexts cannot be stepped
|
||||||
|
*/
|
||||||
|
void canStepAll(IExecutionDMContext[] contexts, StepType stepType, DataRequestMonitor<Boolean> rm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if any of the specified contexts is currently stepping.
|
||||||
|
* @param context List of execution contexts that are to be checked for stepping
|
||||||
|
* @param rm Request monitor returning:
|
||||||
|
* true if any of the specified contexts is stepping, false otherwise
|
||||||
|
*/
|
||||||
|
void isSteppingSome(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if all of the specified contexts are currently stepping.
|
||||||
|
* @param context List of execution contexts that are to be checked for stepping
|
||||||
|
* @param rm Request monitor returning:
|
||||||
|
* true if all of the specified contexts are stepping, false otherwise
|
||||||
|
*/
|
||||||
|
void isSteppingAll(IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request that all specified contexts be resumed. Only contexts that are in a
|
||||||
|
* state that can be resumed will be affected, others will be ignored.
|
||||||
|
* @param context List of execution contexts that are to be resumed
|
||||||
|
*/
|
||||||
|
void resume(IExecutionDMContext[] contexts, RequestMonitor rm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request that all specified contexts be suspended. Only contexts that are in a
|
||||||
|
* state that can be suspended will be affected, others will be ignored.
|
||||||
|
* @param context List of execution contexts that are to be suspended
|
||||||
|
*/
|
||||||
|
void suspend(IExecutionDMContext[] contexts, RequestMonitor rm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request that all specified context be stepped using stepType. Only contexts
|
||||||
|
* that are in a state that can be stepped will be affected, others will be ignored.
|
||||||
|
* @param context List of execution contexts that are to be stepped
|
||||||
|
* @param stepStype The type of step to be used.
|
||||||
|
*/
|
||||||
|
void step(IExecutionDMContext[] contexts, StepType stepType, RequestMonitor rm);
|
||||||
|
}
|
|
@ -4,9 +4,7 @@
|
||||||
label="%featureName"
|
label="%featureName"
|
||||||
version="7.0.0.qualifier"
|
version="7.0.0.qualifier"
|
||||||
provider-name="%providerName"
|
provider-name="%providerName"
|
||||||
image="eclipse_update_120.jpg"
|
image="eclipse_update_120.jpg">
|
||||||
license-feature="org.eclipse.cdt.license"
|
|
||||||
license-feature-version="1.0.0.qualifier">
|
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
%description
|
%description
|
||||||
|
|
|
@ -15,6 +15,5 @@ bin.includes = META-INF/,\
|
||||||
plugin.properties,\
|
plugin.properties,\
|
||||||
.,\
|
.,\
|
||||||
plugin.xml,\
|
plugin.xml,\
|
||||||
about.html,\
|
about.html
|
||||||
icons/
|
|
||||||
src.includes = about.html
|
src.includes = about.html
|
||||||
|
|
3
pom.xml
3
pom.xml
|
@ -15,7 +15,8 @@
|
||||||
<name>CDT Parent</name>
|
<name>CDT Parent</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<tycho-version>0.13.0</tycho-version>
|
<tycho-version>0.14.1</tycho-version>
|
||||||
|
<tycho-extras-version>0.14.0</tycho-extras-version>
|
||||||
<platform-version>3.8milestones</platform-version>
|
<platform-version>3.8milestones</platform-version>
|
||||||
<platform-site>http://download.eclipse.org/eclipse/updates/${platform-version}</platform-site>
|
<platform-site>http://download.eclipse.org/eclipse/updates/${platform-version}</platform-site>
|
||||||
<orbit-version>R20110523182458</orbit-version>
|
<orbit-version>R20110523182458</orbit-version>
|
||||||
|
|
|
@ -16,5 +16,5 @@ bin.includes = META-INF/,\
|
||||||
OSGI-INF/,\
|
OSGI-INF/,\
|
||||||
test.xml,\
|
test.xml,\
|
||||||
about.html
|
about.html
|
||||||
jre.compilation.profile = J2SE-1.5
|
|
||||||
src.includes = about.html
|
src.includes = about.html
|
||||||
|
|
|
@ -15,13 +15,14 @@
|
||||||
<artifactId>org.eclipse.cdt.testsrunner.test</artifactId>
|
<artifactId>org.eclipse.cdt.testsrunner.test</artifactId>
|
||||||
<packaging>eclipse-test-plugin</packaging>
|
<packaging>eclipse-test-plugin</packaging>
|
||||||
|
|
||||||
<repositories>
|
<!-- Uncommenting this is useful when the repo is built first then you want to run tests on this plugin only -->
|
||||||
|
<!-- <repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>cdt.repo</id>
|
<id>cdt.repo</id>
|
||||||
<url>file:/${basedir}/../../releng/org.eclipse.cdt.repo/target/repository</url>
|
<url>file:/${basedir}/../../releng/org.eclipse.cdt.repo/target/repository</url>
|
||||||
<layout>p2</layout>
|
<layout>p2</layout>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>-->
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
label="%featureName"
|
label="%featureName"
|
||||||
version="1.0.3.qualifier"
|
version="1.0.3.qualifier"
|
||||||
provider-name="%providerName"
|
provider-name="%providerName"
|
||||||
plugin="org.eclipse.cdt.managedbuilder.bupc.ui"
|
plugin="org.eclipse.cdt.managedbuilder.bupc.ui">
|
||||||
license-feature="org.eclipse.cdt.license"
|
|
||||||
license-feature-version="1.0.0.qualifier">
|
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
%description
|
%description
|
||||||
|
|
|
@ -13,5 +13,5 @@ bin.includes = feature.xml,\
|
||||||
license.html,\
|
license.html,\
|
||||||
epl-v10.html,\
|
epl-v10.html,\
|
||||||
eclipse_update_120.jpg,\
|
eclipse_update_120.jpg,\
|
||||||
About.txt
|
ABOUT.txt
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
id="org.eclipse.cdt.msw"
|
id="org.eclipse.cdt.msw"
|
||||||
label="CDT Visual C++ Support"
|
label="CDT Visual C++ Support"
|
||||||
version="1.0.0.qualifier"
|
version="1.0.0.qualifier"
|
||||||
provider-name="Eclipse CDT"
|
provider-name="Eclipse CDT">
|
||||||
license-feature="org.eclipse.cdt.license"
|
|
||||||
license-feature-version="1.0.0.qualifier">
|
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
%description
|
%description
|
||||||
|
|
Loading…
Add table
Reference in a new issue