1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Merge remote-tracking branch 'cdt/master' into sd90

This commit is contained in:
Andrew Gvozdev 2012-10-29 09:15:59 -04:00
commit 302019d89d
85 changed files with 2026 additions and 1016 deletions

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<requires> <requires>
<import plugin="org.eclipse.cdt.managedbuilder.core" version="5.0.100" match="greaterOrEqual"/> <import plugin="org.eclipse.cdt.managedbuilder.core" version="5.0.100" match="greaterOrEqual"/>
<import plugin="org.eclipse.cdt.core" version="5.1.0" match="greaterOrEqual"/> <import plugin="org.eclipse.cdt.core" version="5.1.0" match="greaterOrEqual"/>

View file

@ -4,5 +4,5 @@ provides.99.namespace=org.eclipse.equinox.p2.iu
provides.99.name=org.eclipse.linuxtools.cdt.autotools.feature.group provides.99.name=org.eclipse.linuxtools.cdt.autotools.feature.group
provides.99.version=$version$ provides.99.version=$version$
instructions.configure=\ instructions.configure=\
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/indigo,type:0,name:CDT,enabled:false); \ org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/juno,type:0,name:CDT,enabled:false); \
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/indigo,type:1,name:CDT,enabled:false); org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tools/cdt/releases/juno,type:1,name:CDT,enabled:false);

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.autotools.core.source" id="org.eclipse.cdt.autotools.core.source"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.managedbuilder.gnu.ui" id="org.eclipse.cdt.managedbuilder.gnu.ui"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.managedbuilder.gnu.ui.source" id="org.eclipse.cdt.managedbuilder.gnu.ui.source"
download-size="0" download-size="0"

View file

@ -17,6 +17,7 @@ import java.util.List;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.eclipse.cdt.core.AbstractExecutableExtensionBase; import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry; import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.CMacroEntry; import org.eclipse.cdt.core.settings.model.CMacroEntry;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
@ -649,6 +650,38 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
assertEquals(3, includes.size()); assertEquals(3, includes.size());
} }
/**
* Test ability to get entries by kind.
*/
public void testEntriesByKind_CompositeKind() throws Exception {
MockConfigurationDescription cfgDescription = new MockConfigurationDescription(CFG_ID);
// contribute the entries
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
entries.add(new CIncludePathEntry("path0", 0));
entries.add(new CMacroEntry("MACRO0", "value0",0));
entries.add(new CIncludePathEntry("path1", 0));
entries.add(new CMacroEntry("MACRO1", "value1",0));
entries.add(new CIncludePathEntry("path2", 0));
entries.add(new CIncludeFileEntry("include-path-file", 0));
ILanguageSettingsProvider provider0 = new MockProvider(PROVIDER_0, PROVIDER_NAME_0, entries);
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
providers.add(provider0);
cfgDescription.setLanguageSettingProviders(providers);
// retrieve entries by kind
List<ICLanguageSettingEntry> result = LanguageSettingsProvidersSerializer
.getSettingEntriesByKind(cfgDescription, FILE_0, LANG_ID, ICSettingEntry.INCLUDE_PATH | ICSettingEntry.MACRO);
assertEquals(new CIncludePathEntry("path0", 0), result.get(0));
assertEquals(new CMacroEntry("MACRO0", "value0",0), result.get(1));
assertEquals(new CIncludePathEntry("path1", 0), result.get(2));
assertEquals(new CMacroEntry("MACRO1", "value1",0), result.get(3));
assertEquals(new CIncludePathEntry("path2", 0), result.get(4));
assertEquals(5, result.size());
}
/** /**
* Test ability to serialize providers for a configuration. * Test ability to serialize providers for a configuration.
*/ */

View file

@ -1039,13 +1039,13 @@ public class AST2CPPTests extends AST2BaseTest {
IFunction f = (IFunction) decl.getDeclarators()[0].getName().resolveBinding(); IFunction f = (IFunction) decl.getDeclarators()[0].getName().resolveBinding();
decl = (IASTSimpleDeclaration) tu.getDeclarations()[2]; decl = (IASTSimpleDeclaration) tu.getDeclarations()[2];
IVariable g = (IVariable) decl.getDeclarators()[0] IVariable g =
.getNestedDeclarator().getName().resolveBinding(); (IVariable) decl.getDeclarators()[0].getNestedDeclarator().getName().resolveBinding();
decl = (IASTSimpleDeclaration) tu.getDeclarations()[3]; decl = (IASTSimpleDeclaration) tu.getDeclarations()[3];
IVariable h = (IVariable) decl.getDeclarators()[0] IVariable h =
.getNestedDeclarator().getNestedDeclarator().getName() (IVariable) decl.getDeclarators()[0].getNestedDeclarator().getNestedDeclarator()
.resolveBinding(); .getName().resolveBinding();
IFunctionType t_f = f.getType(); IFunctionType t_f = f.getType();
IType t_f_return = t_f.getReturnType(); IType t_f_return = t_f.getReturnType();
@ -4747,14 +4747,57 @@ public class AST2CPPTests extends AST2BaseTest {
// const_iterator begin() const; // const_iterator begin() const;
// }; // };
// //
// void test(const vector<int>& v) { // typedef int Element;
//
// void test(const vector<Element>& v) {
// auto it = v.begin(); // auto it = v.begin();
// } // }
public void testTypedefPreservation_380498_2() throws Exception { public void testTypedefPreservation_380498_2() throws Exception {
BindingAssertionHelper ba= getAssertionHelper(); BindingAssertionHelper ba= getAssertionHelper();
ICPPVariable it = ba.assertNonProblem("it =", "it", ICPPVariable.class); ICPPVariable it = ba.assertNonProblem("it =", "it", ICPPVariable.class);
assertTrue(it.getType() instanceof ITypedef); assertTrue(it.getType() instanceof ITypedef);
assertEquals("vector<int>::const_iterator", ASTTypeUtil.getType(it.getType(), false)); assertEquals("vector<Element>::const_iterator", ASTTypeUtil.getType(it.getType(), false));
}
// template <typename T> class char_traits {};
// template <typename C, typename T = char_traits<C>> class basic_string {};
//
// template<typename _Iterator>
// struct iterator_traits {
// typedef typename _Iterator::reference reference;
// };
//
// template<typename _Tp>
// struct iterator_traits<_Tp*> {
// typedef _Tp& reference;
// };
//
// template<typename _Iterator, typename _Container>
// struct normal_iterator {
// typedef iterator_traits<_Iterator> traits_type;
// typedef typename traits_type::reference reference;
// reference operator*() const;
// };
//
// template <typename T> struct vector {
// typedef T* pointer;
// typedef normal_iterator<pointer, vector> iterator;
// iterator begin();
// iterator end();
// };
//
// typedef basic_string<char> string;
//
// void test() {
// vector<string> v;
// for (auto s : v) {
// }
// }
public void testTypedefPreservation_380498_3() throws Exception {
BindingAssertionHelper ba= getAssertionHelper();
ICPPVariable s = ba.assertNonProblem("s :", "s", ICPPVariable.class);
assertTrue(s.getType() instanceof ITypedef);
assertEquals("string", ASTTypeUtil.getType(s.getType(), false));
} }
// int f() { // int f() {

View file

@ -273,7 +273,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
} }
} }
interface ITestStrategy { protected interface ITestStrategy {
IIndex getIndex(); IIndex getIndex();
void setUp() throws Exception; void setUp() throws Exception;
void tearDown() throws Exception; void tearDown() throws Exception;
@ -467,7 +467,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
* to put the contents of the section to. To request the AST of a file, put an asterisk after * to put the contents of the section to. To request the AST of a file, put an asterisk after
* the file name. * the file name.
*/ */
class SinglePDOMTestNamedFilesStrategy implements ITestStrategy { protected class SinglePDOMTestNamedFilesStrategy implements ITestStrategy {
private IIndex index; private IIndex index;
private ICProject cproject; private ICProject cproject;
private StringBuilder[] testData; private StringBuilder[] testData;

View file

@ -240,7 +240,7 @@ public class BaseTestCase extends TestCase {
* in the log should fail the test. If the logged number of non-OK status objects * in the log should fail the test. If the logged number of non-OK status objects
* differs from the last value passed, the test is failed. If this method is not called * differs from the last value passed, the test is failed. If this method is not called
* at all, the expected number defaults to zero. * at all, the expected number defaults to zero.
* @param value * @param count the expected number of logged error and warning messages
*/ */
public void setExpectedNumberOfLoggedNonOKStatusObjects(int count) { public void setExpectedNumberOfLoggedNonOKStatusObjects(int count) {
fExpectedLoggedNonOK= count; fExpectedLoggedNonOK= count;

View file

@ -0,0 +1,113 @@
/*******************************************************************************
* 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:
* Sergey Prigogin (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.testplugin.util;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMManager;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.internal.core.CCoreInternals;
import org.eclipse.cdt.internal.core.pdom.PDOM;
import org.eclipse.cdt.internal.pdom.tests.PDOMPrettyPrinter;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
/**
* Base class for tests that use AST. The files in the test project are created from the comments
* preceding the test case. The test project will contain a single source file called source.cpp or
* source.c, depending on whether the project is for C++ or C, and zero or more header files called
* header1.h, header2.h, etc. The AST is created for the source file only and can be obtained
* by calling getAst().
*/
public class OneSourceMultipleHeadersTestCase extends BaseTestCase {
private static final boolean DEBUG = false;
private final TestSourceReader testSourceReader;
private final boolean cpp;
private IIndex index;
private ICProject cproject;
private StringBuilder[] testData;
private IASTTranslationUnit ast;
public OneSourceMultipleHeadersTestCase(TestSourceReader testSourceReader, boolean cpp) {
this(null, testSourceReader, cpp);
}
public OneSourceMultipleHeadersTestCase(String name, TestSourceReader testSourceReader,
boolean cpp) {
super(name);
this.testSourceReader = testSourceReader;
this.cpp = cpp;
}
protected ICProject getCProject() {
return cproject;
}
protected IIndex getIndex() {
return index;
}
protected StringBuilder[] getTestData() {
return testData;
}
protected IASTTranslationUnit getAst() {
return ast;
}
public String getAstSource() {
return testData[testData.length - 1].toString();
}
@Override
protected void setUp() throws Exception {
cproject = cpp ?
CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER) :
CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
testData = testSourceReader.getContentsForTest(getName());
if (testData.length > 0) {
for (int i = 0; i < testData.length - 1; i++) {
String filename = String.format("header%d.h", i + 1);
IFile file = TestSourceReader.createFile(cproject.getProject(), new Path(filename), testData[i].toString());
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
}
}
IFile cppfile= TestSourceReader.createFile(cproject.getProject(), new Path("source.c" + (cpp ? "pp" : "")), getAstSource());
waitForIndexer(cproject);
if (DEBUG) {
System.out.println("Project PDOM: " + getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
}
index= CCorePlugin.getIndexManager().getIndex(cproject);
index.acquireReadLock();
ast = TestSourceReader.createIndexBasedAST(index, cproject, cppfile);
}
@Override
protected void tearDown() throws Exception {
if (index != null) {
index.releaseReadLock();
}
if (cproject != null) {
cproject.getProject().delete(IResource.FORCE | IResource.ALWAYS_DELETE_PROJECT_CONTENT, new NullProgressMonitor());
}
}
}

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others. * Copyright (c) 2006, 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
@ -8,6 +8,7 @@
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Andrew Ferguson (Symbian) * Andrew Ferguson (Symbian)
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.testplugin.util; package org.eclipse.cdt.core.testplugin.util;
@ -57,23 +58,61 @@ import org.osgi.framework.Bundle;
* Utilities for reading test source code from plug-in .java sources * Utilities for reading test source code from plug-in .java sources
*/ */
public class TestSourceReader { public class TestSourceReader {
private final Bundle bundle;
private final String srcRoot;
private final Class clazz;
private final int numSections;
/**
* @param bundle the bundle containing the source, if {@code null} can try to load using
* classpath (source folder has to be in the classpath for this to work)
* @param srcRoot the directory inside the bundle containing the packages
* @param clazz the name of the class containing the test
*/
public TestSourceReader(Bundle bundle, String srcRoot, Class clazz) {
this(bundle, srcRoot, clazz, 0);
}
/**
* @param bundle the bundle containing the source, if {@code null} can try to load using
* classpath (source folder has to be in the classpath for this to work)
* @param srcRoot the directory inside the bundle containing the packages
* @param clazz the name of the class containing the test
* @param numSections the number of comment sections preceding the named test to return.
* Pass zero to get all available sections.
*/
public TestSourceReader(Bundle bundle, String srcRoot, Class clazz, int numSections) {
this.bundle = bundle;
this.srcRoot = srcRoot;
this.clazz = clazz;
this.numSections = numSections;
}
public StringBuilder[] getContentsForTest(final String testName) throws IOException {
return getContentsForTest(bundle, srcRoot, clazz, testName, numSections);
}
public String readTaggedComment(String tag) throws IOException {
return readTaggedComment(bundle, tag, clazz, tag);
}
/** /**
* Returns an array of StringBuilder objects for each comment section found preceding the named * Returns an array of StringBuilder objects for each comment section found preceding the named
* test in the source code. * test in the source code.
* *
* @param bundle the bundle containing the source, if null can try to load using classpath * @param bundle the bundle containing the source, if {@code null} can try to load using
* (source folder has to be in the classpath for this to work) * classpath (source folder has to be in the classpath for this to work)
* @param srcRoot the directory inside the bundle containing the packages * @param srcRoot the directory inside the bundle containing the packages
* @param clazz the name of the class containing the test * @param clazz the name of the class containing the test
* @param testName the name of the test * @param testName the name of the test
* @param sections the number of comment sections preceding the named test to return. Pass zero * @param numSections the number of comment sections preceding the named test to return.
* to get all available sections. * Pass zero to get all available sections.
* @return an array of StringBuilder objects for each comment section found preceding the named * @return an array of StringBuilder objects for each comment section found preceding the named
* test in the source code. * test in the source code.
* @throws IOException * @throws IOException
*/ */
public static StringBuilder[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz, public static StringBuilder[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz,
final String testName, int sections) throws IOException { final String testName, int numSections) throws IOException {
// Walk up the class inheritance chain until we find the test method. // Walk up the class inheritance chain until we find the test method.
try { try {
while (clazz.getMethod(testName).getDeclaringClass() != clazz) { while (clazz.getMethod(testName).getDeclaringClass() != clazz) {
@ -120,7 +159,7 @@ public class TestSourceReader {
} else { } else {
if (!line.startsWith("@") && content.length() > 0) { if (!line.startsWith("@") && content.length() > 0) {
contents.add(content); contents.add(content);
if (sections > 0 && contents.size() == sections + 1) if (numSections > 0 && contents.size() == numSections + 1)
contents.remove(0); contents.remove(0);
content = new StringBuilder(); content = new StringBuilder();
} }

View file

@ -25,6 +25,7 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICResourceDescription; import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager; import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager;
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer; import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
@ -39,6 +40,29 @@ import org.eclipse.core.runtime.IPath;
* @since 5.4 * @since 5.4
*/ */
public class LanguageSettingsManager { public class LanguageSettingsManager {
/**
* Returns the list of setting entries of a certain kind (such as include paths)
* for the given configuration description, resource and language. This is a
* combined list for all providers taking into account settings of parent folder
* if settings for the given resource are not defined. For include paths both
* local (#include "...") and system (#include <...>) entries are returned.
*
* @param cfgDescription - configuration description.
* @param rc - resource such as file or folder.
* @param languageId - language id.
* @param kind - kind of language settings entries, such as
* {@link ICSettingEntry#INCLUDE_PATH} etc. This is a binary flag
* and it is possible to specify composite kind.
* Use {@link ICSettingEntry#ALL} to get all kinds.
*
* @return the list of setting entries.
*
* @since 5.5
*/
public static List<ICLanguageSettingEntry> getSettingEntriesByKind(ICConfigurationDescription cfgDescription, IResource rc, String languageId, int kind) {
return LanguageSettingsProvidersSerializer.getSettingEntriesByKind(cfgDescription, rc, languageId, kind);
}
/** /**
* Returns the list of setting entries of the given provider * Returns the list of setting entries of the given provider
* for the given configuration description, resource and language. * for the given configuration description, resource and language.

View file

@ -13,10 +13,13 @@
package org.eclipse.cdt.core.model; package org.eclipse.cdt.core.model;
import java.net.URI; import java.net.URI;
import java.util.List;
import org.eclipse.cdt.core.CCProjectNature; import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CProjectNature; import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
import org.eclipse.cdt.core.resources.IPathEntryStore; import org.eclipse.cdt.core.resources.IPathEntryStore;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSetting; import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
@ -1253,6 +1256,19 @@ public class CoreModel {
if(!mngr.isNewStyleCfg(indexCfg)){ if(!mngr.isNewStyleCfg(indexCfg)){
return oldIsScannerInformationEmpty(resource); return oldIsScannerInformationEmpty(resource);
} }
if (indexCfg instanceof ILanguageSettingsProvidersKeeper) {
List<String> languageIds = LanguageSettingsManager.getLanguages(resource, indexCfg);
for (String langId : languageIds) {
List<ICLanguageSettingEntry> entries = LanguageSettingsManager.getSettingEntriesByKind(indexCfg, resource, langId,
ICSettingEntry.INCLUDE_PATH | ICSettingEntry.MACRO | ICSettingEntry.INCLUDE_FILE | ICSettingEntry.MACRO_FILE);
if (!(entries == null || entries.isEmpty())) {
return false;
}
}
return true;
} else {
ICLanguageSetting lSetting = indexCfg.getLanguageSettingForFile(resource.getProjectRelativePath(), false); ICLanguageSetting lSetting = indexCfg.getLanguageSettingForFile(resource.getProjectRelativePath(), false);
if(lSetting != null && lSetting instanceof CLanguageSettingCache){ if(lSetting != null && lSetting instanceof CLanguageSettingCache){
if(!((CLanguageSettingCache)lSetting).containsDiscoveredScannerInfo()) if(!((CLanguageSettingCache)lSetting).containsDiscoveredScannerInfo())
@ -1277,6 +1293,7 @@ public class CoreModel {
} }
} }
} }
}
return true; return true;
} }

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.core.settings.model;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor; import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor;
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData; import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider; import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider;
@ -369,12 +370,16 @@ public interface ICConfigurationDescription extends ICSettingContainer, ICSettin
boolean isPreferenceConfiguration(); boolean isPreferenceConfiguration();
/** /**
* Convenience method to return a language setting for the file * @deprecated Deprecated as of CDT 8.1. This method returns settings supplied by MBS only.
* with the specified project-relative path * For most cases, more generic Language Settings Providers mechanism should be used instead, see
* {@link LanguageSettingsManager#getSettingEntriesByKind(ICConfigurationDescription, org.eclipse.core.resources.IResource, String, int)}.
*
* Convenience method to return a language setting for the file with the specified project-relative path.
* *
* @param path - file project relative path * @param path - file project relative path
* @return ICLanguageSetting or null if not found * @return ICLanguageSetting or null if not found
*/ */
@Deprecated
ICLanguageSetting getLanguageSettingForFile(IPath path, boolean ignoreExludeStatus); ICLanguageSetting getLanguageSettingForFile(IPath path, boolean ignoreExludeStatus);
/** /**

View file

@ -1555,7 +1555,7 @@ public class LanguageSettingsProvidersSerializer {
for (ICLanguageSettingEntry entry : providerEntries) { for (ICLanguageSettingEntry entry : providerEntries) {
if (entry != null) { if (entry != null) {
String entryName = entry.getName(); String entryName = entry.getName();
boolean isRightKind = checkBit(entry.getKind(), kind); boolean isRightKind = checkBit(kind, entry.getKind());
// Only first entry is considered // Only first entry is considered
// Entry flagged as "UNDEFINED" prevents adding entry with the same name down the line // Entry flagged as "UNDEFINED" prevents adding entry with the same name down the line
if (isRightKind && !alreadyAdded.contains(entryName)) { if (isRightKind && !alreadyAdded.contains(entryName)) {

View file

@ -183,7 +183,8 @@ public class ASTTypeUtil {
if (val != null) { if (val != null) {
buf.append(val.getSignature()); buf.append(val.getSignature());
} else { } else {
appendType(arg.getTypeValue(), normalize, buf); IType type = normalize ? arg.getTypeValue() : arg.getOriginalTypeValue();
appendType(type, normalize, buf);
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others. * Copyright (c) 2008, 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
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp; package org.eclipse.cdt.core.dom.ast.cpp;
@ -40,9 +41,17 @@ public interface ICPPTemplateArgument {
* If this is a type value (suitable for a template type and template template parameters), * If this is a type value (suitable for a template type and template template parameters),
* the type used as a value is returned. * the type used as a value is returned.
* For non-type values, <code>null</code> is returned. * For non-type values, <code>null</code> is returned.
* The returned type has all typedefs resolved.
*/ */
IType getTypeValue(); IType getTypeValue();
/**
* Similar to {@link #getTypeValue()} but returns the original type value before typedef
* resolution.
* @since 5.5
*/
IType getOriginalTypeValue();
/** /**
* If this is a non-type value (suitable for a template non-type parameters), * If this is a non-type value (suitable for a template non-type parameters),
* the evaluation object is returned. * the evaluation object is returned.

View file

@ -48,6 +48,11 @@ public class CPPTemplateNonTypeArgument implements ICPPTemplateArgument {
return false; return false;
} }
@Override
public IType getOriginalTypeValue() {
return null;
}
@Override @Override
public boolean isNonTypeValue() { public boolean isNonTypeValue() {
return true; return true;

View file

@ -22,10 +22,17 @@ import org.eclipse.core.runtime.Assert;
*/ */
public class CPPTemplateTypeArgument implements ICPPTemplateArgument { public class CPPTemplateTypeArgument implements ICPPTemplateArgument {
private final IType fType; private final IType fType;
private final IType fOriginalType;
public CPPTemplateTypeArgument(IType type) { public CPPTemplateTypeArgument(IType type) {
Assert.isNotNull(type); this(type, type);
fType= type; }
public CPPTemplateTypeArgument(IType simplifiedType, IType originalType) {
Assert.isNotNull(simplifiedType);
Assert.isNotNull(originalType);
fType= simplifiedType;
fOriginalType= originalType;
} }
@Override @Override
@ -43,6 +50,11 @@ public class CPPTemplateTypeArgument implements ICPPTemplateArgument {
return fType; return fType;
} }
@Override
public IType getOriginalTypeValue() {
return fOriginalType;
}
@Override @Override
public ICPPEvaluation getNonTypeEvaluation() { public ICPPEvaluation getNonTypeEvaluation() {
return null; return null;

View file

@ -174,8 +174,8 @@ public class CPPTemplates {
private static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args, private static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args,
boolean isDefinition, boolean isExplicitSpecialization, IASTNode point) { boolean isDefinition, boolean isExplicitSpecialization, IASTNode point) {
try { try {
// Add default arguments, if necessary.
ICPPTemplateArgument[] arguments= SemanticUtil.getSimplifiedArguments(args); ICPPTemplateArgument[] arguments= SemanticUtil.getSimplifiedArguments(args);
// Add default arguments, if necessary.
arguments= addDefaultArguments(template, arguments, point); arguments= addDefaultArguments(template, arguments, point);
if (arguments == null) if (arguments == null)
return createProblem(template, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, point); return createProblem(template, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, point);
@ -208,7 +208,7 @@ public class CPPTemplates {
} }
if (i < numArgs) { if (i < numArgs) {
ICPPTemplateArgument arg= arguments[i]; ICPPTemplateArgument arg= arguments[i];
ICPPTemplateArgument newArg = CPPTemplates.matchTemplateParameterAndArgument(param, arg, map, point); ICPPTemplateArgument newArg = matchTemplateParameterAndArgument(param, arg, map, point);
if (newArg == null) if (newArg == null)
return createProblem(template, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, point); return createProblem(template, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, point);
if (newArg != arg) { if (newArg != arg) {
@ -239,7 +239,7 @@ public class CPPTemplates {
return prim; return prim;
if (!isExplicitSpecialization) { if (!isExplicitSpecialization) {
IBinding result= CPPTemplates.selectSpecialization(template, arguments, isDefinition, point); IBinding result= selectSpecialization(template, arguments, isDefinition, point);
if (result != null) if (result != null)
return result; return result;
} }
@ -314,7 +314,7 @@ public class CPPTemplates {
} }
IBinding owner= template.getOwner(); IBinding owner= template.getOwner();
instance = CPPTemplates.createInstance(owner, template, map, arguments, point); instance = createInstance(owner, template, map, arguments, point);
addInstance(template, arguments, instance); addInstance(template, arguments, instance);
return instance; return instance;
} }
@ -354,7 +354,7 @@ public class CPPTemplates {
} }
IBinding owner= template.getOwner(); IBinding owner= template.getOwner();
instance = CPPTemplates.createInstance(owner, template, map, arguments, point); instance = createInstance(owner, template, map, arguments, point);
addInstance(template, arguments, instance); addInstance(template, arguments, instance);
return instance; return instance;
} }
@ -423,7 +423,7 @@ public class CPPTemplates {
if (tpars[tparCount - 1].isParameterPack()) if (tpars[tparCount - 1].isParameterPack())
return arguments; return arguments;
if (havePackExpansion && tparCount+1 == argCount) if (havePackExpansion && tparCount + 1 == argCount)
return arguments; return arguments;
return null; return null;
} }
@ -476,7 +476,7 @@ public class CPPTemplates {
if (ct instanceof ICPPClassTemplatePartialSpecialization) { if (ct instanceof ICPPClassTemplatePartialSpecialization) {
args= ((ICPPClassTemplatePartialSpecialization) ct).getTemplateArguments(); args= ((ICPPClassTemplatePartialSpecialization) ct).getTemplateArguments();
} else { } else {
args = CPPTemplates.templateParametersAsArguments(ct.getTemplateParameters()); args = templateParametersAsArguments(ct.getTemplateParameters());
} }
return new CPPDeferredClassInstance(ct, args, (ICPPScope) ct.getCompositeScope()); return new CPPDeferredClassInstance(ct, args, (ICPPScope) ct.getCompositeScope());
} }
@ -741,7 +741,7 @@ public class CPPTemplates {
} else if (template instanceof ICPPFunction) { } else if (template instanceof ICPPFunction) {
ICPPFunction func= (ICPPFunction) template; ICPPFunction func= (ICPPFunction) template;
ICPPClassSpecialization within = getSpecializationContext(owner); ICPPClassSpecialization within = getSpecializationContext(owner);
ICPPFunctionType type= (ICPPFunctionType) CPPTemplates.instantiateType(func.getType(), tpMap, -1, within, point); ICPPFunctionType type= (ICPPFunctionType) instantiateType(func.getType(), tpMap, -1, within, point);
IType[] exceptionSpecs= instantiateTypes(func.getExceptionSpecification(), tpMap, -1, within, point); IType[] exceptionSpecs= instantiateTypes(func.getExceptionSpecification(), tpMap, -1, within, point);
if (owner instanceof ICPPClassType && template instanceof ICPPMethod) { if (owner instanceof ICPPClassType && template instanceof ICPPMethod) {
if (template instanceof ICPPConstructor) { if (template instanceof ICPPConstructor) {
@ -766,7 +766,7 @@ public class CPPTemplates {
ICPPClassTemplate template= pspec.getPrimaryClassTemplate(); ICPPClassTemplate template= pspec.getPrimaryClassTemplate();
ICPPTemplateArgument[] args = pspec.getTemplateArguments(); ICPPTemplateArgument[] args = pspec.getTemplateArguments();
template= (ICPPClassTemplate) owner.specializeMember(template, point); template= (ICPPClassTemplate) owner.specializeMember(template, point);
args= CPPTemplates.instantiateArguments(args, tpMap, -1, within, point); args= instantiateArguments(args, tpMap, -1, within, point);
spec= new CPPClassTemplatePartialSpecializationSpecialization(pspec, tpMap, template, args); spec= new CPPClassTemplatePartialSpecializationSpecialization(pspec, tpMap, template, args);
} catch (DOMException e) { } catch (DOMException e) {
} }
@ -782,13 +782,13 @@ public class CPPTemplates {
} else if (decl instanceof ICPPField) { } else if (decl instanceof ICPPField) {
final ICPPClassSpecialization within = getSpecializationContext(owner); final ICPPClassSpecialization within = getSpecializationContext(owner);
ICPPField field= (ICPPField) decl; ICPPField field= (ICPPField) decl;
IType type= CPPTemplates.instantiateType(field.getType(), tpMap, -1, within, point); IType type= instantiateType(field.getType(), tpMap, -1, within, point);
IValue value= CPPTemplates.instantiateValue(field.getInitialValue(), tpMap, -1, within, Value.MAX_RECURSION_DEPTH, point); IValue value= instantiateValue(field.getInitialValue(), tpMap, -1, within, Value.MAX_RECURSION_DEPTH, point);
spec = new CPPFieldSpecialization(decl, owner, tpMap, type, value); spec = new CPPFieldSpecialization(decl, owner, tpMap, type, value);
} else if (decl instanceof ICPPFunction) { } else if (decl instanceof ICPPFunction) {
ICPPFunction func= (ICPPFunction) decl; ICPPFunction func= (ICPPFunction) decl;
ICPPClassSpecialization within = getSpecializationContext(owner); ICPPClassSpecialization within = getSpecializationContext(owner);
ICPPFunctionType type= (ICPPFunctionType) CPPTemplates.instantiateType(func.getType(), tpMap, -1, within, point); ICPPFunctionType type= (ICPPFunctionType) instantiateType(func.getType(), tpMap, -1, within, point);
IType[] exceptionSpecs= instantiateTypes(func.getExceptionSpecification(), tpMap, -1, within, point); IType[] exceptionSpecs= instantiateTypes(func.getExceptionSpecification(), tpMap, -1, within, point);
if (decl instanceof ICPPFunctionTemplate) { if (decl instanceof ICPPFunctionTemplate) {
@ -808,7 +808,7 @@ public class CPPTemplates {
spec = new CPPFunctionSpecialization((ICPPFunction) decl, oldOwner, tpMap, type, exceptionSpecs); spec = new CPPFunctionSpecialization((ICPPFunction) decl, oldOwner, tpMap, type, exceptionSpecs);
} }
} else if (decl instanceof ITypedef) { } else if (decl instanceof ITypedef) {
IType type= CPPTemplates.instantiateType(((ITypedef) decl).getType(), tpMap, -1, getSpecializationContext(owner), point); IType type= instantiateType(((ITypedef) decl).getType(), tpMap, -1, getSpecializationContext(owner), point);
spec = new CPPTypedefSpecialization(decl, owner, tpMap, type); spec = new CPPTypedefSpecialization(decl, owner, tpMap, type);
} else if (decl instanceof IEnumeration || decl instanceof IEnumerator) { } else if (decl instanceof IEnumeration || decl instanceof IEnumerator) {
// TODO(sprigogin): Deal with a case when an enumerator value depends on a template parameter. // TODO(sprigogin): Deal with a case when an enumerator value depends on a template parameter.
@ -820,7 +820,7 @@ public class CPPTemplates {
for (IBinding delegate : delegates) { for (IBinding delegate : delegates) {
try { try {
if (delegate instanceof ICPPUnknownBinding) { if (delegate instanceof ICPPUnknownBinding) {
delegate= CPPTemplates.resolveUnknown((ICPPUnknownBinding) delegate, tpMap, -1, within, point); delegate= resolveUnknown((ICPPUnknownBinding) delegate, tpMap, -1, within, point);
} }
if (delegate instanceof CPPFunctionSet) { if (delegate instanceof CPPFunctionSet) {
for (IBinding b : ((CPPFunctionSet) delegate).getBindings()) { for (IBinding b : ((CPPFunctionSet) delegate).getBindings()) {
@ -998,12 +998,12 @@ public class CPPTemplates {
System.arraycopy(result, 0, newResult, 0, j); System.arraycopy(result, 0, newResult, 0, j);
result= newResult; result= newResult;
for (int k= 0; k < packSize; k++) { for (int k= 0; k < packSize; k++) {
result[j++]= CPPTemplates.instantiateType(origType, tpMap, k, within, point); result[j++]= instantiateType(origType, tpMap, k, within, point);
} }
continue; continue;
} }
} else { } else {
newType = CPPTemplates.instantiateType(origType, tpMap, packOffset, within, point); newType = instantiateType(origType, tpMap, packOffset, within, point);
} }
if (result != types) { if (result != types) {
result[j++]= newType; result[j++]= newType;
@ -1043,14 +1043,14 @@ public class CPPTemplates {
ICPPTemplateArgument[] newResult= new ICPPTemplateArgument[args.length + resultShift + shift]; ICPPTemplateArgument[] newResult= new ICPPTemplateArgument[args.length + resultShift + shift];
System.arraycopy(result, 0, newResult, 0, i + resultShift); System.arraycopy(result, 0, newResult, 0, i + resultShift);
for (int j= 0; j < packSize; j++) { for (int j= 0; j < packSize; j++) {
newResult[i + resultShift + j]= CPPTemplates.instantiateArgument(origArg, tpMap, j, within, point); newResult[i + resultShift + j]= instantiateArgument(origArg, tpMap, j, within, point);
} }
result= newResult; result= newResult;
resultShift += shift; resultShift += shift;
continue; continue;
} }
} else { } else {
newArg = CPPTemplates.instantiateArgument(origArg, tpMap, packOffset, within, point); newArg = instantiateArgument(origArg, tpMap, packOffset, within, point);
} }
if (result != args) { if (result != args) {
result[i + resultShift]= newArg; result[i + resultShift]= newArg;
@ -1262,7 +1262,7 @@ public class CPPTemplates {
} }
if (arg != null) { if (arg != null) {
IType t= arg.getTypeValue(); IType t= arg.getOriginalTypeValue();
if (t != null) if (t != null)
return t; return t;
} }
@ -1480,7 +1480,7 @@ public class CPPTemplates {
while(true) { while(true) {
ICPPASTTemplateParameter[] pars = tdecl.getTemplateParameters(); ICPPASTTemplateParameter[] pars = tdecl.getTemplateParameters();
for (ICPPASTTemplateParameter par : pars) { for (ICPPASTTemplateParameter par : pars) {
IASTName name= CPPTemplates.getTemplateParameterName(par); IASTName name= getTemplateParameterName(par);
if (name != null) if (name != null)
set.put(name.getLookupKey()); set.put(name.getLookupKey());
} }
@ -2433,14 +2433,14 @@ public class CPPTemplates {
return unknown; return unknown;
IBinding result = unknown; IBinding result = unknown;
IType ot1 = CPPTemplates.instantiateType(ot0, tpMap, packOffset, within, point); IType ot1 = instantiateType(ot0, tpMap, packOffset, within, point);
if (ot1 != null) { if (ot1 != null) {
ot1 = SemanticUtil.getUltimateType(ot1, false); ot1 = SemanticUtil.getUltimateType(ot1, false);
if (ot1 instanceof ICPPUnknownType) { if (ot1 instanceof ICPPUnknownType) {
if (unknown instanceof ICPPUnknownMemberClassInstance) { if (unknown instanceof ICPPUnknownMemberClassInstance) {
ICPPUnknownMemberClassInstance ucli= (ICPPUnknownMemberClassInstance) unknown; ICPPUnknownMemberClassInstance ucli= (ICPPUnknownMemberClassInstance) unknown;
ICPPTemplateArgument[] args0 = ucli.getArguments(); ICPPTemplateArgument[] args0 = ucli.getArguments();
ICPPTemplateArgument[] args1 = CPPTemplates.instantiateArguments(args0, tpMap, packOffset, within, point); ICPPTemplateArgument[] args1 = instantiateArguments(args0, tpMap, packOffset, within, point);
if (args0 != args1 || !ot1.isSameType(ot0)) { if (args0 != args1 || !ot1.isSameType(ot0)) {
args1= SemanticUtil.getSimplifiedArguments(args1); args1= SemanticUtil.getSimplifiedArguments(args1);
result= new CPPUnknownClassInstance(ot1, ucli.getNameCharArray(), args1); result= new CPPUnknownClassInstance(ot1, ucli.getNameCharArray(), args1);
@ -2457,7 +2457,7 @@ public class CPPTemplates {
if (s != null) { if (s != null) {
result= CPPSemantics.resolveUnknownName(s, unknown, point); result= CPPSemantics.resolveUnknownName(s, unknown, point);
if (unknown instanceof ICPPUnknownMemberClassInstance && result instanceof ICPPTemplateDefinition) { if (unknown instanceof ICPPUnknownMemberClassInstance && result instanceof ICPPTemplateDefinition) {
ICPPTemplateArgument[] args1 = CPPTemplates.instantiateArguments( ICPPTemplateArgument[] args1 = instantiateArguments(
((ICPPUnknownMemberClassInstance) unknown).getArguments(), tpMap, packOffset, within, point); ((ICPPUnknownMemberClassInstance) unknown).getArguments(), tpMap, packOffset, within, point);
if (result instanceof ICPPClassTemplate) { if (result instanceof ICPPClassTemplate) {
result = instantiate((ICPPClassTemplate) result, args1, point); result = instantiate((ICPPClassTemplate) result, args1, point);
@ -2477,7 +2477,7 @@ public class CPPTemplates {
ICPPTemplateArgument[] arguments = dci.getTemplateArguments(); ICPPTemplateArgument[] arguments = dci.getTemplateArguments();
ICPPTemplateArgument[] newArgs; ICPPTemplateArgument[] newArgs;
try { try {
newArgs = CPPTemplates.instantiateArguments(arguments, tpMap, packOffset, within, point); newArgs = instantiateArguments(arguments, tpMap, packOffset, within, point);
} catch (DOMException e) { } catch (DOMException e) {
return e.getProblem(); return e.getProblem();
} }

View file

@ -13,6 +13,8 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE; import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;
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 org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression;
@ -126,15 +128,6 @@ public class EvalID extends CPPEvaluation {
@Override @Override
public IValue getValue(IASTNode point) { public IValue getValue(IASTNode point) {
// Name lookup is not needed here because it was already done in the "instantiate" method. // Name lookup is not needed here because it was already done in the "instantiate" method.
// IBinding nameOwner = fNameOwner;
// if (nameOwner == null && fFieldOwner != null)
// nameOwner = (IBinding) fFieldOwner.getTypeOrFunctionSet(point);
//
// if (nameOwner instanceof ICPPClassType) {
// ICPPEvaluation eval = resolveName((ICPPClassType) nameOwner, fTemplateArgs, point);
// if (eval != null)
// return eval.getValue(point);
// }
return Value.create(this); return Value.create(this);
} }
@ -294,7 +287,7 @@ public class EvalID extends CPPEvaluation {
} else if (nameOwner instanceof IType) { } else if (nameOwner instanceof IType) {
IType type = CPPTemplates.instantiateType((IType) nameOwner, tpMap, packOffset, within, point); IType type = CPPTemplates.instantiateType((IType) nameOwner, tpMap, packOffset, within, point);
if (type instanceof IBinding) if (type instanceof IBinding)
nameOwner = (IBinding) type; nameOwner = (IBinding) getNestedType(type, TDEF);
} }
if (fieldOwner instanceof IProblemBinding || nameOwner instanceof IProblemBinding) if (fieldOwner instanceof IProblemBinding || nameOwner instanceof IProblemBinding)

View file

@ -515,7 +515,7 @@ public class SemanticUtil {
final IType type= arg.getTypeValue(); final IType type= arg.getTypeValue();
final IType newType= getSimplifiedType(type); final IType newType= getSimplifiedType(type);
if (newType != type) { if (newType != type) {
return new CPPTemplateTypeArgument(newType); return new CPPTemplateTypeArgument(newType, arg.getOriginalTypeValue());
} }
} }
return arg; return arg;

View file

@ -678,11 +678,12 @@ public class TemplateArgumentDeduction {
return tval.equals(sval); return tval.equals(sval);
} }
return fromType(p.getTypeValue(), a.getTypeValue(), false, point); return fromType(p.getTypeValue(), a.getOriginalTypeValue(), false, point);
} }
private boolean fromType(IType p, IType a, boolean allowCVQConversion, IASTNode point) throws DOMException { private boolean fromType(IType p, IType a, boolean allowCVQConversion, IASTNode point) throws DOMException {
while (p != null) { while (p != null) {
IType argumentTypeBeforeTypedefResolution = a;
while (a instanceof ITypedef) while (a instanceof ITypedef)
a = ((ITypedef) a).getType(); a = ((ITypedef) a).getType();
if (p instanceof IBasicType) { if (p instanceof IBasicType) {
@ -775,7 +776,7 @@ public class TemplateArgumentDeduction {
} }
if (a == null) if (a == null)
return false; return false;
return deduce(((ICPPTemplateParameter)p).getParameterID(), new CPPTemplateTypeArgument(a)); return deduce(((ICPPTemplateParameter) p).getParameterID(), new CPPTemplateTypeArgument(a, argumentTypeBeforeTypedefResolution));
} else if (p instanceof ICPPTemplateInstance) { } else if (p instanceof ICPPTemplateInstance) {
if (!(a instanceof ICPPTemplateInstance)) if (!(a instanceof ICPPTemplateInstance))
return false; return false;

View file

@ -276,10 +276,11 @@ public class ASTCommenter {
} }
private static <T extends IASTNode> T getNextNodeInTu(Iterator<T> iter) { private static <T extends IASTNode> T getNextNodeInTu(Iterator<T> iter) {
if (!iter.hasNext()) { while (iter.hasNext()) {
T next = iter.next();
if (next.isPartOfTranslationUnitFile())
return next;
}
return null; return null;
} }
T next = iter.next();
return next.isPartOfTranslationUnitFile() ? next : getNextNodeInTu(iter);
}
} }

View file

@ -225,10 +225,11 @@ public class PDOM extends PlatformObject implements IPDOM {
* 133.0 - Storing template arguments via direct marshalling, bug 299911. * 133.0 - Storing template arguments via direct marshalling, bug 299911.
* 134.0 - Storing unknown bindings via direct marshalling, bug 381824. * 134.0 - Storing unknown bindings via direct marshalling, bug 381824.
* 135.0 - Changed marshalling of EvalUnary, bug 391001. * 135.0 - Changed marshalling of EvalUnary, bug 391001.
* 136.0 - Extended CPPTemplateTypeArgument to include the original type, bug 392278.
*/ */
private static final int MIN_SUPPORTED_VERSION= version(135, 0); private static final int MIN_SUPPORTED_VERSION= version(136, 0);
private static final int MAX_SUPPORTED_VERSION= version(135, Short.MAX_VALUE); private static final int MAX_SUPPORTED_VERSION= version(136, Short.MAX_VALUE);
private static final int DEFAULT_VERSION = version(135, 0); private static final int DEFAULT_VERSION = version(136, 0);
private static int version(int major, int minor) { private static int version(int major, int minor) {
return (major << 16) + minor; return (major << 16) + minor;

View file

@ -190,6 +190,7 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
arg.getNonTypeEvaluation().marshal(this, true); arg.getNonTypeEvaluation().marshal(this, true);
} else { } else {
marshalType(arg.getTypeValue()); marshalType(arg.getTypeValue());
marshalType(arg.getOriginalTypeValue());
} }
} }
@ -200,7 +201,9 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
return new CPPTemplateNonTypeArgument((ICPPEvaluation) unmarshalEvaluation(), null); return new CPPTemplateNonTypeArgument((ICPPEvaluation) unmarshalEvaluation(), null);
} else { } else {
fPos--; fPos--;
return new CPPTemplateTypeArgument(unmarshalType()); IType type = unmarshalType();
IType originalType = unmarshalType();
return new CPPTemplateTypeArgument(type, originalType);
} }
} }

View file

@ -22,7 +22,6 @@ import org.eclipse.core.runtime.CoreException;
/** /**
* @author Doug Schaefer * @author Doug Schaefer
*
*/ */
class PDOMCPPField extends PDOMCPPVariable implements ICPPField { class PDOMCPPField extends PDOMCPPVariable implements ICPPField {
@ -35,13 +34,11 @@ class PDOMCPPField extends PDOMCPPVariable implements ICPPField {
super(linkage, bindingRecord); super(linkage, bindingRecord);
} }
// @Override
@Override @Override
protected int getRecordSize() { protected int getRecordSize() {
return RECORD_SIZE; return RECORD_SIZE;
} }
// @Override
@Override @Override
public int getNodeType() { public int getNodeType() {
return IIndexCPPBindingConstants.CPPFIELD; return IIndexCPPBindingConstants.CPPFIELD;
@ -57,33 +54,28 @@ class PDOMCPPField extends PDOMCPPVariable implements ICPPField {
return PDOMCPPAnnotation.getVisibility(getByte(record + ANNOTATIONS)); return PDOMCPPAnnotation.getVisibility(getByte(record + ANNOTATIONS));
} }
// @Override
@Override @Override
public boolean isMutable() { public boolean isMutable() {
return getBit(getByte(record + ANNOTATIONS), PDOMCPPAnnotation.MUTABLE_OFFSET); return getBit(getByte(record + ANNOTATIONS), PDOMCPPAnnotation.MUTABLE_OFFSET);
} }
// @Override
@Override @Override
public boolean isAuto() { public boolean isAuto() {
// ISO/IEC 14882:2003 9.2.6 // ISO/IEC 14882:2003 9.2.6
return false; return false;
} }
// @Override
@Override @Override
public boolean isExtern() { public boolean isExtern() {
// ISO/IEC 14882:2003 9.2.6 // ISO/IEC 14882:2003 9.2.6
return false; return false;
} }
// @Override
@Override @Override
public boolean isExternC() { public boolean isExternC() {
return false; return false;
} }
// @Override
@Override @Override
public boolean isRegister() { public boolean isRegister() {
// ISO/IEC 14882:2003 9.2.6 // ISO/IEC 14882:2003 9.2.6

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2011 QNX Software Systems and others. * Copyright (c) 2000, 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
@ -14,12 +14,20 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core; package org.eclipse.cdt.core;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
/** /**
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients. * @noinstantiate This class is not intended to be instantiated by clients.
*/ */
public class CCorePreferenceConstants { public class CCorePreferenceConstants {
/** /**
* <pre> * <pre>
* RECOGNIZED OPTIONS: * RECOGNIZED OPTIONS:
@ -166,4 +174,97 @@ public class CCorePreferenceConstants {
public static final String PREF_BUILD_CONFIGS_RESOURCE_CHANGES = "build.proj.ref.configs.enabled"; //$NON-NLS-1$ public static final String PREF_BUILD_CONFIGS_RESOURCE_CHANGES = "build.proj.ref.configs.enabled"; //$NON-NLS-1$
/**
* Returns the node in the preference in the given context.
* @param key The preference key.
* @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing {@code null} should
* be avoided.
* @return Returns the node matching the given context.
*/
private static IEclipsePreferences getPreferenceNode(String key, ICProject project) {
IEclipsePreferences node = null;
if (project != null) {
node = new ProjectScope(project.getProject()).getNode(CCorePlugin.PLUGIN_ID);
if (node.get(key, null) != null) {
return node;
}
}
node = InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
if (node.get(key, null) != null) {
return node;
}
node = ConfigurationScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
if (node.get(key, null) != null) {
return node;
}
return DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
}
/**
* Returns the string value for the given key in the given context.
* @param key The preference key
* @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @return Returns the current value for the string.
* @since 5.5
*/
public static String getPreference(String key, ICProject project) {
return getPreference(key, project, null);
}
/**
* Returns the string value for the given key in the given context.
* @param key The preference key
* @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value of the preference.
* @since 5.5
*/
public static String getPreference(String key, ICProject project, String defaultValue) {
return getPreferenceNode(key, project).get(key, defaultValue);
}
/**
* Returns the integer value for the given key in the given context.
* @param key The preference key
* @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value of the preference.
* @since 5.5
*/
public static int getPreference(String key, ICProject project, int defaultValue) {
return getPreferenceNode(key, project).getInt(key, defaultValue);
}
/**
* Returns the boolean value for the given key in the given context.
* @param key The preference key
* @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value of the preference.
* @since 5.5
*/
public static boolean getPreference(String key, ICProject project, boolean defaultValue) {
return getPreferenceNode(key, project).getBoolean(key, defaultValue);
}
/**
* Returns the scopes for preference lookup.
*
* @param project a project or {@code null}
* @return the scopes for preference lookup.
* @since 5.5
*/
public static IScopeContext[] getPreferenceScopes(IProject project) {
return project != null ?
new IScopeContext[] { new ProjectScope(project), InstanceScope.INSTANCE, ConfigurationScope.INSTANCE, DefaultScope.INSTANCE } :
new IScopeContext[] { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE, DefaultScope.INSTANCE };
}
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2011 Wind River Systems, Inc. and others. * Copyright (c) 2006, 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
@ -1328,7 +1328,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// v.push_back(/*cursor*/); // v.push_back(/*cursor*/);
// } // }
public void testTypedefSpecialization_Bug307818() throws Exception { public void testTypedefSpecialization_Bug307818() throws Exception {
final String[] expected= { "push_back(const vector<int>::value_type & value) : void" }; final String[] expected= { "push_back(const vector<MyType>::value_type & value) : void" };
assertParameterHint(expected); assertParameterHint(expected);
} }

View file

@ -29,6 +29,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.cdt.core.CCorePreferenceConstants;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.ui.text.ICColorConstants; import org.eclipse.cdt.ui.text.ICColorConstants;
@ -2173,9 +2174,8 @@ public class PreferenceConstants {
/** /**
* Returns the node in the preference in the given context. * Returns the node in the preference in the given context.
* @param key The preference key. * @param key The preference key.
* @param project The current context or <code>null</code> if no context is available and * @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing <code>null</code> should * the workspace setting should be taken. Note that passing {@code null} should be avoided.
* be avoided.
* @return Returns the node matching the given context. * @return Returns the node matching the given context.
*/ */
private static IEclipsePreferences getPreferenceNode(String key, ICProject project) { private static IEclipsePreferences getPreferenceNode(String key, ICProject project) {
@ -2203,21 +2203,33 @@ public class PreferenceConstants {
/** /**
* Returns the string value for the given key in the given context. * Returns the string value for the given key in the given context.
* @param key The preference key * @param key The preference key
* @param project The current context or <code>null</code> if no context is available and * @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing <code>null</code> should * the workspace setting should be taken. Note that passing {@code null} should be avoided.
* be avoided.
* @return Returns the current value for the string. * @return Returns the current value for the string.
* @since 5.0 * @since 5.0
*/ */
public static String getPreference(String key, ICProject project) { public static String getPreference(String key, ICProject project) {
return getPreferenceNode(key, project).get(key, null); return getPreference(key, project, null);
}
/**
* Returns the string value for the given key in the given context.
* @param key The preference key
* @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing {@code null} should be avoided.
* @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value of the preference.
* @since 5.5
*/
public static String getPreference(String key, ICProject project, String defaultValue) {
return getPreferenceNode(key, project).get(key, defaultValue);
} }
/** /**
* Returns the integer value for the given key in the given context. * Returns the integer value for the given key in the given context.
* @param key The preference key * @param key The preference key
* @param project The current context or <code>null</code> if no context is available and * @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing <code>null</code> should * the workspace setting should be taken. Note that passing {@code null} should
* be avoided. * be avoided.
* @param defaultValue The default value if not specified in the preferences. * @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value for the string. * @return Returns the current value for the string.
@ -2230,9 +2242,8 @@ public class PreferenceConstants {
/** /**
* Returns the boolean value for the given key in the given context. * Returns the boolean value for the given key in the given context.
* @param key The preference key * @param key The preference key
* @param project The current context or <code>null</code> if no context is available and * @param project The current context or {@code null} if no context is available and
* the workspace setting should be taken. Note that passing <code>null</code> should * the workspace setting should be taken. Note that passing {@code null} should be avoided.
* be avoided.
* @param defaultValue The default value if not specified in the preferences. * @param defaultValue The default value if not specified in the preferences.
* @return Returns the current value for the string. * @return Returns the current value for the string.
* @since 5.1 * @since 5.1
@ -2244,13 +2255,11 @@ public class PreferenceConstants {
/** /**
* Returns the scopes for preference lookup. * Returns the scopes for preference lookup.
* *
* @param project a project or <code>null</code> * @param project a project or {@code null}
* @return the scopes for preference lookup. * @return the scopes for preference lookup.
* @since 5.4 * @since 5.4
*/ */
public static IScopeContext[] getPreferenceScopes(IProject project) { public static IScopeContext[] getPreferenceScopes(IProject project) {
return project != null ? return CCorePreferenceConstants.getPreferenceScopes(project);
new IScopeContext[] { new ProjectScope(project), InstanceScope.INSTANCE, ConfigurationScope.INSTANCE, DefaultScope.INSTANCE } :
new IScopeContext[] { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE, DefaultScope.INSTANCE };
} }
} }

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.build.crossgcc" id="org.eclipse.cdt.build.crossgcc"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.gnu.build.source" id="org.eclipse.cdt.gnu.build.source"
version="0.0.0"/> version="0.0.0"/>

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.launch.remote" id="org.eclipse.cdt.launch.remote"
download-size="0" download-size="0"

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.gdb" id="org.eclipse.cdt.gdb"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.gdb.source" id="org.eclipse.cdt.gdb.source"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.debug.mi.core" id="org.eclipse.cdt.debug.mi.core"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.debug.mi.core.source" id="org.eclipse.cdt.debug.mi.core.source"
download-size="0" download-size="0"

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 121 KiB

View file

@ -79,7 +79,7 @@ specifically when using a <em>GDB (DSF)</em> launcher.
<! -------------------------------------------------------------------------------------------------- > <! -------------------------------------------------------------------------------------------------- >
<tr> <tr>
<td rowspan=5 valign="top" headers="category"><strong>General Behavior</strong></td> <td rowspan=7 valign="top" headers="category"><strong>General Behavior</strong></td>
</tr> </tr>
<tr> <tr>
<td valign="top" headers="option"><strong>Terminate GDB when last process exits</strong></td> <td valign="top" headers="option"><strong>Terminate GDB when last process exits</strong></td>
@ -102,13 +102,31 @@ specifically when using a <em>GDB (DSF)</em> launcher.
When dealing with a large number of threads, this helps focus on the threads being inspected. Obviously, When dealing with a large number of threads, this helps focus on the threads being inspected. Obviously,
this option is only valuable in <em>non-stop</em> mode, where some threads can run while others are stopped.</td> this option is only valuable in <em>non-stop</em> mode, where some threads can run while others are stopped.</td>
</tr> </tr>
<tr>
<td valign="top" headers="option"><strong>Use aggressive breakpoint filtering</strong></td>
<td valign="top" headers="description">When checked, the button "Show Breakpoints Supported by Selected Target"
of the Breakpoints view will only show the breakpoints that affect the currently selected C/C++ debug context
(e.g., thread, process). Otherwise, "Show Breakpoints Supported by Selected Target" will show all breakpoints
that are for any C/C++ target.<p>
<img src="../images/cdt_debug_bp_filter.png" alt="Show Breakpoints Supported by Selected Target button"></td>
</tr>
<tr> <tr>
<td valign="top" headers="option"><strong>Enable GDB traces</strong></td> <td valign="top" headers="option"><strong>Enable GDB traces</strong></td>
<td valign="top" headers="description">When checked, the debug session will produce an additional console which <td valign="top" headers="description">When checked, the debug session will produce an additional console which
will contain all the gdb/mi activity. Basically, this details the interaction between the CDT debugger and GDB. will contain all the gdb/mi activity. Basically, this details the interaction between the CDT debugger and GDB.
This information is often critical when the debugger is not behaving as you expect. Include this console output This information is often critical when the debugger is not behaving as you expect. Include this console output
when submitting a bugzilla report against the CDT debugger. It is recommended to keep this setting enabled at when submitting a bugzilla report against the CDT debugger. It is recommended to keep this setting enabled at
all times, as it does not cause any negative effect.</td> all times, as it does not cause any negative effect.
<p>
Once the number of characters specified by the <em>limit</em> field is reached, older trace lines will be discarded
gradually. This is to avoid these traces consuming too much memory, for very long debug sessions.</td>
</tr>
<tr>
<td valign="top" headers="option"><strong>Display run-time type of variables</strong></td>
<td valign="top" headers="description">When checked, the CDT debugger will show the actual variable type (not the
declared one) in Variables and Expressions views. Not only does this allow to see what is the current run-time
type of a variable, but it allows to access fields that may not be in the base class.
Note that this feature will only work starting with GDB 7.5.</td>
</tr> </tr>
<! -------------------------------------------------------------------------------------------------- > <! -------------------------------------------------------------------------------------------------- >

View file

@ -11,6 +11,7 @@
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536) * Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
* IBM Corporation * IBM Corporation
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences; package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
@ -645,6 +646,16 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
// Need to set layout again. // Need to set layout again.
group2.setLayout(groupLayout); group2.setLayout(groupLayout);
boolField= new BooleanFieldEditor(
IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER,
MessagesForPreferences.GdbDebugPreferencePage_useAggressiveBpFilter,
group2);
boolField.fillIntoGrid(group2, 3);
addField(boolField);
// Need to set layout again.
group2.setLayout(groupLayout);
final IntegerWithBooleanFieldEditor enableGdbTracesField = new IntegerWithBooleanFieldEditor( final IntegerWithBooleanFieldEditor enableGdbTracesField = new IntegerWithBooleanFieldEditor(
IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE, IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE,
IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES, IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES,

View file

@ -10,6 +10,7 @@
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121) * Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536) * Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
* IBM Corporation * IBM Corporation
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences; package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
@ -37,6 +38,9 @@ class MessagesForPreferences extends NLS {
public static String GdbDebugPreferencePage_useInspectorHover_label; public static String GdbDebugPreferencePage_useInspectorHover_label;
/** @since 2.3 */ /** @since 2.3 */
public static String GdbDebugPreferencePage_hideRunningThreads; public static String GdbDebugPreferencePage_hideRunningThreads;
/** @since 2.4 */
public static String GdbDebugPreferencePage_useAggressiveBpFilter;
/** @since 2.2 */ /** @since 2.2 */
public static String GdbDebugPreferencePage_prettyPrinting_label; public static String GdbDebugPreferencePage_prettyPrinting_label;
/** @since 2.2 */ /** @since 2.2 */

View file

@ -10,6 +10,7 @@
# Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121) # Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
# Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536) # Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
# IBM Corporation # IBM Corporation
# Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
############################################################################### ###############################################################################
GdbDebugPreferencePage_Add_button=Add GdbDebugPreferencePage_Add_button=Add
@ -25,7 +26,7 @@ GdbDebugPreferencePage_Command_timeout=Command timeout (ms):
GdbDebugPreferencePage_useInspectorHover_label=Use enhanced debug hover GdbDebugPreferencePage_useInspectorHover_label=Use enhanced debug hover
GdbDebugPreferencePage_hideRunningThreads=Show only suspended threads in the Debug View GdbDebugPreferencePage_hideRunningThreads=Show only suspended threads in the Debug View
GdbDebugPreferencePage_useAggressiveBpFilter=Use aggressive breakpoint filtering
GdbDebugPreferencePage_prettyPrinting_label=Pretty Printing GdbDebugPreferencePage_prettyPrinting_label=Pretty Printing
GdbDebugPreferencePage_enablePrettyPrinting_label1=Enable pretty printers in variable/expression tree GdbDebugPreferencePage_enablePrettyPrinting_label1=Enable pretty printers in variable/expression tree
GdbDebugPreferencePage_enablePrettyPrinting_label2=(Note: requires python-enabled GDB) GdbDebugPreferencePage_enablePrettyPrinting_label2=(Note: requires python-enabled GDB)

View file

@ -0,0 +1,56 @@
/*******************************************************************************
* 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.gdb.internal.ui.viewmodel.breakpoints;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.BreakpointVMProvider;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.RawBreakpointVMNode;
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.ui.viewmodel.VMDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.jface.util.PropertyChangeEvent;
/**
* BreakpointVMNode for GDB which supports aggressive breakpoint filtering.
* @since 2.4
*/
public class GdbBreakpointVMNode extends RawBreakpointVMNode {
public GdbBreakpointVMNode(BreakpointVMProvider provider) {
super(provider);
}
@Override
public int getDeltaFlags(Object event) {
if (event instanceof PropertyChangeEvent) {
String property = ((PropertyChangeEvent)event).getProperty();
if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(property)) {
return IModelDelta.CONTENT;
}
}
return super.getDeltaFlags(event);
}
@Override
public void buildDelta(Object event, VMDelta parent, int nodeOffset, RequestMonitor rm) {
if (event instanceof PropertyChangeEvent) {
String property = ((PropertyChangeEvent)event).getProperty();
if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(property)) {
parent.setFlags(parent.getFlags() | IModelDelta.CONTENT);
rm.done();
return;
}
}
super.buildDelta(event, parent, nodeOffset, rm);
}
}

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008, 2010 Wind River Systems and others. * Copyright (c) 2008, 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,25 +7,43 @@
* *
* Contributors: * Contributors:
* Wind River Systems - initial API and implementation * Wind River Systems - initial API and implementation
* Mikhail Khodjaiants (Mentor), Marc Khouzam (Ericsson)
* - Optionally use aggressive breakpoint filtering (Bug 360735)
* Marc Khouzam (Ericsson) - Add support to display proper breakpoints when dealing
* with a multi-selection in the debug view (Bug 360735)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.breakpoints; package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.breakpoints;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.RejectedExecutionException;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DsfRunnable; import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants; import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.dsf.concurrent.ImmediateCountingRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
import org.eclipse.cdt.dsf.datamodel.DMContexts; import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints; import org.eclipse.cdt.dsf.debug.service.IBreakpoints;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMData;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
import org.eclipse.cdt.dsf.debug.service.IBreakpointsExtension; import org.eclipse.cdt.dsf.debug.service.IBreakpointsExtension;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.BreakpointVMProvider; import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.BreakpointVMProvider;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.RawBreakpointVMNode; import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager; import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
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;
@ -38,8 +56,15 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointUIConstants; import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointUIConstants;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
/** /**
* @since 3.0 * @since 3.0
@ -50,38 +75,109 @@ public class GdbBreakpointVMProvider extends BreakpointVMProvider {
final private DsfServicesTracker fServicesTracker; final private DsfServicesTracker fServicesTracker;
/** Indicator that we should use aggressive breakpoint filtering */
private boolean fUseAggressiveBpFilter = false;
/** PropertyChangeListener to keep track of the PREF_HIDE_RUNNING_THREADS preference */
private IPropertyChangeListener fPropertyChangeListener = new IPropertyChangeListener() {
@Override
public void propertyChange(final PropertyChangeEvent event) {
if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(event.getProperty())) {
fUseAggressiveBpFilter = (Boolean)event.getNewValue();
// Set the property in the presentation context so it can be seen by the vmnode which
// will refresh the view
getPresentationContext().setProperty(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER, fUseAggressiveBpFilter);
}
}
};
public GdbBreakpointVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session) { public GdbBreakpointVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session) {
super(adapter, presentationContext); super(adapter, presentationContext);
fSession = session; fSession = session;
fServicesTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), fSession.getId()); fServicesTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), fSession.getId());
IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
store.addPropertyChangeListener(fPropertyChangeListener);
fUseAggressiveBpFilter = store.getBoolean(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER);
} }
@Override @Override
public void dispose() { public void dispose() {
GdbUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener);
fServicesTracker.dispose(); fServicesTracker.dispose();
super.dispose(); super.dispose();
} }
@Override @Override
protected void calcFileteredBreakpoints(DataRequestMonitor<IBreakpoint[]> rm) { protected void calcFileteredBreakpoints( final DataRequestMonitor<IBreakpoint[]> rm ) {
if (Boolean.TRUE.equals(getPresentationContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION))) { if ( Boolean.TRUE.equals( getPresentationContext().getProperty( IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION ) ) ) {
IBreakpoint[] allBreakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(); if ( fUseAggressiveBpFilter ) {
List<IBreakpoint> filteredBPs = new ArrayList<IBreakpoint>(allBreakpoints.length); // Aggressive filtering of breakpoints. Only return bps that are installed on the target.
for (IBreakpoint bp : allBreakpoints) { ISelection debugContext = getDebugContext();
if (bp instanceof ICBreakpoint && bp.getModelIdentifier().equals(CDebugCorePlugin.PLUGIN_ID)) { if ( debugContext instanceof IStructuredSelection ) {
filteredBPs.add(bp); // Use a set to avoid duplicates
final Set<IBreakpoint> bps = new HashSet<IBreakpoint>();
int count = 0;
final ImmediateCountingRequestMonitor crm = new ImmediateCountingRequestMonitor( rm ) {
@Override
protected void handleSuccess() {
rm.done( bps.toArray( new IBreakpoint[bps.size()] ) );
}
};
for ( Object element : ( (IStructuredSelection)debugContext ).toList() ) {
IBreakpointsTargetDMContext bpContext = null;
IExecutionDMContext execContext = null;
if ( element instanceof IDMVMContext ) {
bpContext = DMContexts.getAncestorOfType( ((IDMVMContext)element).getDMContext(), IBreakpointsTargetDMContext.class );
execContext = DMContexts.getAncestorOfType( ((IDMVMContext)element).getDMContext(), IExecutionDMContext.class );
if ( bpContext != null && fSession.getId().equals( bpContext.getSessionId() ) ) {
count++;
getInstalledBreakpoints( bpContext, execContext, new DataRequestMonitor<Collection<IBreakpoint>>( getExecutor(), crm ) {
@Override
protected void handleCompleted() {
if ( isSuccess() ) {
bps.addAll( getData() );
}
crm.done();
}
} );
} }
} }
rm.setData( filteredBPs.toArray(new IBreakpoint[filteredBPs.size()]) ); }
rm.done();
crm.setDoneCount(count);
} else { } else {
super.calcFileteredBreakpoints(rm); rm.done( new Status(
IStatus.ERROR,
GdbUIPlugin.PLUGIN_ID,
IDsfStatusConstants.INVALID_HANDLE,
"Invalid debug selection", //$NON-NLS-1$
null ) );
}
} else {
// Original behavior of bp filtering. Return all bp of type ICBreakpoint
IBreakpoint[] allBreakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
List<IBreakpoint> filteredBPs = new ArrayList<IBreakpoint>( allBreakpoints.length );
for (IBreakpoint bp : allBreakpoints) {
if ( bp instanceof ICBreakpoint && bp.getModelIdentifier().equals( CDebugCorePlugin.PLUGIN_ID ) ) {
filteredBPs.add( bp );
}
}
rm.done( filteredBPs.toArray( new IBreakpoint[filteredBPs.size()]) );
}
}
else {
super.calcFileteredBreakpoints( rm );
} }
} }
@Override @Override
protected IVMNode createBreakpointVMNode() { protected IVMNode createBreakpointVMNode() {
return new RawBreakpointVMNode(this); return new GdbBreakpointVMNode(this);
} }
@Override @Override
@ -146,4 +242,160 @@ public class GdbBreakpointVMProvider extends BreakpointVMProvider {
rm.done(); rm.done();
} }
} }
private ISelection getDebugContext() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if ( window != null ) {
return DebugUITools.getDebugContextManager().getContextService( window ).getActiveContext();
}
return StructuredSelection.EMPTY;
}
private void getInstalledBreakpoints( final IBreakpointsTargetDMContext targetContext,
final IExecutionDMContext execContext,
final DataRequestMonitor<Collection<IBreakpoint>> rm ) {
try {
fSession.getExecutor().execute( new DsfRunnable() {
@Override
public void run() {
final IBreakpointsExtension bpService = fServicesTracker.getService( IBreakpointsExtension.class );
if ( bpService == null ) {
rm.setStatus( new Status(
IStatus.ERROR,
GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
"Breakpoints service not available", //$NON-NLS-1$
null ) );
rm.done();
return;
}
bpService.getBreakpoints( targetContext, new DataRequestMonitor<IBreakpointDMContext[]>( fSession.getExecutor(), rm ) {
@Override
protected void handleSuccess() {
final MIBreakpointsManager bpManager = fServicesTracker.getService( MIBreakpointsManager.class );
if ( bpManager == null ) {
rm.setStatus( new Status(
IStatus.ERROR,
GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
"Breakpoint manager service not available", //$NON-NLS-1$
null ) );
rm.done();
return;
}
if ( getData().length > 0 ) {
final Set<IBreakpoint> bps = new HashSet<IBreakpoint>( getData().length );
final CountingRequestMonitor crm = new CountingRequestMonitor( ImmediateExecutor.getInstance(), rm ) {
@Override
protected void handleSuccess() {
rm.setData( bps );
rm.done();
}
};
crm.setDoneCount( getData().length );
for ( final IBreakpointDMContext bpCtx : getData() ) {
bpService.getBreakpointDMData(
bpCtx,
new DataRequestMonitor<IBreakpointDMData>( ImmediateExecutor.getInstance(), crm ) {
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.concurrent.RequestMonitor#handleSuccess()
*/
@Override
protected void handleSuccess() {
if ( getData() instanceof MIBreakpointDMData ) {
MIBreakpointDMData data = (MIBreakpointDMData)getData();
if ( !data.isPending() ) {
bpBelongsToContext( execContext, data, new ImmediateDataRequestMonitor<Boolean>(crm) {
@Override
protected void handleSuccess() {
if (getData()) {
IBreakpoint bp = bpManager.findPlatformBreakpoint( bpCtx );
if ( bp != null )
bps.add( bp );
}
crm.done();
}
});
return;
}
}
crm.done();
}
} );
}
}
else {
rm.setData( new HashSet<IBreakpoint>() );
rm.done();
}
}
} );
}
} );
}
catch( RejectedExecutionException e ) {
rm.setStatus( new Status(
IStatus.ERROR,
GdbUIPlugin.PLUGIN_ID,
IDsfStatusConstants.INVALID_STATE,
"Request for monitor: '" + toString() + "' resulted in a rejected execution exception.", e ) ); //$NON-NLS-1$ //$NON-NLS-2$);
rm.done();
}
}
private void bpBelongsToContext( IExecutionDMContext execContext, final MIBreakpointDMData data, final DataRequestMonitor<Boolean> rm ) {
if ( execContext == null ) {
// No execution context so accept all breakpoints
rm.done( true );
return;
}
// First check if a thread is selected as the context. In that case, we only want to show breakpoints that
// are applicable to that thread.
IMIExecutionDMContext threadContext = DMContexts.getAncestorOfType( execContext, IMIExecutionDMContext.class );
if ( threadContext != null ) {
// A thread is selected. Now make sure this breakpoint is assigned to this thread.
if ( data.getThreadId() != null && data.getThreadId().length() > 0 ) {
try {
int bpThreadId = Integer.parseInt( data.getThreadId() );
// A threadId of 0 means all threads of this process. We therefore will have to check
// if this breakpoint applies to the process that is selected. But if the threadId is not 0
// we simply make sure we have the right thread selected.
if ( bpThreadId != 0 ) {
rm.done( threadContext.getThreadId() == bpThreadId );
return;
}
}
catch( NumberFormatException e ) {
assert false;
GdbUIPlugin.getDefault().getLog().log( new Status(
IStatus.ERROR,
GdbUIPlugin.getUniqueIdentifier(),
"Invalid breakpoint thread id" ) ); //$NON-NLS-1$
rm.done( true );
return;
}
}
}
// If we get here it is that the breakpoint is not assigned to a single thread.
// We therefore make sure the breakpoint is applicable to the selected process.
final IMIContainerDMContext containerContext = DMContexts.getAncestorOfType( execContext, IMIContainerDMContext.class );
if ( containerContext != null ) {
if ( data.getGroupIds() != null ) {
List<String> groupIds = Arrays.asList( data.getGroupIds() );
rm.done( groupIds.contains( containerContext.getGroupId() ) );
} else {
// This happens if we are debugging a single process, so all breakpoints apply.
rm.done( true );
}
} else {
// Accept breakpoint
rm.done( true );
}
}
} }

View file

@ -10,6 +10,7 @@
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121) * Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536) * Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb; package org.eclipse.cdt.dsf.gdb;
@ -131,5 +132,19 @@ public interface IGdbDebugPreferenceConstants {
* @since 4.1 * @since 4.1
*/ */
public static final String PREF_HIDE_RUNNING_THREADS = PREFIX + "hideRunningThreads"; //$NON-NLS-1$ public static final String PREF_HIDE_RUNNING_THREADS = PREFIX + "hideRunningThreads"; //$NON-NLS-1$
/**
* Boolean preference whether to use the new behavior of the command
* "Show Breakpoints Supported by Selected Target" from the Breakpoints view.
* The original behavior is to only show breakpoints that apply to the current debug
* session; so all C/C++ breakpoints but not Java ones.
* The new behavior is to only show breakpoints that are actually installed in the current
* debug session.
*
* Default is <code>true</code>.
*
* @since 4.2
*/
public static final String PREF_AGGRESSIVE_BP_FILTER = PREFIX + "aggressiveBpFilter"; //$NON-NLS-1$
} }

View file

@ -11,6 +11,7 @@
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
* Marc Khouzam (Ericsson) - Move to org.eclipse.cdt.dsf.gdb from UI plugin (bug 348159) * Marc Khouzam (Ericsson) - Move to org.eclipse.cdt.dsf.gdb from UI plugin (bug 348159)
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536) * Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal; package org.eclipse.cdt.dsf.gdb.internal;
@ -43,5 +44,6 @@ public class GdbPreferenceInitializer extends AbstractPreferenceInitializer {
node.putBoolean(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, false); node.putBoolean(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, false);
node.putInt(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT); node.putInt(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT);
node.putBoolean(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS, false); node.putBoolean(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS, false);
node.putBoolean(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER, true);
} }
} }

View file

@ -8,7 +8,9 @@
* Contributors: * Contributors:
* Ericsson - Initial API and implementation * Ericsson - Initial API and implementation
* Marc Khouzam (Ericsson) - Support for fast tracepoints (Bug 346320) * Marc Khouzam (Ericsson) - Support for fast tracepoints (Bug 346320)
* Marc Khouzam (Ericsson) - Fetch groupIds when getting breakpoints (Bug 360735)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service; package org.eclipse.cdt.dsf.gdb.service;
import java.util.HashMap; import java.util.HashMap;
@ -27,7 +29,10 @@ import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData; import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints; import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoBreakInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakListInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakpoint;
import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
@ -89,6 +94,73 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
super.shutdown(requestMonitor); super.shutdown(requestMonitor);
} }
/**
* {@inheritDoc}
*
* Starting with GDB 7.2, also provides information about which process each breakpoint applies to.
*/
@Override
public void getBreakpoints(final IBreakpointsTargetDMContext context, final DataRequestMonitor<IBreakpointDMContext[]> drm)
{
// Validate the context
if (context == null) {
drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
drm.done();
return;
}
// Select the breakpoints context map
// If it doesn't exist then no breakpoint was ever inserted for this breakpoint space.
// In that case, return an empty list.
final Map<Integer, MIBreakpointDMData> breakpointContext = getBreakpointMap(context);
if (breakpointContext == null) {
drm.setData(new IBreakpointDMContext[0]);
drm.done();
return;
}
// Execute the command
fConnection.queueCommand(fConnection.getCommandFactory().createMIBreakList(context),
new DataRequestMonitor<MIBreakListInfo>(getExecutor(), drm) {
@Override
protected void handleSuccess() {
final MIBreakpoint[] breakpoints = getData().getMIBreakpoints();
// Also fetch the information about which breakpoint belongs to which
// process. We currently can only obtain this information from the CLI
// command. This information is needed for breakpoint filtering.
// Bug 360735
fConnection.queueCommand(fConnection.getCommandFactory().createCLIInfoBreak(context),
new ImmediateDataRequestMonitor<CLIInfoBreakInfo>(drm) {
@Override
protected void handleSuccess() {
Map<Integer, String[]> groupIdMap = getData().getBreakpointToGroupMap();
// Refresh the breakpoints map and format the result
breakpointContext.clear();
IBreakpointDMContext[] result = new IBreakpointDMContext[breakpoints.length];
for (int i = 0; i < breakpoints.length; i++) {
MIBreakpointDMData breakpointData = new MIBreakpointDMData(breakpoints[i]);
// Now fill in the thread-group information into the breakpoint data
// It is ok to get null. For example, pending breakpoints are not
// associated to a thread-group; also, when debugging a single process,
// the thread-group list is empty.
int reference = breakpointData.getReference();
String[] groupIds = groupIdMap.get(reference);
breakpointData.setGroupIds(groupIds);
result[i] = new MIBreakpointDMContext(GDBBreakpoints_7_2.this, new IDMContext[] { context }, reference);
breakpointContext.put(reference, breakpointData);
}
drm.setData(result);
drm.done();
}
});
}
});
}
private void setTracepointMode() { private void setTracepointMode() {
ILaunch launch = (ILaunch)getSession().getModelAdapter(ILaunch.class); ILaunch launch = (ILaunch)getSession().getModelAdapter(ILaunch.class);
String tpMode = IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT; String tpMode = IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT;

View file

@ -269,6 +269,10 @@ public class MIBreakpointDMData implements IBreakpointDMData {
return fBreakpoint.isEnabled(); return fBreakpoint.isEnabled();
} }
///////////////////////////////////////////////////////////////////////////
// MIBreakpointDMData
///////////////////////////////////////////////////////////////////////////
/** /**
* @since 3.0 * @since 3.0
*/ */
@ -283,10 +287,6 @@ public class MIBreakpointDMData implements IBreakpointDMData {
return fBreakpoint.getCommands(); return fBreakpoint.getCommands();
} }
///////////////////////////////////////////////////////////////////////////
// MIBreakpointDMData
///////////////////////////////////////////////////////////////////////////
public int getNumber() { public int getNumber() {
return fBreakpoint.getNumber(); return fBreakpoint.getNumber();
} }
@ -295,6 +295,16 @@ public class MIBreakpointDMData implements IBreakpointDMData {
return fBreakpoint.getThreadId(); return fBreakpoint.getThreadId();
} }
/** @since 4.2 */
public String[] getGroupIds() {
return fBreakpoint.getGroupIds();
}
/** @since 4.2 */
public void setGroupIds(String[] groups) {
fBreakpoint.setGroupIds(groups);
}
public boolean isTemporary() { public boolean isTemporary() {
return fBreakpoint.isTemporary(); return fBreakpoint.isTemporary();
} }

View file

@ -1408,7 +1408,12 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
*/ */
public IBreakpoint findPlatformBreakpoint(IBreakpointDMContext bpContext) { public IBreakpoint findPlatformBreakpoint(IBreakpointDMContext bpContext) {
if (bpContext instanceof MIBreakpointDMContext) { if (bpContext instanceof MIBreakpointDMContext) {
return findPlatformBreakpoint(((MIBreakpointDMContext)bpContext).getReference()); IBreakpointsTargetDMContext targetCtx = DMContexts.getAncestorOfType(bpContext, IBreakpointsTargetDMContext.class);
if (targetCtx != null) {
Map<IBreakpointDMContext, ICBreakpoint> bps = fTargetBPs.get(targetCtx);
if (bps != null)
return bps.get(bpContext);
}
} }
return null; return null;
} }

View file

@ -43,6 +43,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.CLIAttach;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLICatch; import org.eclipse.cdt.dsf.mi.service.command.commands.CLICatch;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIDetach; import org.eclipse.cdt.dsf.mi.service.command.commands.CLIDetach;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIExecAbort; import org.eclipse.cdt.dsf.mi.service.command.commands.CLIExecAbort;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoBreak;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoProgram; import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoProgram;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoSharedLibrary; import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoSharedLibrary;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoThreads; import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoThreads;
@ -167,6 +168,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarShowAttributes;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarShowFormat; import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarShowFormat;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarUpdate; import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarUpdate;
import org.eclipse.cdt.dsf.mi.service.command.output.CLICatchInfo; import org.eclipse.cdt.dsf.mi.service.command.output.CLICatchInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoBreakInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoProgramInfo; import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoProgramInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoSharedLibraryInfo; import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoSharedLibraryInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoThreadsInfo; import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoThreadsInfo;
@ -241,6 +243,16 @@ public class CommandFactory {
return new CLIExecAbort(ctx); return new CLIExecAbort(ctx);
} }
/** @since 4.2 */
public ICommand<CLIInfoBreakInfo> createCLIInfoBreak(IDMContext ctx) {
return new CLIInfoBreak(ctx);
}
/** @since 4.2 */
public ICommand<CLIInfoBreakInfo> createCLIInfoBreak(IDMContext ctx, int bpRef) {
return new CLIInfoBreak(ctx, bpRef);
}
public ICommand<CLIInfoProgramInfo> createCLIInfoProgram(IContainerDMContext ctx) { public ICommand<CLIInfoProgramInfo> createCLIInfoProgram(IContainerDMContext ctx) {
return new CLIInfoProgram(ctx); return new CLIInfoProgram(ctx);
} }

View file

@ -0,0 +1,43 @@
/*******************************************************************************
* 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.mi.service.command.commands;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoBreakInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
* 'info break [BP_REFERENCE]
*
* will return information about the specified breakpoint. If no breakpoint is
* specified, it will return information about all breakpoints.
* We use it to find out to which inferior a breakpoint is applicable.
* This information is not available from -break-list or -break-info until GDB 7.6.
*
* @since 4.2
*/
public class CLIInfoBreak extends CLICommand<CLIInfoBreakInfo> {
private static final String INFO_BREAK = "info break"; //$NON-NLS-1$
public CLIInfoBreak(IDMContext ctx) {
super(ctx, INFO_BREAK);
};
public CLIInfoBreak(IDMContext ctx, int bpReference) {
super(ctx, INFO_BREAK + Integer.toString(bpReference));
}
@Override
public CLIInfoBreakInfo getResult(MIOutput MIresult) {
return new CLIInfoBreakInfo(MIresult);
}
}

View file

@ -0,0 +1,113 @@
/*******************************************************************************
* 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.mi.service.command.output;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* 'info break [BP_REFERENCE] will return information about
* the specified breakpoint. We use it to find out to which
* inferiors a breakpoint is applicable.
*
* sample output:
*
* (gdb) info break
* Num Type Disp Enb Address What
* 1 breakpoint keep y <MULTIPLE>
* 1.1 y 0x08048533 in main() at loopfirst.cc:8 inf 2
* 1.2 y 0x08048533 in main() at loopfirst.cc:8 inf 1
* 2 breakpoint keep y <MULTIPLE>
* 2.1 y 0x08048553 in main() at loopfirst.cc:9 inf 2
* 2.2 y 0x08048553 in main() at loopfirst.cc:9 inf 1
*
* If only one inferior is being debugged there is not mention of the inferior:
* (gdb) info break
* Num Type Disp Enb Address What
* 1 breakpoint keep y 0x08048533 in main() at loopfirst.cc:8
* 2 breakpoint keep y 0x08048553 in main() at loopfirst.cc:9
*
* Note that the below output is theoretically possible looking at GDB's code but
* I haven't figured out a way to trigger it. Still, we should be prepared for it:
* (gdb) info break
* Num Type Disp Enb Address What
* 1 breakpoint keep y <MULTIPLE>
* 1.1 y 0x08048533 in main() at loopfirst.cc:8 inf 3, 2
* 1.2 y 0x08048533 in main() at loopfirst.cc:8 inf 2, 1
* 2 breakpoint keep y <MULTIPLE>
* 2.1 y 0x08048553 in main() at loopfirst.cc:9 inf 2, 1
* 2.2 y 0x08048553 in main() at loopfirst.cc:9 inf 3, 2, 1
*
* @since 4.2
*/
public class CLIInfoBreakInfo extends MIInfo {
private Map<Integer, String[]> fBreakpointToGroupMap = new HashMap<Integer, String[]>();
public CLIInfoBreakInfo(MIOutput out) {
super(out);
parse();
}
/**
* Returns the map of breakpoint to groupId array indicating to which thread-group
* each breakpoint applies. If there is only a single thread-group being debugged, an
* empty map will be returned.
*/
public Map<Integer, String[]> getBreakpointToGroupMap() {
return fBreakpointToGroupMap;
}
protected void parse() {
final String INFERIOR_PREFIX = " inf "; //$NON-NLS-1$
if (isDone()) {
MIOutput out = getMIOutput();
for (MIOOBRecord oob : out.getMIOOBRecords()) {
if (oob instanceof MIConsoleStreamOutput) {
String line = ((MIConsoleStreamOutput)oob).getString().trim();
int loc = line.indexOf(INFERIOR_PREFIX);
if (loc >= 0) {
// Get the breakpoint id by extracting the first element before a white space
// or before a period. We can set a limit of 2 since we only need the first element
String bpIdStr = line.split("[\\s\\.]", 2)[0]; //$NON-NLS-1$
int bpId = 0;
try {
bpId = Integer.parseInt(bpIdStr);
} catch (NumberFormatException e) {
assert false;
}
String[] groups = fBreakpointToGroupMap.get(bpId);
Set<String> groupIdList = new HashSet<String>();
if (groups != null) {
// Since we already know about this breakpoint id we must retain the list
// we have been building
groupIdList.addAll(Arrays.asList(groups));
}
// Get the comma-separated list of inferiors
// Split the list into individual ids
String inferiorIdStr = line.substring(loc + INFERIOR_PREFIX.length()).trim();
for (String id : inferiorIdStr.split(",")) { //$NON-NLS-1$
// Add the 'i' prefix as GDB does for MI commands
groupIdList.add("i" + id.trim()); //$NON-NLS-1$
}
fBreakpointToGroupMap.put(bpId, groupIdList.toArray(new String[groupIdList.size()]));
}
}
}
}
}
}

View file

@ -11,10 +11,14 @@
* Ericsson - Modified for the breakpoint service * Ericsson - Modified for the breakpoint service
* Ericsson - Added Tracepoint support (284286) * Ericsson - Added Tracepoint support (284286)
* Abeer Bagul (Tensilica) - Differentiate between hw breakpoint and watchpoint * Abeer Bagul (Tensilica) - Differentiate between hw breakpoint and watchpoint
* Marc Khouzam (Ericsson) - Add 'thread-group' field (bug 360735)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output; package org.eclipse.cdt.dsf.mi.service.command.output;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.TracepointActionManager; import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.TracepointActionManager;
@ -105,6 +109,13 @@ public class MIBreakpoint {
*/ */
private boolean pending; private boolean pending;
/**
* The list of groupIds to which this breakpoint applies.
* This field is only reported by MI starting with GDB 7.6.
* null will be returned if this field is not present.
*/
private String[] groupIds;
public MIBreakpoint() { public MIBreakpoint() {
} }
@ -134,6 +145,9 @@ public class MIBreakpoint {
isCatchpoint = other.isCatchpoint; isCatchpoint = other.isCatchpoint;
catchpointType = other.catchpointType; catchpointType = other.catchpointType;
pending = other.pending; pending = other.pending;
if (other.groupIds != null) {
groupIds = Arrays.copyOf(other.groupIds, other.groupIds.length);
}
} }
public MIBreakpoint(MITuple tuple) { public MIBreakpoint(MITuple tuple) {
@ -409,6 +423,25 @@ public class MIBreakpoint {
return pending; return pending;
} }
/**
* Returns the thread-groups to which this breakpoint applies.
* Returns null if the data is not known.
*
* @since 4.2
*/
public String[] getGroupIds() {
return groupIds;
}
/**
* Sets the list of thread-groups to which this breakpoint applies.
*
* @since 4.2
*/
public void setGroupIds(String[] groups) {
groupIds = groups;
}
// Parse the result string // Parse the result string
void parse(MITuple tuple) { void parse(MITuple tuple) {
MIResult[] results = tuple.getMIResults(); MIResult[] results = tuple.getMIResults();
@ -504,6 +537,10 @@ public class MIBreakpoint {
if (value instanceof MITuple) { if (value instanceof MITuple) {
parseCommands((MITuple)value); parseCommands((MITuple)value);
} }
} else if (var.equals("thread-group")) { //$NON-NLS-1$
if (value instanceof MIList) {
parseGroups((MIList)value);
}
} }
} }
} }
@ -524,4 +561,17 @@ public class MIBreakpoint {
setCommands(cmds.toString()); setCommands(cmds.toString());
} }
private void parseGroups(MIList list) {
List<String> groups = new ArrayList<String>();
MIValue[] values = list.getMIValues();
for (int i = 0; i < values.length; i++) {
if (values[i] instanceof MIConst) {
groups.add(((MIConst)values[i]).getCString());
}
}
groupIds = groups.toArray(new String[groups.size()]);
}
} }

View file

@ -8,6 +8,7 @@
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* Ericsson - Adapted for DSF * Ericsson - Adapted for DSF
* Dmitry Kozlov (Mentor) - Add tab symbols parsing (Bug 391115)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output; package org.eclipse.cdt.dsf.mi.service.command.output;
@ -111,6 +112,8 @@ public class MIInstruction extends AbstractInstruction {
translated string since the only thing we are doing is translated string since the only thing we are doing is
displaying it. */ displaying it. */
str = ((MIConst) value).getString(); str = ((MIConst) value).getString();
/* to avoid improper displaying of instructions we need to translate tabs */
str = str.replace("\\t", "\t"); //$NON-NLS-1$ //$NON-NLS-2$
char chars[] = str.toCharArray(); char chars[] = str.toCharArray();
int index = 0; int index = 0;

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.dsf.gdb" id="org.eclipse.cdt.dsf.gdb"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.dsf.gdb.source" id="org.eclipse.cdt.dsf.gdb.source"
download-size="0" download-size="0"

View file

@ -391,8 +391,8 @@ public class DsfMemoryBlock extends PlatformObject implements IMemoryBlockExtens
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
if ( i < newLength ) { if ( i < newLength ) {
newBlock[i].setFlags(fBlock[distance + i].getFlags()); newBlock[i].setFlags(fBlock[distance + i].getFlags());
if (newBlock[i].getValue() != fBlock[distance + i].getValue()) {
newBlock[i].setHistoryKnown(true); newBlock[i].setHistoryKnown(true);
if (newBlock[i].getValue() != fBlock[distance + i].getValue()) {
newBlock[i].setChanged(true); newBlock[i].setChanged(true);
} }
} }
@ -477,8 +477,8 @@ public class DsfMemoryBlock extends PlatformObject implements IMemoryBlockExtens
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
if ( (distance + i) < newLength ) { if ( (distance + i) < newLength ) {
newBlock[distance + i].setFlags(fBlock[i].getFlags()); newBlock[distance + i].setFlags(fBlock[i].getFlags());
if (newBlock[distance + i].getValue() != fBlock[i].getValue()) {
newBlock[distance + i].setHistoryKnown(true); newBlock[distance + i].setHistoryKnown(true);
if (newBlock[distance + i].getValue() != fBlock[i].getValue()) {
newBlock[distance + i].setChanged(true); newBlock[distance + i].setChanged(true);
} }
} }

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.examples.dsf" id="org.eclipse.cdt.examples.dsf"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.gnu.build.source" id="org.eclipse.cdt.gnu.build.source"
version="0.0.0"/> version="0.0.0"/>

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.debug.gdbjtag.core" id="org.eclipse.cdt.debug.gdbjtag.core"
download-size="0" download-size="0"

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="net.sourceforge.lpg.lpgjavaruntime" id="net.sourceforge.lpg.lpgjavaruntime"
download-size="0" download-size="0"

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.core.lrparser.source" id="org.eclipse.cdt.core.lrparser.source"
version="0.0.0"/> version="0.0.0"/>

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.core.lrparser.source" id="org.eclipse.cdt.core.lrparser.source"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.debug.ui.memory.search" id="org.eclipse.cdt.debug.ui.memory.search"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.debug.ui.memory.search.source" id="org.eclipse.cdt.debug.ui.memory.search.source"
download-size="0" download-size="0"

View file

@ -583,11 +583,15 @@ public class Rendering extends Composite implements IDebugEventSetListener
{ {
final int kind = events[i].getKind(); final int kind = events[i].getKind();
final int detail = events[i].getDetail(); final int detail = events[i].getDetail();
final IDebugElement source = (IDebugElement) events[i] final IDebugElement source = (IDebugElement) events[i].getSource();
.getSource(); /*
* We have to make sure we are comparing memory blocks here. It pretty much is now the
if(source.getDebugTarget() == getMemoryBlock() * case that the IDebugTarget is always null. Almost no one in the Embedded Space is
.getDebugTarget()) * using anything but CDT/DSF or CDT/TCF at this point. The older CDI stuff will still
* be using the old Debug Model API. But this will generate the same memory block and
* a legitimate IDebugTarget which will match properly.
*/
if(source.equals( getMemoryBlock() ) && source.getDebugTarget() == getMemoryBlock().getDebugTarget() )
{ {
if((detail & DebugEvent.BREAKPOINT) != 0) if((detail & DebugEvent.BREAKPOINT) != 0)
isBreakpointHit = true; isBreakpointHit = true;

View file

@ -23,17 +23,24 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IMemoryBlock; import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockExtension; import org.eclipse.debug.core.model.IMemoryBlockExtension;
import org.eclipse.debug.core.model.MemoryByte; import org.eclipse.debug.core.model.MemoryByte;
import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.memory.IMemoryBlockConnection; import org.eclipse.debug.internal.ui.memory.IMemoryBlockConnection;
import org.eclipse.debug.internal.ui.memory.provisional.MemoryViewPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;
import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.memory.AbstractMemoryRendering; import org.eclipse.debug.ui.memory.AbstractMemoryRendering;
import org.eclipse.debug.ui.memory.AbstractTableRendering; import org.eclipse.debug.ui.memory.AbstractTableRendering;
import org.eclipse.debug.ui.memory.IMemoryRendering; import org.eclipse.debug.ui.memory.IMemoryRendering;
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer; import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering; import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
import org.eclipse.debug.ui.memory.IResettableMemoryRendering; import org.eclipse.debug.ui.memory.IResettableMemoryRendering;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
@ -86,7 +93,7 @@ import org.eclipse.ui.progress.UIJob;
*/ */
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
public class TraditionalRendering extends AbstractMemoryRendering implements IRepositionableMemoryRendering, IResettableMemoryRendering, IMemoryRenderingViewportProvider public class TraditionalRendering extends AbstractMemoryRendering implements IRepositionableMemoryRendering, IResettableMemoryRendering, IMemoryRenderingViewportProvider, IModelChangedListener
{ {
protected Rendering fRendering; protected Rendering fRendering;
protected Action displayEndianBigAction; protected Action displayEndianBigAction;
@ -188,11 +195,85 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
private int fAddressableSize; private int fAddressableSize;
private int fAddressSize; private int fAddressSize;
/*
* @see org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener#modelChanged(org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta, org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy)
*/
public void modelChanged(IModelDelta delta, IModelProxy proxy)
{
/*
* The event model in the traditional renderer is written to expect a suspend first
* which will cause it to save its current data set away in an archive. Then when
* the state change comes through it will compare and refresh showing a difference.
*/
int flags = delta.getFlags();
if ( ( flags & IModelDelta.STATE ) != 0 ) {
fRendering.handleSuspend(false);
}
fRendering.handleChange();
}
/*
* We use the model proxy which is supplied by the TCF implementation to provide the knowledge of memory
* change notifications. The older backends ( the reference model, Wind River Systems Inc. ) are written
* to generate the Debug Model events. TCF follows the "ModelDelta/IModelProxy" implementation that the
* platform renderers use. So this implementation acts as a shim. If the older Debug Events come in then
* fine. If the newer model deltas come in fine also.
*/
private IModelProxy fModel;
@Override @Override
public void init(IMemoryRenderingContainer container, IMemoryBlock block) public void dispose()
{
/*
* We use the UI dispatch thread to protect the proxy information. Even though I believe the
* dispose routine is always called in the UI dispatch thread. I am going to make sure.
*/
Display.getDefault().asyncExec(new Runnable() {
public void run() {
if ( fModel != null ) {
fModel.removeModelChangedListener(TraditionalRendering.this);
fModel.dispose();
}
}});
if(this.fRendering != null)
this.fRendering.dispose();
disposeColors();
super.dispose();
}
@Override
public void init(final IMemoryRenderingContainer container, final IMemoryBlock block)
{ {
super.init(container, block); super.init(container, block);
/*
* Working with the model proxy must be done on the UI dispatch thread.
*/
final IModelProxyFactory factory = (IModelProxyFactory) DebugPlugin.getAdapter(block, IModelProxyFactory.class );
if ( factory != null ) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
/*
* The asynchronous model assumes we have an asynchronous viewer that has an IPresentationContext
* to represent it. The Platform memory subsystem provides a way to create one without a viewewr.
*/
IMemoryRenderingSite site = container.getMemoryRenderingSite();
MemoryViewPresentationContext context = new MemoryViewPresentationContext(site, container, TraditionalRendering.this);
/*
* Get a new proxy and perform the initialization sequence so we are known the
* the model provider.
*/
fModel = factory.createModelProxy(block, context);
fModel.installed(null);
fModel.addModelChangedListener(TraditionalRendering.this);
}});
}
try try
{ {
fBigBaseAddress = ((IMemoryBlockExtension) block).getBigBaseAddress(); fBigBaseAddress = ((IMemoryBlockExtension) block).getBigBaseAddress();
@ -1236,15 +1317,6 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
fRendering.setDisplayLittleEndian(littleEndian); fRendering.setDisplayLittleEndian(littleEndian);
} }
@Override
public void dispose()
{
if(this.fRendering != null)
this.fRendering.dispose();
disposeColors();
super.dispose();
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class) * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
*/ */

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.platform" id="org.eclipse.cdt.platform"
version="0.0.0"/> version="0.0.0"/>

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt" id="org.eclipse.cdt"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.core.source" id="org.eclipse.cdt.core.source"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.platform.source" id="org.eclipse.cdt.platform.source"
version="0.0.0"/> version="0.0.0"/>

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.debug.ui.tests" id="org.eclipse.cdt.debug.ui.tests"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.testsrunner" id="org.eclipse.cdt.testsrunner"
download-size="0" download-size="0"

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.testsrunner.source" id="org.eclipse.cdt.testsrunner.source"
download-size="0" download-size="0"

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.managedbuilder.bupc.ui" id="org.eclipse.cdt.managedbuilder.bupc.ui"
download-size="0" download-size="0"

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.core.lrparser.feature" id="org.eclipse.cdt.core.lrparser.feature"
version="0.0.0"/> version="0.0.0"/>

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.core.parser.upc.source" id="org.eclipse.cdt.core.parser.upc.source"
version="0.0.0"/> version="0.0.0"/>

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.core.parser.upc.source" id="org.eclipse.cdt.core.parser.upc.source"
download-size="0" download-size="0"

View file

@ -19,10 +19,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.util" id="org.eclipse.cdt.util"
download-size="0" download-size="0"

View file

@ -81,22 +81,31 @@ public class WinEnvironmentVariableSupplier
return envvars.values().toArray(new IBuildEnvironmentVariable[envvars.size()]); return envvars.values().toArray(new IBuildEnvironmentVariable[envvars.size()]);
} }
private static String getSoftwareKey(WindowsRegistry reg, String subkey, String name) {
String value = reg.getLocalMachineValue("SOFTWARE\\" + subkey, name);
// Visual Studio is a 32 bit application so on Windows 64 the keys will be in Wow6432Node
if (value == null) {
value = reg.getLocalMachineValue("SOFTWARE\\Wow6432Node\\" + subkey, name);
}
return value;
}
// Current support is for Windows SDK 7.1 with Visual C++ 10.0 // Current support is for Windows SDK 7.1 with Visual C++ 10.0
// Secondary support for Windows SDK 7.0 with Visual C++ 9.0 // Secondary support for Windows SDK 7.0 with Visual C++ 9.0
private static String getSDKDir() { private static String getSDKDir() {
WindowsRegistry reg = WindowsRegistry.getRegistry(); WindowsRegistry reg = WindowsRegistry.getRegistry();
String sdkDir = reg.getLocalMachineValue("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1", "InstallationFolder"); String sdkDir = getSoftwareKey(reg, "Microsoft\\Microsoft SDKs\\Windows\\v7.1", "InstallationFolder");
if (sdkDir != null) if (sdkDir != null)
return sdkDir; return sdkDir;
return reg.getLocalMachineValue("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.0", "InstallationFolder"); return getSoftwareKey(reg, "Microsoft SDKs\\Windows\\v7.0", "InstallationFolder");
} }
private static String getVCDir() { private static String getVCDir() {
WindowsRegistry reg = WindowsRegistry.getRegistry(); WindowsRegistry reg = WindowsRegistry.getRegistry();
String vcDir = reg.getLocalMachineValue("SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7", "10.0"); String vcDir = getSoftwareKey(reg, "Microsoft\\VisualStudio\\SxS\\VC7", "10.0");
if (vcDir != null) if (vcDir != null)
return vcDir; return vcDir;
return reg.getLocalMachineValue("SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7", "9.0"); return getSoftwareKey(reg, "Microsoft\\VisualStudio\\SxS\\VC7", "9.0");
} }
public static IPath[] getIncludePath() { public static IPath[] getIncludePath() {

View file

@ -19,10 +19,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.errorparsers.xlc" id="org.eclipse.cdt.errorparsers.xlc"
download-size="0" download-size="0"

View file

@ -18,10 +18,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<includes <includes
id="org.eclipse.cdt.xlc.source" id="org.eclipse.cdt.xlc.source"
version="0.0.0"/> version="0.0.0"/>

View file

@ -17,10 +17,6 @@
%license %license
</license> </license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin <plugin
id="org.eclipse.cdt.errorparsers.xlc.source" id="org.eclipse.cdt.errorparsers.xlc.source"
download-size="0" download-size="0"