mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
Merge branch 'master' into sd90
This commit is contained in:
commit
68dfbade0a
27 changed files with 510 additions and 103 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2012 IBM Corporation 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
|
||||
|
@ -16,6 +16,7 @@ package org.eclipse.cdt.core.parser.tests.ast2;
|
|||
|
||||
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
|
||||
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.XVALUE;
|
||||
import static org.eclipse.cdt.core.parser.ParserLanguage.CPP;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
|
@ -9625,4 +9626,24 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
IBinding ctor= bh.assertNonProblem("E(){}", 1);
|
||||
assertTrue(ctor instanceof ICPPConstructor);
|
||||
}
|
||||
|
||||
// struct S;
|
||||
// struct S {
|
||||
// S();
|
||||
// ~S();
|
||||
// T();
|
||||
// ~T();
|
||||
// };
|
||||
public void testErrorForDestructorWithWrongName_367590() throws Exception {
|
||||
IASTTranslationUnit tu= parse(getAboveComment(), CPP, false, false);
|
||||
IASTCompositeTypeSpecifier S;
|
||||
IASTProblemDeclaration p;
|
||||
IASTSimpleDeclaration s;
|
||||
|
||||
S= getCompositeType(tu, 1);
|
||||
s= getDeclaration(S, 0);
|
||||
s= getDeclaration(S, 1);
|
||||
p= getDeclaration(S, 2);
|
||||
p= getDeclaration(S, 3);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2011 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2012 IBM Corporation 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
|
||||
|
@ -5689,4 +5689,18 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
public void testDeductionForConstFunctionType_367562() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template <typename> struct base {
|
||||
// typedef int type;
|
||||
// };
|
||||
// template <typename A, typename B> struct derived;
|
||||
// template <typename B> struct derived<int, B> : public base<B> {
|
||||
// typedef typename derived::type type; // ERROR HERE
|
||||
// };
|
||||
public void testTemplateShortNameInQualifiedName_367607() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true);
|
||||
ICPPDeferredClassInstance shortHand= bh.assertNonProblem("derived:", -1);
|
||||
assertTrue(shortHand.getClassTemplate() instanceof ICPPClassTemplatePartialSpecialization);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,9 +14,7 @@ import java.io.IOException;
|
|||
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.parser.util.ASTPrinter;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
|
||||
|
@ -41,13 +39,6 @@ public class ClassTypeHelperTests extends AST2BaseTest {
|
|||
return new BindingAssertionHelper(code, true);
|
||||
}
|
||||
|
||||
// int a;
|
||||
// const int& b;
|
||||
public void testTemp() throws Exception {
|
||||
BindingAssertionHelper helper = getAssertionHelper();
|
||||
ASTPrinter.print(helper.getTranslationUnit());
|
||||
}
|
||||
|
||||
// struct A {
|
||||
// A(const A& a);
|
||||
// };
|
||||
|
|
|
@ -36,13 +36,13 @@ import org.eclipse.core.runtime.CoreException;
|
|||
*
|
||||
*/
|
||||
public class BTreeTests extends BaseTestCase {
|
||||
private static int DEBUG= 0;
|
||||
protected File dbFile;
|
||||
protected Database db;
|
||||
protected BTree btree;
|
||||
protected int rootRecord;
|
||||
protected IBTreeComparator comparator;
|
||||
|
||||
protected boolean debugMode = false;
|
||||
|
||||
public static Test suite() {
|
||||
return suite(BTreeTests.class);
|
||||
|
@ -80,7 +80,8 @@ public class BTreeTests extends BaseTestCase {
|
|||
|
||||
for(int i=0; i<noTrials; i++) {
|
||||
int seed = seeder.nextInt();
|
||||
System.out.println("Iteration #"+i);
|
||||
if (DEBUG > 0)
|
||||
System.out.println("Iteration #"+i);
|
||||
trial(seed, false);
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +96,8 @@ public class BTreeTests extends BaseTestCase {
|
|||
|
||||
for(int i=0; i<6; i++) {
|
||||
int seed = seeder.nextInt();
|
||||
System.out.println("Iteration #"+i);
|
||||
if (DEBUG > 0)
|
||||
System.out.println("Iteration #"+i);
|
||||
trialImp(seed, false, new Random(seed*2), 1);
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +126,8 @@ public class BTreeTests extends BaseTestCase {
|
|||
|
||||
init(degree);
|
||||
|
||||
System.out.print("\t "+seed+" "+(nIterations/1000)+"K: ");
|
||||
if (DEBUG > 0)
|
||||
System.out.print("\t "+seed+" "+(nIterations/1000)+"K: ");
|
||||
for(int i=0; i<nIterations; i++) {
|
||||
if(random.nextDouble()<pInsert) {
|
||||
Integer value = new Integer(random.nextInt(Integer.MAX_VALUE));
|
||||
|
@ -132,7 +135,7 @@ public class BTreeTests extends BaseTestCase {
|
|||
if(newEntry) {
|
||||
BTMockRecord btValue = new BTMockRecord(db, value.intValue());
|
||||
history.add(btValue);
|
||||
if(debugMode)
|
||||
if(DEBUG > 1)
|
||||
System.out.println("Add: "+value+" @ "+btValue.record);
|
||||
btree.insert(btValue.getRecord());
|
||||
}
|
||||
|
@ -142,12 +145,12 @@ public class BTreeTests extends BaseTestCase {
|
|||
BTMockRecord btValue = (BTMockRecord) history.get(index);
|
||||
history.remove(index);
|
||||
expected.remove(new Integer(btValue.intValue()));
|
||||
if(debugMode)
|
||||
if(DEBUG > 1)
|
||||
System.out.println("Remove: "+btValue.intValue()+" @ "+btValue.record);
|
||||
btree.delete(btValue.getRecord());
|
||||
}
|
||||
}
|
||||
if(i % 1000 == 0) {
|
||||
if(i % 1000 == 0 && DEBUG > 0) {
|
||||
System.out.print(".");
|
||||
}
|
||||
if(checkCorrectnessEachIteration) {
|
||||
|
@ -155,7 +158,8 @@ public class BTreeTests extends BaseTestCase {
|
|||
assertBTreeInvariantsHold("[iteration "+i+"] ");
|
||||
}
|
||||
}
|
||||
System.out.println();
|
||||
if (DEBUG > 0)
|
||||
System.out.println();
|
||||
|
||||
assertBTreeMatchesSortedSet("[Trial end] ", btree, expected);
|
||||
assertBTreeInvariantsHold("[Trial end]");
|
||||
|
@ -174,9 +178,11 @@ public class BTreeTests extends BaseTestCase {
|
|||
final Iterator i = expected.iterator();
|
||||
btree.accept(new IBTreeVisitor(){
|
||||
int k;
|
||||
@Override
|
||||
public int compare(long record) throws CoreException {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public boolean visit(long record) throws CoreException {
|
||||
if(record!=0) {
|
||||
BTMockRecord btValue = new BTMockRecord(record, db);
|
||||
|
@ -227,6 +233,7 @@ public class BTreeTests extends BaseTestCase {
|
|||
}
|
||||
|
||||
private class BTMockRecordComparator implements IBTreeComparator {
|
||||
@Override
|
||||
public int compare(long record1, long record2) throws CoreException {
|
||||
return db.getInt(record1) - db.getInt(record2);
|
||||
}
|
||||
|
|
|
@ -117,8 +117,8 @@ public class ClassTests extends PDOMTestBase {
|
|||
bindings = ns.find("testRef");
|
||||
assertEquals(1, bindings.length);
|
||||
IName[] refs = pdom.findNames(bindings[0], IIndex.FIND_REFERENCES);
|
||||
for (int i = 0; i < refs.length; ++i)
|
||||
System.out.println(refs[i].getFileLocation().getNodeOffset());
|
||||
// for (int i = 0; i < refs.length; ++i)
|
||||
// System.out.println(refs[i].getFileLocation().getNodeOffset());
|
||||
assertEquals(5, refs.length);
|
||||
}
|
||||
|
||||
|
|
|
@ -255,8 +255,8 @@ public class DBTest extends BaseTestCase {
|
|||
int expected = caseSensitive ? a.compareTo(b) : a.compareToIgnoreCase(b);
|
||||
assertCMP(a, expected, b, caseSensitive);
|
||||
}
|
||||
System.out.print("Trials: "+n+" Max length: "+max+" ignoreCase: "+!caseSensitive);
|
||||
System.out.println(" Time: "+(System.currentTimeMillis()-start));
|
||||
// System.out.print("Trials: "+n+" Max length: "+max+" ignoreCase: "+!caseSensitive);
|
||||
// System.out.println(" Time: "+(System.currentTimeMillis()-start));
|
||||
}
|
||||
|
||||
private String randomString(int min, int max, Random r) {
|
||||
|
|
|
@ -274,6 +274,7 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
|||
IIndexerStateListener listener= null;
|
||||
if(stateCount != null) {
|
||||
listener= new IIndexerStateListener() {
|
||||
@Override
|
||||
public void indexChanged(IIndexerStateEvent event) {
|
||||
stateCount[0]++;
|
||||
}
|
||||
|
@ -299,8 +300,14 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
|||
}
|
||||
|
||||
private void doGenerate(String[] args) throws CoreException {
|
||||
GeneratePDOMApplication app = new GeneratePDOMApplication();
|
||||
IApplicationContext ac= new MockApplicationContext(args);
|
||||
GeneratePDOMApplication app = new GeneratePDOMApplication() {
|
||||
@Override
|
||||
protected void output(String s) {}
|
||||
};
|
||||
String[] newArgs= new String[args.length+1];
|
||||
newArgs[0]= GeneratePDOMApplication.OPT_QUIET;
|
||||
System.arraycopy(args, 0, newArgs, 1, args.length);
|
||||
IApplicationContext ac= new MockApplicationContext(newArgs);
|
||||
app.start(ac);
|
||||
}
|
||||
|
||||
|
@ -309,73 +316,93 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
|||
*/
|
||||
|
||||
public static class TestProjectProvider1 implements IExportProjectProvider {
|
||||
@Override
|
||||
public ICProject createProject() throws CoreException {return null;}
|
||||
@Override
|
||||
public Map getExportProperties() {return null;}
|
||||
@Override
|
||||
public IIndexLocationConverter getLocationConverter(ICProject cproject) {return null;}
|
||||
@Override
|
||||
public void setApplicationArguments(String[] arguments) {}
|
||||
}
|
||||
|
||||
public static class TestProjectProvider2 implements IExportProjectProvider {
|
||||
@Override
|
||||
public ICProject createProject() throws CoreException {
|
||||
ICProject cproject= CProjectHelper.createCCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
||||
toDeleteOnTearDown.add(cproject);
|
||||
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), LOC_TSTPRJ1);
|
||||
return cproject;
|
||||
}
|
||||
@Override
|
||||
public Map getExportProperties() {return null;}
|
||||
@Override
|
||||
public IIndexLocationConverter getLocationConverter(ICProject cproject) {return null;}
|
||||
@Override
|
||||
public void setApplicationArguments(String[] arguments) {}
|
||||
}
|
||||
|
||||
public static class TestProjectProvider3 implements IExportProjectProvider {
|
||||
@Override
|
||||
public ICProject createProject() throws CoreException {
|
||||
ICProject cproject= CProjectHelper.createCCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
||||
toDeleteOnTearDown.add(cproject);
|
||||
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), LOC_TSTPRJ1);
|
||||
return cproject;
|
||||
}
|
||||
@Override
|
||||
public Map getExportProperties() {return null;}
|
||||
@Override
|
||||
public IIndexLocationConverter getLocationConverter(ICProject cproject) {
|
||||
return new ResourceContainerRelativeLocationConverter(cproject.getProject());
|
||||
}
|
||||
@Override
|
||||
public void setApplicationArguments(String[] arguments) {}
|
||||
}
|
||||
|
||||
public static class TestProjectProvider4 implements IExportProjectProvider {
|
||||
@Override
|
||||
public ICProject createProject() throws CoreException {
|
||||
ICProject cproject= CProjectHelper.createCCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
||||
toDeleteOnTearDown.add(cproject);
|
||||
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), LOC_TSTPRJ1);
|
||||
return cproject;
|
||||
}
|
||||
@Override
|
||||
public Map getExportProperties() {
|
||||
Map map= new HashMap();
|
||||
map.put(SDK_VERSION, "4.0.1");
|
||||
map.put(IIndexFragment.PROPERTY_FRAGMENT_ID, ACME_SDK_ID);
|
||||
return map;
|
||||
}
|
||||
@Override
|
||||
public IIndexLocationConverter getLocationConverter(ICProject cproject) {
|
||||
return new ResourceContainerRelativeLocationConverter(cproject.getProject());
|
||||
}
|
||||
@Override
|
||||
public void setApplicationArguments(String[] arguments) {}
|
||||
}
|
||||
|
||||
public static class TestProjectProvider5 implements IExportProjectProvider {
|
||||
@Override
|
||||
public ICProject createProject() throws CoreException {
|
||||
ICProject cproject= CProjectHelper.createCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
||||
toDeleteOnTearDown.add(cproject);
|
||||
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), LOC_TSTPRJ3);
|
||||
return cproject;
|
||||
}
|
||||
@Override
|
||||
public Map getExportProperties() {
|
||||
Map map= new HashMap();
|
||||
map.put(SDK_VERSION, "4.0.1");
|
||||
map.put(IIndexFragment.PROPERTY_FRAGMENT_ID, ACME_SDK_ID);
|
||||
return map;
|
||||
}
|
||||
@Override
|
||||
public IIndexLocationConverter getLocationConverter(ICProject cproject) {
|
||||
return new ResourceContainerRelativeLocationConverter(cproject.getProject());
|
||||
}
|
||||
@Override
|
||||
public void setApplicationArguments(String[] arguments) {}
|
||||
}
|
||||
}
|
||||
|
@ -386,13 +413,22 @@ class MockApplicationContext implements IApplicationContext {
|
|||
arguments= new HashMap();
|
||||
arguments.put(APPLICATION_ARGS, appArgs);
|
||||
}
|
||||
@Override
|
||||
public void applicationRunning() {}
|
||||
@Override
|
||||
public Map getArguments() {return arguments;}
|
||||
@Override
|
||||
public String getBrandingApplication() {return null;}
|
||||
@Override
|
||||
public Bundle getBrandingBundle() {return null;}
|
||||
@Override
|
||||
public String getBrandingDescription() {return null;}
|
||||
@Override
|
||||
public String getBrandingId() {return null;}
|
||||
@Override
|
||||
public String getBrandingName() {return null;}
|
||||
@Override
|
||||
public String getBrandingProperty(String key) {return null;}
|
||||
@Override
|
||||
public void setResult(Object result, IApplication application) {}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2011 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2012 IBM Corporation 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
|
||||
|
@ -124,7 +124,7 @@ public interface IASTName extends IASTNode, IName {
|
|||
public char[] getLookupKey();
|
||||
|
||||
/**
|
||||
* Gets the intermediate representation of the biniding, if already available.
|
||||
* Gets the intermediate representation of the binding, if already available.
|
||||
* @noreference This method is not intended to be referenced by clients.
|
||||
*/
|
||||
public IBinding getPreBinding();
|
||||
|
@ -134,4 +134,10 @@ public interface IASTName extends IASTNode, IName {
|
|||
* @noreference This method is not intended to be referenced by clients.
|
||||
*/
|
||||
public IBinding resolvePreBinding();
|
||||
|
||||
/**
|
||||
* Returns whether this name is qualified, i.e. whether it is preceded by a scope operator.
|
||||
* @since 5.4
|
||||
*/
|
||||
public boolean isQualified();
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
|||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
|
@ -24,7 +25,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
* @since 5.3
|
||||
*/
|
||||
public interface ICPPASTRangeBasedForStatement extends IASTStatement {
|
||||
public interface ICPPASTRangeBasedForStatement extends IASTStatement, IASTImplicitNameOwner {
|
||||
public static final ASTNodeProperty DECLARATION = new ASTNodeProperty(
|
||||
"ICPPASTRangeBasedForStatement.DECLARATION [IASTDeclaration]"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty INITIALIZER = new ASTNodeProperty(
|
||||
|
@ -53,8 +54,10 @@ public interface ICPPASTRangeBasedForStatement extends IASTStatement {
|
|||
*/
|
||||
public IScope getScope();
|
||||
|
||||
@Override
|
||||
public ICPPASTRangeBasedForStatement copy();
|
||||
|
||||
@Override
|
||||
public ICPPASTRangeBasedForStatement copy(CopyStyle style);
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2011 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2012 IBM Corporation 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
|
||||
|
@ -265,4 +265,8 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
public IASTName getLastName() {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public boolean isQualified() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -19,6 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||
import org.eclipse.cdt.internal.core.dom.Linkage;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.IASTInternalNameOwner;
|
||||
|
@ -151,6 +152,22 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
|||
public IASTName getLastName() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isQualified() {
|
||||
IASTNode parent= getParent();
|
||||
if (parent instanceof ICPPASTQualifiedName) {
|
||||
ICPPASTQualifiedName qn= (ICPPASTQualifiedName) parent;
|
||||
if (qn.isFullyQualified())
|
||||
return true;
|
||||
IASTName[] qns = qn.getNames();
|
||||
if (qns.length > 0 && qns[0] == this)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final String toString() {
|
||||
|
|
|
@ -10,15 +10,26 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE;
|
||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IArrayType;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTRangeBasedForStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
||||
|
||||
/**
|
||||
* Range based for loop in c++.
|
||||
|
@ -28,14 +39,17 @@ public class CPPASTRangeBasedForStatement extends ASTNode implements ICPPASTRang
|
|||
private IASTDeclaration fDeclaration;
|
||||
private IASTInitializerClause fInitClause;
|
||||
private IASTStatement fBody;
|
||||
private IASTImplicitName[] fImplicitNames;
|
||||
|
||||
public CPPASTRangeBasedForStatement() {
|
||||
}
|
||||
|
||||
public CPPASTRangeBasedForStatement copy() {
|
||||
@Override
|
||||
public CPPASTRangeBasedForStatement copy() {
|
||||
return copy(CopyStyle.withoutLocations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CPPASTRangeBasedForStatement copy(CopyStyle style) {
|
||||
CPPASTRangeBasedForStatement copy = new CPPASTRangeBasedForStatement();
|
||||
copy.setDeclaration(fDeclaration == null ? null : fDeclaration.copy(style));
|
||||
|
@ -48,11 +62,13 @@ public class CPPASTRangeBasedForStatement extends ASTNode implements ICPPASTRang
|
|||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTDeclaration getDeclaration() {
|
||||
return fDeclaration;
|
||||
}
|
||||
|
||||
public void setDeclaration(IASTDeclaration declaration) {
|
||||
@Override
|
||||
public void setDeclaration(IASTDeclaration declaration) {
|
||||
assertNotFrozen();
|
||||
this.fDeclaration = declaration;
|
||||
if (declaration != null) {
|
||||
|
@ -61,11 +77,13 @@ public class CPPASTRangeBasedForStatement extends ASTNode implements ICPPASTRang
|
|||
}
|
||||
}
|
||||
|
||||
public IASTInitializerClause getInitializerClause() {
|
||||
@Override
|
||||
public IASTInitializerClause getInitializerClause() {
|
||||
return fInitClause;
|
||||
}
|
||||
|
||||
public void setInitializerClause(IASTInitializerClause initClause) {
|
||||
@Override
|
||||
public void setInitializerClause(IASTInitializerClause initClause) {
|
||||
assertNotFrozen();
|
||||
fInitClause = initClause;
|
||||
if (initClause != null) {
|
||||
|
@ -74,10 +92,12 @@ public class CPPASTRangeBasedForStatement extends ASTNode implements ICPPASTRang
|
|||
}
|
||||
}
|
||||
|
||||
public IASTStatement getBody() {
|
||||
@Override
|
||||
public IASTStatement getBody() {
|
||||
return fBody;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBody(IASTStatement statement) {
|
||||
assertNotFrozen();
|
||||
fBody = statement;
|
||||
|
@ -87,12 +107,72 @@ public class CPPASTRangeBasedForStatement extends ASTNode implements ICPPASTRang
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScope getScope() {
|
||||
if (fScope == null)
|
||||
fScope = new CPPBlockScope(this);
|
||||
return fScope;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTImplicitName[] getImplicitNames() {
|
||||
if (fImplicitNames == null) {
|
||||
IASTInitializerClause forInit = getInitializerClause();
|
||||
final ASTNode position = (ASTNode) forInit;
|
||||
if (forInit instanceof IASTExpression) {
|
||||
final IASTExpression forInitExpr = (IASTExpression) forInit;
|
||||
IType type= SemanticUtil.getNestedType(forInitExpr.getExpressionType(), TDEF|CVTYPE);
|
||||
if (type instanceof IArrayType) {
|
||||
fImplicitNames= IASTImplicitName.EMPTY_NAME_ARRAY;
|
||||
} else if (type instanceof ICPPClassType) {
|
||||
ICPPClassType ct= (ICPPClassType) type;
|
||||
if (CPPSemantics.findBindings(ct.getCompositeScope(), CPPVisitor.BEGIN_STR, true).length > 0) {
|
||||
CPPASTName name = new CPPASTName(CPPVisitor.BEGIN);
|
||||
name.setOffset(position.getOffset());
|
||||
CPPASTFieldReference fieldRef = new CPPASTFieldReference(name, forInitExpr.copy());
|
||||
IASTExpression expr= new CPPASTFunctionCallExpression(fieldRef, CPPVisitor.NO_ARGS);
|
||||
expr.setParent(this);
|
||||
expr.setPropertyInParent(ICPPASTRangeBasedForStatement.INITIALIZER);
|
||||
CPPASTImplicitName begin= new CPPASTImplicitName(name.toCharArray(), this);
|
||||
begin.setBinding(name.resolveBinding());
|
||||
begin.setOffsetAndLength(position);
|
||||
|
||||
name = new CPPASTName(CPPVisitor.END);
|
||||
name.setOffset(position.getOffset());
|
||||
fieldRef.setFieldName(name);
|
||||
CPPASTImplicitName end= new CPPASTImplicitName(name.toCharArray(), this);
|
||||
end.setBinding(name.resolveBinding());
|
||||
end.setOffsetAndLength(position);
|
||||
|
||||
fImplicitNames= new IASTImplicitName[] {begin, end};
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fImplicitNames == null) {
|
||||
CPPASTName name = new CPPASTName(CPPVisitor.BEGIN);
|
||||
name.setOffset(position.getOffset());
|
||||
CPPASTIdExpression fname = new CPPASTIdExpression(name);
|
||||
IASTExpression expr= new CPPASTFunctionCallExpression(fname, new IASTInitializerClause[] {forInit.copy()});
|
||||
expr.setParent(this);
|
||||
expr.setPropertyInParent(ICPPASTRangeBasedForStatement.INITIALIZER);
|
||||
|
||||
CPPASTImplicitName begin= new CPPASTImplicitName(name.toCharArray(), this);
|
||||
begin.setBinding(name.resolveBinding());
|
||||
begin.setOffsetAndLength(position);
|
||||
|
||||
name = new CPPASTName(CPPVisitor.END);
|
||||
name.setOffset(position.getOffset());
|
||||
fname.setName(name);
|
||||
CPPASTImplicitName end= new CPPASTImplicitName(name.toCharArray(), this);
|
||||
end.setBinding(name.resolveBinding());
|
||||
end.setOffsetAndLength(position);
|
||||
|
||||
fImplicitNames= new IASTImplicitName[] {begin, end};
|
||||
}
|
||||
}
|
||||
return fImplicitNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept( ASTVisitor action ){
|
||||
if (action.shouldVisitStatements) {
|
||||
|
@ -106,6 +186,14 @@ public class CPPASTRangeBasedForStatement extends ASTNode implements ICPPASTRang
|
|||
return false;
|
||||
if (fInitClause != null && !fInitClause.accept(action))
|
||||
return false;
|
||||
IASTImplicitName[] implicits = action.shouldVisitImplicitNames ? getImplicitNames() : null;
|
||||
if (implicits != null) {
|
||||
for (IASTImplicitName implicit : implicits) {
|
||||
if (!implicit.accept(action))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (fBody != null && !fBody.accept(action))
|
||||
return false;
|
||||
|
||||
|
@ -114,6 +202,7 @@ public class CPPASTRangeBasedForStatement extends ASTNode implements ICPPASTRang
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replace(IASTNode child, IASTNode other) {
|
||||
if (child == fDeclaration) {
|
||||
setDeclaration((IASTDeclaration) other);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2002, 2011 IBM Corporation and others.
|
||||
* Copyright (c) 2002, 2012 IBM Corporation 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
|
||||
|
@ -3211,17 +3211,17 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
if (name instanceof ICPPASTConversionName)
|
||||
return;
|
||||
|
||||
// accept destructor
|
||||
final char[] nchars= name.getLookupKey();
|
||||
if (nchars.length > 0 && nchars[0] == '~')
|
||||
return;
|
||||
|
||||
if (opt == DeclarationOptions.CPP_MEMBER) {
|
||||
// accept constructor within class body
|
||||
if (CharArrayUtils.equals(nchars, currentClassName))
|
||||
return;
|
||||
// Accept constructor and destructor within class body
|
||||
final char[] nchars= name.getLookupKey();
|
||||
if (nchars.length > 0 && currentClassName != null) {
|
||||
final int start= nchars[0] == '~' ? 1 : 0;
|
||||
if (CharArrayUtils.equals(nchars, start, nchars.length-start, currentClassName))
|
||||
return;
|
||||
}
|
||||
} else if (isQualified) {
|
||||
// accept qualified constructor outside of class body
|
||||
// Accept qualified constructor or destructor outside of class body
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2011 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2012 IBM Corporation 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
|
||||
|
@ -324,7 +324,7 @@ public class CPPSemantics {
|
|||
if (binding instanceof ICPPClassTemplate && !(binding instanceof ICPPClassSpecialization) &&
|
||||
!(binding instanceof ICPPTemplateParameter) && !(data.astName instanceof ICPPASTTemplateId)) {
|
||||
ASTNodeProperty prop = data.astName.getPropertyInParent();
|
||||
if (prop != ICPPASTTemplateId.TEMPLATE_NAME && prop != ICPPASTQualifiedName.SEGMENT_NAME) {
|
||||
if (prop != ICPPASTTemplateId.TEMPLATE_NAME && !data.astName.isQualified()) {
|
||||
// You cannot use a class template name outside of the class template scope,
|
||||
// mark it as a problem.
|
||||
IBinding replacement= CPPTemplates.isUsedInClassTemplateScope((ICPPClassTemplate) binding, data.astName);
|
||||
|
@ -649,23 +649,23 @@ public class CPPSemantics {
|
|||
}
|
||||
}
|
||||
|
||||
if (data.astName != null
|
||||
&& CharArrayUtils.equals(CPPVisitor.BEGIN, data.astName.getSimpleID())) {
|
||||
IASTNode parent = data.astName.getParent(); // id-expression
|
||||
if (parent != null)
|
||||
parent= parent.getParent(); // function call
|
||||
if (parent != null)
|
||||
parent= parent.getParent(); // the loop
|
||||
if (parent != null)
|
||||
parent= parent.getParent(); // unary *
|
||||
if (parent instanceof ICPPASTRangeBasedForStatement) {
|
||||
IBinding[] std= parent.getTranslationUnit().getScope().find(CPPVisitor.STD);
|
||||
for (IBinding binding : std) {
|
||||
if (binding instanceof ICPPNamespace) {
|
||||
namespaces.add(((ICPPNamespace) binding).getNamespaceScope());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (data.astName != null) {
|
||||
final char[] simpleID = data.astName.getSimpleID();
|
||||
if (CharArrayUtils.equals(CPPVisitor.BEGIN, simpleID) || CharArrayUtils.equals(CPPVisitor.END, simpleID)) {
|
||||
IASTNode parent = data.astName.getParent(); // id-expression
|
||||
if (parent != null)
|
||||
parent= parent.getParent(); // function call
|
||||
if (parent != null)
|
||||
parent= parent.getParent(); // the loop
|
||||
if (parent instanceof ICPPASTRangeBasedForStatement) {
|
||||
IBinding[] std= parent.getTranslationUnit().getScope().find(CPPVisitor.STD);
|
||||
for (IBinding binding : std) {
|
||||
if (binding instanceof ICPPNamespace) {
|
||||
namespaces.add(((ICPPNamespace) binding).getNamespaceScope());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return namespaces;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTGotoStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
|
||||
|
@ -151,7 +152,6 @@ import org.eclipse.cdt.core.index.IIndexBinding;
|
|||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||
|
@ -201,14 +201,15 @@ public class CPPVisitor extends ASTQueries {
|
|||
private static final CPPBasicType UNSIGNED_LONG = new CPPBasicType(Kind.eInt, IBasicType.IS_LONG | IBasicType.IS_UNSIGNED);
|
||||
private static final CPPBasicType INT_TYPE = new CPPBasicType(Kind.eInt, 0);
|
||||
|
||||
private static final String BEGIN_STR = "begin"; //$NON-NLS-1$
|
||||
static final char[] BEGIN = BEGIN_STR.toCharArray();
|
||||
public static final String BEGIN_STR = "begin"; //$NON-NLS-1$
|
||||
public static final char[] BEGIN = BEGIN_STR.toCharArray();
|
||||
public static final char[] END = "end".toCharArray(); //$NON-NLS-1$
|
||||
static final String STD = "std"; //$NON-NLS-1$
|
||||
private static final char[] SIZE_T = "size_t".toCharArray(); //$NON-NLS-1$
|
||||
private static final char[] PTRDIFF_T = "ptrdiff_t".toCharArray(); //$NON-NLS-1$
|
||||
private static final char[] TYPE_INFO= "type_info".toCharArray(); //$NON-NLS-1$
|
||||
private static final char[] INITIALIZER_LIST = "initializer_list".toCharArray(); //$NON-NLS-1$
|
||||
private static final IASTInitializerClause[] NO_ARGS = {};
|
||||
public static final IASTInitializerClause[] NO_ARGS = {};
|
||||
|
||||
// Thread-local set of DeclSpecifiers for which auto types are being created.
|
||||
// Used to prevent infinite recursion while processing invalid self-referencing
|
||||
|
@ -1925,22 +1926,23 @@ public class CPPVisitor extends ASTQueries {
|
|||
IType type= SemanticUtil.getNestedType(expr.getExpressionType(), TDEF|CVTYPE);
|
||||
if (type instanceof IArrayType) {
|
||||
beginExpr= expr.copy();
|
||||
} else if (type instanceof ICPPClassType) {
|
||||
ICPPClassType ct= (ICPPClassType) type;
|
||||
if (CPPSemantics.findBindings(ct.getCompositeScope(), BEGIN_STR, true).length > 0) {
|
||||
final CPPASTName name = new CPPASTName(BEGIN);
|
||||
name.setOffset(((ASTNode) forInit).getOffset());
|
||||
beginExpr= new CPPASTFunctionCallExpression(
|
||||
new CPPASTFieldReference(name, expr.copy()), NO_ARGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (beginExpr == null) {
|
||||
final CPPASTName name = new CPPASTName(BEGIN);
|
||||
name.setOffset(((ASTNode) forInit).getOffset());
|
||||
beginExpr= new CPPASTFunctionCallExpression(
|
||||
new CPPASTIdExpression(name),
|
||||
new IASTInitializerClause[] { forInit.copy() });
|
||||
IASTImplicitName[] implicits= forStmt.getImplicitNames();
|
||||
if (implicits.length > 0) {
|
||||
IBinding b= implicits[0].getBinding();
|
||||
CPPASTName name= new CPPASTName();
|
||||
name.setBinding(b);
|
||||
if (b instanceof ICPPMethod) {
|
||||
beginExpr= new CPPASTFunctionCallExpression(
|
||||
new CPPASTFieldReference(name, null), NO_ARGS);
|
||||
} else {
|
||||
beginExpr= new CPPASTFunctionCallExpression(new CPPASTIdExpression(name), NO_ARGS);
|
||||
}
|
||||
} else {
|
||||
return new ProblemType(ISemanticProblem.TYPE_CANNOT_DEDUCE_AUTO_TYPE);
|
||||
}
|
||||
}
|
||||
autoInitClause= new CPPASTUnaryExpression(IASTUnaryExpression.op_star, beginExpr);
|
||||
autoInitClause.setParent(forStmt);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2007, 2012 Wind River Systems, 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
|
||||
|
@ -37,40 +37,52 @@ class ASTPreprocessorName extends ASTPreprocessorNode implements IASTName {
|
|||
fBinding= binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding resolveBinding() {
|
||||
return fBinding;
|
||||
}
|
||||
@Override
|
||||
public IBinding resolvePreBinding() {
|
||||
return fBinding;
|
||||
}
|
||||
@Override
|
||||
public IBinding getBinding() {
|
||||
return fBinding;
|
||||
}
|
||||
@Override
|
||||
public IBinding getPreBinding() {
|
||||
return fBinding;
|
||||
}
|
||||
@Override
|
||||
public ILinkage getLinkage() {
|
||||
final IASTTranslationUnit tu= getTranslationUnit();
|
||||
return tu == null ? Linkage.NO_LINKAGE : tu.getLinkage();
|
||||
}
|
||||
@Override
|
||||
public IASTCompletionContext getCompletionContext() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public boolean isDeclaration() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isDefinition() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isReference() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public char[] toCharArray() {
|
||||
return fName;
|
||||
}
|
||||
@Override
|
||||
public char[] getSimpleID() {
|
||||
return fName;
|
||||
}
|
||||
@Override
|
||||
public char[] getLookupKey() {
|
||||
return fName;
|
||||
}
|
||||
|
@ -79,15 +91,22 @@ class ASTPreprocessorName extends ASTPreprocessorNode implements IASTName {
|
|||
public String toString() {
|
||||
return new String(fName);
|
||||
}
|
||||
@Override
|
||||
public void setBinding(IBinding binding) {assert false;}
|
||||
|
||||
@Override
|
||||
public int getRoleOfName(boolean allowResolution) {
|
||||
return IASTNameOwner.r_unclear;
|
||||
}
|
||||
@Override
|
||||
public IASTName getLastName() {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public boolean isQualified() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public IASTName copy() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2007, 2012 Wind River Systems, 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
|
||||
|
@ -51,144 +51,179 @@ public class PDOMASTAdapter {
|
|||
public AnonymousASTName(IASTName name, final IASTFileLocation loc) {
|
||||
fDelegate= name;
|
||||
fLocation= new IASTFileLocation() {
|
||||
@Override
|
||||
public int getEndingLineNumber() {
|
||||
return loc.getStartingLineNumber();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return loc.getFileName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartingLineNumber() {
|
||||
return loc.getStartingLineNumber();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTFileLocation asFileLocation() {
|
||||
return loc.asFileLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNodeLength() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNodeOffset() {
|
||||
return loc.getNodeOffset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTPreprocessorIncludeStatement getContextInclusionStatement() {
|
||||
return loc.getContextInclusionStatement();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(ASTVisitor visitor) {
|
||||
return fDelegate.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(IASTNode node) {
|
||||
return fDelegate.contains(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding getBinding() {
|
||||
return fDelegate.getBinding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding getPreBinding() {
|
||||
return fDelegate.getPreBinding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContainingFilename() {
|
||||
return fLocation.getFileName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTFileLocation getFileLocation() {
|
||||
return fLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILinkage getLinkage() {
|
||||
return fDelegate.getLinkage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTNodeLocation[] getNodeLocations() {
|
||||
return fDelegate.getNodeLocations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTNode getParent() {
|
||||
return fDelegate.getParent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTNode[] getChildren() {
|
||||
return fDelegate.getChildren();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ASTNodeProperty getPropertyInParent() {
|
||||
return fDelegate.getPropertyInParent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRawSignature() {
|
||||
return fDelegate.getRawSignature();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTTranslationUnit getTranslationUnit() {
|
||||
return fDelegate.getTranslationUnit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRoleOfName(boolean allowResolution) {
|
||||
return fDelegate.getRoleOfName(allowResolution);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeclaration() {
|
||||
return fDelegate.isDeclaration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefinition() {
|
||||
return fDelegate.isDefinition();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReference() {
|
||||
return fDelegate.isReference();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding resolveBinding() {
|
||||
return fDelegate.resolveBinding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding resolvePreBinding() {
|
||||
return fDelegate.resolvePreBinding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTCompletionContext getCompletionContext() {
|
||||
return fDelegate.getCompletionContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBinding(IBinding binding) {
|
||||
fDelegate.setBinding(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParent(IASTNode node) {
|
||||
fDelegate.setParent(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPropertyInParent(ASTNodeProperty property) {
|
||||
fDelegate.setPropertyInParent(property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] toCharArray() {
|
||||
return fDelegate.toCharArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] getSimpleID() {
|
||||
return fDelegate.getSimpleID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] getLookupKey() {
|
||||
return fDelegate.getLookupKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTImageLocation getImageLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPartOfTranslationUnitFile() {
|
||||
return fLocation.getFileName().equals(fDelegate.getTranslationUnit().getFilePath());
|
||||
}
|
||||
|
@ -198,40 +233,53 @@ public class PDOMASTAdapter {
|
|||
return fDelegate.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTName getLastName() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IToken getSyntax() throws ExpansionOverlapsBoundaryException,
|
||||
UnsupportedOperationException {
|
||||
return fDelegate.getSyntax();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IToken getLeadingSyntax() throws ExpansionOverlapsBoundaryException,
|
||||
UnsupportedOperationException {
|
||||
return fDelegate.getLeadingSyntax();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IToken getTrailingSyntax() throws ExpansionOverlapsBoundaryException,
|
||||
UnsupportedOperationException {
|
||||
return fDelegate.getTrailingSyntax();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFrozen() {
|
||||
return fDelegate.isFrozen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return fDelegate.isFrozen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTName copy() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTName copy(CopyStyle style) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isQualified() {
|
||||
return fDelegate.isQualified();
|
||||
}
|
||||
}
|
||||
|
||||
private static class AnonymousEnumeration implements IEnumeration {
|
||||
|
@ -248,43 +296,53 @@ public class PDOMASTAdapter {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Object getAdapter(Class adapter) {
|
||||
return fDelegate.getAdapter(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEnumerator[] getEnumerators() throws DOMException {
|
||||
return fDelegate.getEnumerators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILinkage getLinkage() {
|
||||
return fDelegate.getLinkage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return new String(fName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] getNameCharArray() {
|
||||
return fName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScope getScope() throws DOMException {
|
||||
return fDelegate.getScope();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameType(IType type) {
|
||||
return fDelegate.isSameType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding getOwner() {
|
||||
return fDelegate.getOwner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMinValue() {
|
||||
return fDelegate.getMinValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxValue() {
|
||||
return fDelegate.getMaxValue();
|
||||
}
|
||||
|
@ -304,51 +362,63 @@ public class PDOMASTAdapter {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IField findField(String name) {
|
||||
return fDelegate.findField(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Object getAdapter(Class adapter) {
|
||||
return fDelegate.getAdapter(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScope getCompositeScope() {
|
||||
return fDelegate.getCompositeScope();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IField[] getFields() {
|
||||
return fDelegate.getFields();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getKey() {
|
||||
return fDelegate.getKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILinkage getLinkage() {
|
||||
return fDelegate.getLinkage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return new String(fName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] getNameCharArray() {
|
||||
return fName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScope getScope() throws DOMException {
|
||||
return fDelegate.getScope();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameType(IType type) {
|
||||
return fDelegate.isSameType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding getOwner() {
|
||||
return fDelegate.getOwner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAnonymous() {
|
||||
return fDelegate.isAnonymous();
|
||||
}
|
||||
|
@ -368,14 +438,17 @@ public class PDOMASTAdapter {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return new String(fName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] getNameCharArray() {
|
||||
return fName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getQualifiedName() throws DOMException {
|
||||
String[] qn= fDelegate.getQualifiedName();
|
||||
if (qn.length < 1) {
|
||||
|
@ -385,6 +458,7 @@ public class PDOMASTAdapter {
|
|||
return qn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||
char[][] qn= fDelegate.getQualifiedNameCharArray();
|
||||
if (qn.length < 1) {
|
||||
|
@ -394,23 +468,28 @@ public class PDOMASTAdapter {
|
|||
return qn;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Object getAdapter(Class adapter) {
|
||||
return fDelegate.getAdapter(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILinkage getLinkage() {
|
||||
return fDelegate.getLinkage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScope getScope() throws DOMException {
|
||||
return fDelegate.getScope();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGloballyQualified() throws DOMException {
|
||||
return fDelegate.isGloballyQualified();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding getOwner() {
|
||||
return fDelegate.getOwner();
|
||||
}
|
||||
|
@ -421,30 +500,37 @@ public class PDOMASTAdapter {
|
|||
super(name, (ICPPBinding) delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEnumerator[] getEnumerators() throws DOMException {
|
||||
return ((IEnumeration) fDelegate).getEnumerators();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameType(IType type) {
|
||||
return ((IEnumeration) fDelegate).isSameType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMinValue() {
|
||||
return ((IEnumeration)fDelegate).getMinValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxValue() {
|
||||
return ((IEnumeration)fDelegate).getMaxValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScoped() {
|
||||
return ((ICPPEnumeration)fDelegate).isScoped();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IType getFixedType() {
|
||||
return ((ICPPEnumeration)fDelegate).getFixedType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPScope asScope() {
|
||||
return ((ICPPEnumeration)fDelegate).asScope();
|
||||
}
|
||||
|
@ -455,58 +541,72 @@ public class PDOMASTAdapter {
|
|||
super(name, delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IField findField(String name) {
|
||||
return ((ICPPClassType) fDelegate).findField(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPMethod[] getAllDeclaredMethods() {
|
||||
return ((ICPPClassType) fDelegate).getAllDeclaredMethods();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPBase[] getBases() {
|
||||
return ((ICPPClassType) fDelegate).getBases();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScope getCompositeScope() {
|
||||
return ((ICPPClassType) fDelegate).getCompositeScope();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPConstructor[] getConstructors() {
|
||||
return ((ICPPClassType) fDelegate).getConstructors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPField[] getDeclaredFields() {
|
||||
return ((ICPPClassType) fDelegate).getDeclaredFields();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPMethod[] getDeclaredMethods() {
|
||||
return ((ICPPClassType) fDelegate).getDeclaredMethods();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IField[] getFields() {
|
||||
return ((ICPPClassType) fDelegate).getFields();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding[] getFriends() {
|
||||
return ((ICPPClassType) fDelegate).getFriends();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getKey() {
|
||||
return ((ICPPClassType) fDelegate).getKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPMethod[] getMethods() {
|
||||
return ((ICPPClassType) fDelegate).getMethods();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPClassType[] getNestedClasses() {
|
||||
return ((ICPPClassType) fDelegate).getNestedClasses();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSameType(IType type) {
|
||||
return ((ICPPClassType) fDelegate).isSameType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAnonymous() {
|
||||
return ((ICPPClassType) fDelegate).isAnonymous();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2011, 2012 Wind River Systems, 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
|
||||
|
@ -10,6 +10,7 @@
|
|||
* Freescale Semiconductor - refactoring
|
||||
* Patrick Chuong (Texas Instruments) - Bug 329682
|
||||
* Patrick Chuong (Texas Instruments) - Bug 353351
|
||||
* Patrick Chuong (Texas Instruments) - Bug 364405
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.disassembly.dsf;
|
||||
|
||||
|
@ -17,6 +18,7 @@ import java.math.BigInteger;
|
|||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
import org.eclipse.jface.text.source.IAnnotationModel;
|
||||
|
||||
public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend {
|
||||
|
||||
|
@ -63,4 +65,10 @@ public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Do nothing, sub-class can override to update PC annotation.
|
||||
*/
|
||||
public void updateExtendedPCAnnotation(IAnnotationModel model) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010, 2011 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2010, 2012 Wind River Systems, 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
|
||||
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* Wind River Systems - initial API and implementation
|
||||
* Freescale Semiconductor - refactoring
|
||||
* Patrick Chuong (Texas Instruments) - Bug 364405
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.disassembly.dsf;
|
||||
|
||||
|
@ -15,6 +16,7 @@ import java.math.BigInteger;
|
|||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.jface.text.Position;
|
||||
import org.eclipse.jface.text.source.IAnnotationModel;
|
||||
|
||||
/**
|
||||
* This is the main interface that connects the DSF Disassembly view to CDI and
|
||||
|
@ -191,4 +193,9 @@ public interface IDisassemblyBackend {
|
|||
* Called when the Disassembly view has no further use for this backend.
|
||||
*/
|
||||
void dispose();
|
||||
|
||||
/**
|
||||
* Update the extended PC annotation.
|
||||
*/
|
||||
void updateExtendedPCAnnotation(IAnnotationModel model);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010, 2011 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2010, 2012 Wind River Systems, 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
|
||||
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* Wind River Systems - initial API and implementation
|
||||
* Freescale Semiconductor - refactoring
|
||||
* Patrick Chuong (Texas Instruments) - Bug 364405
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.disassembly.dsf;
|
||||
|
||||
|
@ -35,4 +36,8 @@ public interface IDisassemblyDocument {
|
|||
BigInteger address, int length, String functionOffset, BigInteger opcode,
|
||||
String instruction, String compilationPath, int lineNumber)
|
||||
throws BadLocationException;
|
||||
|
||||
AddressRangePosition getDisassemblyPosition(BigInteger address);
|
||||
BigInteger getAddressOfLine(int line);
|
||||
int getNumberOfLines();
|
||||
}
|
||||
|
|
|
@ -10,30 +10,31 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.service.command;
|
||||
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
||||
/**
|
||||
* With GDB 7.4, the command 'maintenance set python print-stack' is not supported.
|
||||
* The new command "set python print-stack none|full|message" has replaced it, with
|
||||
* the default being 'message'. With this new default
|
||||
* The new command "set python print-stack none|full|message" has replaced it.
|
||||
* @since 4.1
|
||||
*/
|
||||
public class GDBControl_7_4 extends GDBControl_7_2 implements IGDBControl {
|
||||
public GDBControl_7_4(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
|
||||
super(session, config, factory);
|
||||
setUseThreadGroupOptions(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrintPythonErrors(boolean enabled, RequestMonitor rm) {
|
||||
// With GDB 7.4, the command 'maintenance set python print-stack' is not supported.
|
||||
// The new command "set python print-stack none|full|message" has replaced it, with
|
||||
// the default being 'message'. This new default is good enough for us, so no
|
||||
// need to do anything anymore.
|
||||
// Bug 367788
|
||||
rm.done();
|
||||
// With GDB 7.4, the command 'maintenance set python print-stack' has been replaced by
|
||||
// the new command "set python print-stack none|full|message".
|
||||
// Bug 367788
|
||||
String errorOption = enabled ? "full" : "none"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
queueCommand(
|
||||
getCommandFactory().createMIGDBSetPythonPrintStack(getContext(), errorOption),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -15,6 +15,7 @@
|
|||
* Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 237306)
|
||||
* Abeer Bagul - Support for -exec-arguments (bug 337687)
|
||||
* Marc Khouzam (Ericsson) - New methods for new MIDataDisassemble (Bug 357073)
|
||||
* Marc Khouzam (Ericsson) - New method for new MIGDBSetPythonPrintStack (Bug 367788)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.dsf.mi.service.command;
|
||||
|
@ -101,6 +102,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetDetachOnFork;
|
|||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetEnv;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetNonStop;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPagination;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPythonPrintStack;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSchedulerLocking;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSolibAbsolutePrefix;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSolibSearchPath;
|
||||
|
@ -631,6 +633,11 @@ public class CommandFactory {
|
|||
return new MIGDBSetPagination(ctx, isSet);
|
||||
}
|
||||
|
||||
/** @since 4.1 */
|
||||
public ICommand<MIInfo> createMIGDBSetPythonPrintStack(ICommandControlDMContext ctx, String option) {
|
||||
return new MIGDBSetPythonPrintStack(ctx, option);
|
||||
}
|
||||
|
||||
/** @since 4.1 */
|
||||
public ICommand<MIInfo> createMIGDBSetSchedulerLocking(ICommandControlDMContext ctx, String mode) {
|
||||
return new MIGDBSetSchedulerLocking(ctx, mode);
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/*******************************************************************************
|
||||
* 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.debug.service.command.ICommandControlService.ICommandControlDMContext;
|
||||
|
||||
/**
|
||||
*
|
||||
* -gdb-set python print-stack [ none | message | full ]
|
||||
*
|
||||
* By default, gdb will print only the message component of a Python exception when an error occurs
|
||||
* in a Python script. This can be controlled using set python print-stack: if full, then full Python
|
||||
* stack printing is enabled; if none, then Python stack and message printing is disabled; if message,
|
||||
* the default, only the message component of the error is printed.
|
||||
*
|
||||
* Available with GDB 7.4
|
||||
*
|
||||
* @since 4.1
|
||||
*
|
||||
*/
|
||||
public class MIGDBSetPythonPrintStack extends MIGDBSet
|
||||
{
|
||||
public MIGDBSetPythonPrintStack(ICommandControlDMContext ctx, String option) {
|
||||
super(ctx, new String[] {"python", "print-stack", option}); //$NON-NLS-1$//$NON-NLS-2$
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2011 Wind River Systems and others.
|
||||
* Copyright (c) 2007, 2012 Wind River Systems 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
|
||||
|
@ -7,10 +7,11 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Wind River Systems - initial API and implementation
|
||||
* Patrick Chuong (Texas Instruments) - Bug fix (326670)
|
||||
* Patrick Chuong (Texas Instruments) - Bug fix (329682)
|
||||
* Patrick Chuong (Texas Instruments) - bug fix (330259)
|
||||
* Patrick Chuong (Texas Instruments) - Bug 326670
|
||||
* Patrick Chuong (Texas Instruments) - Bug 329682
|
||||
* Patrick Chuong (Texas Instruments) - bug 330259
|
||||
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
|
||||
* Patrick Chuong (Texas Instruments) - Bug 364405
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
||||
|
||||
|
@ -56,6 +57,7 @@ import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocume
|
|||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.SourceFileInfo;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.preferences.DisassemblyPreferenceConstants;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.presentation.DisassemblyIPAnnotation;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblyAnnotationModel;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblyRulerColumn;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblyViewer;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
|
@ -196,6 +198,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
* Annotation model attachment key for breakpoint annotations.
|
||||
*/
|
||||
private final static String BREAKPOINT_ANNOTATIONS= "breakpoints"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Annotation model attachment key for extended PC annotations.
|
||||
*/
|
||||
private final static String EXTENDED_PC_ANNOTATIONS = "ExtendedPCAnnotations"; //$NON-NLS-1$
|
||||
|
||||
private final static BigInteger PC_UNKNOWN = BigInteger.valueOf(-1);
|
||||
private final static BigInteger PC_RUNNING = BigInteger.valueOf(-2);
|
||||
|
@ -354,6 +361,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
private Action fJumpToAddressAction = new JumpToAddressAction(this);
|
||||
|
||||
private IDebugContextListener fDebugContextListener;
|
||||
private DisassemblyAnnotationModel fExtPCAnnotationModel;
|
||||
|
||||
private IColumnSupport fColumnSupport;
|
||||
|
||||
|
@ -1849,7 +1857,10 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
fDebugSessionId = null;
|
||||
boolean needUpdate = false;
|
||||
if (context != null) {
|
||||
if (prevBackend != null && prevBackend.supportsDebugContext(context)) {
|
||||
IDisassemblyBackend contextBackend = (IDisassemblyBackend)context.getAdapter(IDisassemblyBackend.class);
|
||||
// Need to compare the backend classes to prevent reusing the same backend object.
|
||||
// sub class can overwrite the standard disassembly backend to provide its own customization.
|
||||
if ((prevBackend != null) && (contextBackend != null) && prevBackend.getClass().equals(contextBackend.getClass()) && prevBackend.supportsDebugContext(context)) {
|
||||
newBackend = prevBackend;
|
||||
} else {
|
||||
needUpdate = true;
|
||||
|
@ -1957,6 +1968,15 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
firePropertyChange(PROP_SUSPENDED);
|
||||
}
|
||||
|
||||
private void attachExtendedPCAnnotationModel() {
|
||||
IAnnotationModel annotationModel = fViewer.getAnnotationModel();
|
||||
if (annotationModel instanceof IAnnotationModelExtension) {
|
||||
IAnnotationModelExtension ame= (IAnnotationModelExtension) annotationModel;
|
||||
fExtPCAnnotationModel = new DisassemblyAnnotationModel();
|
||||
ame.addAnnotationModel(EXTENDED_PC_ANNOTATIONS, fExtPCAnnotationModel);
|
||||
}
|
||||
}
|
||||
|
||||
private void attachBreakpointsAnnotationModel() {
|
||||
IAnnotationModel annotationModel = fViewer.getAnnotationModel();
|
||||
if (annotationModel instanceof IAnnotationModelExtension) {
|
||||
|
@ -2030,6 +2050,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
|
||||
private void resetViewer() {
|
||||
// clear all state and cache
|
||||
fExtPCAnnotationModel = null;
|
||||
fPCAnnotationUpdatePending = false;
|
||||
fGotoFramePending = false;
|
||||
fPCAddress = fFrameAddress = PC_RUNNING;
|
||||
|
@ -2044,6 +2065,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
fViewer.setDocument(fDocument, new AnnotationModel());
|
||||
if (fDebugSessionId != null) {
|
||||
attachBreakpointsAnnotationModel();
|
||||
attachExtendedPCAnnotationModel();
|
||||
fDocument.insertInvalidAddressRange(0, 0, fStartAddress, fEndAddress);
|
||||
}
|
||||
}
|
||||
|
@ -2457,6 +2479,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
pos = updateAddressAnnotation(fSecondaryPCAnnotation, fFrameAddress);
|
||||
}
|
||||
fPCAnnotationUpdatePending = pos == null && fFrameAddress.compareTo(BigInteger.ZERO) >= 0;
|
||||
|
||||
if (fExtPCAnnotationModel != null) {
|
||||
fBackend.updateExtendedPCAnnotation(fExtPCAnnotationModel);
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
bin.includes = feature.xml
|
||||
bin.includes = feature.xml,\
|
||||
eclipse_update_120.jpg,\
|
||||
epl-v10.html,\
|
||||
feature.properties,\
|
||||
license.html
|
||||
|
|
|
@ -19,3 +19,4 @@ bin.includes = META-INF/,\
|
|||
plugin.properties,\
|
||||
about.properties,\
|
||||
cdt_logo_icon32.png
|
||||
src.includes = about.html
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
bin.includes = feature.xml
|
||||
bin.includes = feature.xml,\
|
||||
eclipse_update_120.jpg,\
|
||||
epl-v10.html,\
|
||||
feature.properties,\
|
||||
license.html
|
||||
|
|
Loading…
Add table
Reference in a new issue