mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix warnings.
This commit is contained in:
parent
344265a6a1
commit
4b12c3a302
72 changed files with 838 additions and 966 deletions
|
@ -43,6 +43,7 @@ public class AsmModelBuilderTest extends BaseTestCase {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
fCProject= CProjectHelper.createCProject(getName(), null, IPDOMManager.ID_FAST_INDEXER);
|
fCProject= CProjectHelper.createCProject(getName(), null, IPDOMManager.ID_FAST_INDEXER);
|
||||||
|
@ -52,6 +53,7 @@ public class AsmModelBuilderTest extends BaseTestCase {
|
||||||
assertNotNull(fTU);
|
assertNotNull(fTU);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
CProjectHelper.delete(fCProject);
|
CProjectHelper.delete(fCProject);
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
@ -101,10 +103,10 @@ public class AsmModelBuilderTest extends BaseTestCase {
|
||||||
|
|
||||||
public void testAsmLabelRanges() throws Exception {
|
public void testAsmLabelRanges() throws Exception {
|
||||||
String source= fTU.getBuffer().getContents();
|
String source= fTU.getBuffer().getContents();
|
||||||
ICElement[] labels= (ICElement[]) fTU.getChildrenOfType(ICElement.ASM_LABEL).toArray(new ICElement[0]);
|
ICElement[] labels= fTU.getChildrenOfType(ICElement.ASM_LABEL).toArray(new ICElement[0]);
|
||||||
for (int i = 0; i < labels.length; i++) {
|
for (ICElement label2 : labels) {
|
||||||
String name= labels[i].getElementName();
|
String name= label2.getElementName();
|
||||||
ISourceReference label= (ISourceReference)labels[i];
|
ISourceReference label= (ISourceReference)label2;
|
||||||
ISourceRange range= label.getSourceRange();
|
ISourceRange range= label.getSourceRange();
|
||||||
assertEquals(source.substring(range.getIdStartPos(), range.getIdStartPos() + range.getIdLength()), name);
|
assertEquals(source.substring(range.getIdStartPos(), range.getIdStartPos() + range.getIdLength()), name);
|
||||||
int endOfLabel= source.indexOf("/* end */", range.getIdStartPos());
|
int endOfLabel= source.indexOf("/* end */", range.getIdStartPos());
|
||||||
|
|
|
@ -360,7 +360,7 @@ public class CFunction extends PlatformObject implements IFunction, ICInternalFu
|
||||||
} else if( parent instanceof IASTFunctionDefinition )
|
} else if( parent instanceof IASTFunctionDefinition )
|
||||||
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
||||||
|
|
||||||
if( declSpec.getStorageClass() == storage ) {
|
if( declSpec != null && declSpec.getStorageClass() == storage ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -421,7 +421,7 @@ public class CFunction extends PlatformObject implements IFunction, ICInternalFu
|
||||||
} else if( parent instanceof IASTFunctionDefinition )
|
} else if( parent instanceof IASTFunctionDefinition )
|
||||||
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
||||||
|
|
||||||
if( declSpec.isInline() )
|
if( declSpec != null && declSpec.isInline() )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if( ds != null && ++i < ds.length )
|
if( ds != null && ++i < ds.length )
|
||||||
|
|
|
@ -64,16 +64,17 @@ public class CPPField extends CPPVariable implements ICPPField {
|
||||||
|
|
||||||
public IASTDeclaration getPrimaryDeclaration() throws DOMException{
|
public IASTDeclaration getPrimaryDeclaration() throws DOMException{
|
||||||
//first check if we already know it
|
//first check if we already know it
|
||||||
|
IASTDeclaration decl= findDeclaration(getDefinition());
|
||||||
|
if (decl != null) {
|
||||||
|
return decl;
|
||||||
|
}
|
||||||
|
|
||||||
IASTName [] declarations = (IASTName[]) getDeclarations();
|
IASTName [] declarations = (IASTName[]) getDeclarations();
|
||||||
if( declarations != null || getDefinition() != null ){
|
if (declarations != null) {
|
||||||
int len = ( declarations != null ) ? declarations.length : 0;
|
for (IASTName name : declarations) {
|
||||||
for( int i = -1; i < len; i++ ){
|
decl= findDeclaration(name);
|
||||||
IASTNode node = ( i == -1 ) ? getDefinition() : declarations[i];
|
if (decl != null) {
|
||||||
if( node != null ){
|
return decl;
|
||||||
while( !(node instanceof IASTDeclaration ) )
|
|
||||||
node = node.getParent();
|
|
||||||
if( node.getParent() instanceof ICPPASTCompositeTypeSpecifier )
|
|
||||||
return (IASTDeclaration) node;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,15 +84,15 @@ public class CPPField extends CPPVariable implements ICPPField {
|
||||||
ICPPClassScope scope = (ICPPClassScope) getScope();
|
ICPPClassScope scope = (ICPPClassScope) getScope();
|
||||||
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) ASTInternal.getPhysicalNodeOfScope(scope);
|
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) ASTInternal.getPhysicalNodeOfScope(scope);
|
||||||
IASTDeclaration [] members = compSpec.getMembers();
|
IASTDeclaration [] members = compSpec.getMembers();
|
||||||
for( int i = 0; i < members.length; i++ ){
|
for (IASTDeclaration member : members) {
|
||||||
if( members[i] instanceof IASTSimpleDeclaration ){
|
if( member instanceof IASTSimpleDeclaration ){
|
||||||
IASTDeclarator [] dtors = ((IASTSimpleDeclaration)members[i]).getDeclarators();
|
IASTDeclarator [] dtors = ((IASTSimpleDeclaration)member).getDeclarators();
|
||||||
for( int j = 0; j < dtors.length; j++ ){
|
for (IASTDeclarator dtor : dtors) {
|
||||||
IASTName name = dtors[j].getName();
|
IASTName name = dtor.getName();
|
||||||
if( CharArrayUtils.equals( name.toCharArray(), myName ) &&
|
if( CharArrayUtils.equals( name.toCharArray(), myName ) &&
|
||||||
name.resolveBinding() == this )
|
name.resolveBinding() == this )
|
||||||
{
|
{
|
||||||
return members[i];
|
return member;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,6 +100,16 @@ public class CPPField extends CPPVariable implements ICPPField {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IASTDeclaration findDeclaration(IASTNode node) {
|
||||||
|
while(node != null && node instanceof IASTDeclaration == false) {
|
||||||
|
node = node.getParent();
|
||||||
|
}
|
||||||
|
if (node != null && node.getParent() instanceof ICPPASTCompositeTypeSpecifier) {
|
||||||
|
return (IASTDeclaration) node;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public int getVisibility() throws DOMException {
|
public int getVisibility() throws DOMException {
|
||||||
ICPPASTVisibilityLabel vis = null;
|
ICPPASTVisibilityLabel vis = null;
|
||||||
IASTDeclaration decl = getPrimaryDeclaration();
|
IASTDeclaration decl = getPrimaryDeclaration();
|
||||||
|
@ -106,10 +117,10 @@ public class CPPField extends CPPVariable implements ICPPField {
|
||||||
IASTCompositeTypeSpecifier cls = (IASTCompositeTypeSpecifier) decl.getParent();
|
IASTCompositeTypeSpecifier cls = (IASTCompositeTypeSpecifier) decl.getParent();
|
||||||
IASTDeclaration [] members = cls.getMembers();
|
IASTDeclaration [] members = cls.getMembers();
|
||||||
|
|
||||||
for( int i = 0; i < members.length; i++ ){
|
for (IASTDeclaration member : members) {
|
||||||
if( members[i] instanceof ICPPASTVisibilityLabel )
|
if( member instanceof ICPPASTVisibilityLabel )
|
||||||
vis = (ICPPASTVisibilityLabel) members[i];
|
vis = (ICPPASTVisibilityLabel) member;
|
||||||
else if( members[i] == decl )
|
else if( member == decl )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
||||||
*/
|
*/
|
||||||
public class CPPFieldSpecialization extends CPPSpecialization implements ICPPField {
|
public class CPPFieldSpecialization extends CPPSpecialization implements ICPPField {
|
||||||
private IType type = null;
|
private IType type = null;
|
||||||
/**
|
|
||||||
* @param orig
|
|
||||||
* @param args
|
|
||||||
* @param args
|
|
||||||
*/
|
|
||||||
public CPPFieldSpecialization( IBinding orig, ICPPScope scope, ObjectMap argMap ) {
|
public CPPFieldSpecialization( IBinding orig, ICPPScope scope, ObjectMap argMap ) {
|
||||||
super(orig, scope, argMap);
|
super(orig, scope, argMap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -448,7 +448,7 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
||||||
} else if (parent instanceof IASTFunctionDefinition) {
|
} else if (parent instanceof IASTFunctionDefinition) {
|
||||||
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
||||||
}
|
}
|
||||||
if (declSpec.getStorageClass() == storage) {
|
if (declSpec != null && declSpec.getStorageClass() == storage) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
||||||
else if (parent instanceof IASTFunctionDefinition)
|
else if (parent instanceof IASTFunctionDefinition)
|
||||||
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
||||||
|
|
||||||
if (declSpec.isInline())
|
if (declSpec != null && declSpec.isInline())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (ds != null && ++i < ds.length)
|
if (ds != null && ++i < ds.length)
|
||||||
|
@ -498,8 +498,8 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
|
||||||
}
|
}
|
||||||
IASTNode[] ds= getDeclarations();
|
IASTNode[] ds= getDeclarations();
|
||||||
if (ds != null) {
|
if (ds != null) {
|
||||||
for (int i = 0; i < ds.length; i++) {
|
for (IASTNode element : ds) {
|
||||||
if (CPPVisitor.isExternC(ds[i])) {
|
if (CPPVisitor.isExternC(element)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
||||||
declSpec = ((IASTSimpleDeclaration)parent).getDeclSpecifier();
|
declSpec = ((IASTSimpleDeclaration)parent).getDeclSpecifier();
|
||||||
else if( parent instanceof IASTFunctionDefinition )
|
else if( parent instanceof IASTFunctionDefinition )
|
||||||
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
||||||
if( declSpec.getStorageClass() == storage ) {
|
if( declSpec != null && declSpec.getStorageClass() == storage ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
||||||
else if( parent instanceof IASTFunctionDefinition )
|
else if( parent instanceof IASTFunctionDefinition )
|
||||||
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
||||||
|
|
||||||
if( declSpec.isInline() )
|
if( declSpec != null && declSpec.isInline() )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if( ns != null && ++i < ns.length )
|
if( ns != null && ++i < ns.length )
|
||||||
|
@ -307,8 +307,8 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
||||||
}
|
}
|
||||||
IASTNode[] ds= getDeclarations();
|
IASTNode[] ds= getDeclarations();
|
||||||
if (ds != null) {
|
if (ds != null) {
|
||||||
for (int i = 0; i < ds.length; i++) {
|
for (IASTNode element : ds) {
|
||||||
if (CPPVisitor.isExternC(ds[i])) {
|
if (CPPVisitor.isExternC(element)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,10 +56,10 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
|
||||||
IASTCompositeTypeSpecifier cls = (IASTCompositeTypeSpecifier) decl.getParent();
|
IASTCompositeTypeSpecifier cls = (IASTCompositeTypeSpecifier) decl.getParent();
|
||||||
IASTDeclaration [] members = cls.getMembers();
|
IASTDeclaration [] members = cls.getMembers();
|
||||||
ICPPASTVisibilityLabel vis = null;
|
ICPPASTVisibilityLabel vis = null;
|
||||||
for( int i = 0; i < members.length; i++ ){
|
for (IASTDeclaration member : members) {
|
||||||
if( members[i] instanceof ICPPASTVisibilityLabel )
|
if( member instanceof ICPPASTVisibilityLabel )
|
||||||
vis = (ICPPASTVisibilityLabel) members[i];
|
vis = (ICPPASTVisibilityLabel) member;
|
||||||
else if( members[i] == decl )
|
else if( member == decl )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( vis != null ){
|
if( vis != null ){
|
||||||
|
@ -78,11 +78,11 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
|
||||||
public IASTDeclaration getPrimaryDeclaration() throws DOMException{
|
public IASTDeclaration getPrimaryDeclaration() throws DOMException{
|
||||||
//first check if we already know it
|
//first check if we already know it
|
||||||
if( declarations != null ){
|
if( declarations != null ){
|
||||||
for( int i = 0; i < declarations.length; i++ ){
|
for (ICPPASTFunctionDeclarator declaration : declarations) {
|
||||||
if (declarations[i] == null) {
|
if (declaration == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
IASTDeclaration decl = (IASTDeclaration) declarations[i].getParent();
|
IASTDeclaration decl = (IASTDeclaration) declaration.getParent();
|
||||||
if( decl.getParent() instanceof ICPPASTCompositeTypeSpecifier )
|
if( decl.getParent() instanceof ICPPASTCompositeTypeSpecifier )
|
||||||
return decl;
|
return decl;
|
||||||
}
|
}
|
||||||
|
@ -96,12 +96,11 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
IASTDeclaration [] members = compSpec.getMembers();
|
IASTDeclaration [] members = compSpec.getMembers();
|
||||||
for( int i = 0; i < members.length; i++ ){
|
for (IASTDeclaration member : members) {
|
||||||
IASTDeclarator dtor = null;
|
IASTDeclarator dtor = null;
|
||||||
IASTDeclarator [] ds = null;
|
IASTDeclarator [] ds = null;
|
||||||
int di = -1;
|
int di = -1;
|
||||||
|
|
||||||
IASTDeclaration member = members[i];
|
|
||||||
if( member instanceof ICPPASTTemplateDeclaration )
|
if( member instanceof ICPPASTTemplateDeclaration )
|
||||||
member = ((ICPPASTTemplateDeclaration) member).getDeclaration();
|
member = ((ICPPASTTemplateDeclaration) member).getDeclaration();
|
||||||
if( member instanceof IASTSimpleDeclaration ){
|
if( member instanceof IASTSimpleDeclaration ){
|
||||||
|
@ -112,8 +111,6 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
|
||||||
if( ds != null && ds.length > 0 ){
|
if( ds != null && ds.length > 0 ){
|
||||||
di = 0;
|
di = 0;
|
||||||
dtor = ds[0];
|
dtor = ds[0];
|
||||||
}
|
|
||||||
|
|
||||||
while( dtor != null ){
|
while( dtor != null ){
|
||||||
IASTName name = dtor.getName();
|
IASTName name = dtor.getName();
|
||||||
if( dtor instanceof ICPPASTFunctionDeclarator &&
|
if( dtor instanceof ICPPASTFunctionDeclarator &&
|
||||||
|
@ -148,12 +145,13 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
|
||||||
addDeclaration( dtor );
|
addDeclaration( dtor );
|
||||||
else if( member instanceof IASTFunctionDefinition )
|
else if( member instanceof IASTFunctionDefinition )
|
||||||
addDefinition( dtor );
|
addDefinition( dtor );
|
||||||
return members[i];
|
return member;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dtor = ( di > -1 && ++ di < ds.length ) ? ds[di] : null;
|
dtor = ( di > -1 && ++ di < ds.length ) ? ds[di] : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ public interface ICPPInternalDeferredClassInstance {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* instantiate the original template
|
* instantiate the original template
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public IType instantiate(ObjectMap argMap);
|
public IType instantiate(ObjectMap argMap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,5 @@ import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||||
public interface ICPPInternalUnknown extends ICPPInternalBinding {
|
public interface ICPPInternalUnknown extends ICPPInternalBinding {
|
||||||
public ICPPScope getUnknownScope();
|
public ICPPScope getUnknownScope();
|
||||||
|
|
||||||
/**
|
|
||||||
* @param argMap
|
|
||||||
* @return
|
|
||||||
* @throws DOMException
|
|
||||||
*/
|
|
||||||
public IBinding resolveUnknown(ObjectMap argMap) throws DOMException;
|
public IBinding resolveUnknown(ObjectMap argMap) throws DOMException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -398,8 +398,7 @@ public class CPPSemantics {
|
||||||
IType[] ps = getSourceParameterTypes(data.functionParameters);
|
IType[] ps = getSourceParameterTypes(data.functionParameters);
|
||||||
ObjectSet<IScope> namespaces = new ObjectSet<IScope>(2);
|
ObjectSet<IScope> namespaces = new ObjectSet<IScope>(2);
|
||||||
ObjectSet<ICPPClassType> classes = new ObjectSet<ICPPClassType>(2);
|
ObjectSet<ICPPClassType> classes = new ObjectSet<ICPPClassType>(2);
|
||||||
for (int i = 0; i < ps.length; i++) {
|
for (IType p : ps) {
|
||||||
IType p = ps[i];
|
|
||||||
p = getUltimateType(p, true);
|
p = getUltimateType(p, true);
|
||||||
try {
|
try {
|
||||||
getAssociatedScopes(p, namespaces, classes, data.tu);
|
getAssociatedScopes(p, namespaces, classes, data.tu);
|
||||||
|
@ -421,10 +420,10 @@ public class CPPSemantics {
|
||||||
|
|
||||||
ICPPClassType cls = (ICPPClassType) t;
|
ICPPClassType cls = (ICPPClassType) t;
|
||||||
ICPPBase[] bases = cls.getBases();
|
ICPPBase[] bases = cls.getBases();
|
||||||
for (int i = 0; i < bases.length; i++) {
|
for (ICPPBase base : bases) {
|
||||||
if (bases[i] instanceof IProblemBinding)
|
if (base instanceof IProblemBinding)
|
||||||
continue;
|
continue;
|
||||||
IBinding b = bases[i].getBaseClass();
|
IBinding b = base.getBaseClass();
|
||||||
if (b instanceof IType)
|
if (b instanceof IType)
|
||||||
getAssociatedScopes((IType) b, namespaces, classes, tu);
|
getAssociatedScopes((IType) b, namespaces, classes, tu);
|
||||||
}
|
}
|
||||||
|
@ -438,8 +437,8 @@ public class CPPSemantics {
|
||||||
|
|
||||||
getAssociatedScopes(getUltimateType(ft.getReturnType(), true), namespaces, classes, tu);
|
getAssociatedScopes(getUltimateType(ft.getReturnType(), true), namespaces, classes, tu);
|
||||||
IType[] ps = ft.getParameterTypes();
|
IType[] ps = ft.getParameterTypes();
|
||||||
for (int i = 0; i < ps.length; i++) {
|
for (IType element : ps) {
|
||||||
getAssociatedScopes(getUltimateType(ps[i], true), namespaces, classes, tu);
|
getAssociatedScopes(getUltimateType(element, true), namespaces, classes, tu);
|
||||||
}
|
}
|
||||||
} else if (t instanceof ICPPPointerToMemberType) {
|
} else if (t instanceof ICPPPointerToMemberType) {
|
||||||
IBinding binding = ((ICPPPointerToMemberType)t).getMemberOfClass();
|
IBinding binding = ((ICPPPointerToMemberType)t).getMemberOfClass();
|
||||||
|
@ -511,29 +510,36 @@ public class CPPSemantics {
|
||||||
|
|
||||||
CharArrayObjectMap map = null;
|
CharArrayObjectMap map = null;
|
||||||
Object[] objs = null;
|
Object[] objs = null;
|
||||||
|
int size;
|
||||||
if (source instanceof CharArrayObjectMap) {
|
if (source instanceof CharArrayObjectMap) {
|
||||||
map = (CharArrayObjectMap) source;
|
map = (CharArrayObjectMap) source;
|
||||||
|
size= map.size();
|
||||||
} else {
|
} else {
|
||||||
if (source instanceof Object[])
|
if (source instanceof Object[])
|
||||||
objs = ArrayUtil.trim(Object.class, (Object[]) source);
|
objs = ArrayUtil.trim(Object.class, (Object[]) source);
|
||||||
else
|
else
|
||||||
objs = new Object[]{ source };
|
objs = new Object[]{ source };
|
||||||
|
size= objs.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
int size = map != null ? map.size() : objs.length;
|
|
||||||
int resultInitialSize = resultMap.size();
|
int resultInitialSize = resultMap.size();
|
||||||
for (int i = 0; i < size; i ++) {
|
for (int i = 0; i < size; i ++) {
|
||||||
char[] key = (map != null) ?
|
char[] key;
|
||||||
map.keyAt(i) :
|
Object so;
|
||||||
(objs[i] instanceof IBinding) ?
|
if (map != null) {
|
||||||
((IBinding) objs[i]).getNameCharArray() :
|
key= map.keyAt(i);
|
||||||
((IASTName) objs[i]).toCharArray();
|
so= map.get(key);
|
||||||
|
} else if (objs != null) {
|
||||||
|
so= objs[i];
|
||||||
|
key= (so instanceof IBinding) ? ((IBinding) so).getNameCharArray() : ((IASTName) so).toCharArray();
|
||||||
|
} else {
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
int idx = resultMap.lookup(key);
|
int idx = resultMap.lookup(key);
|
||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
resultMap.put(key, (map != null) ? map.get(key) : objs[i]);
|
resultMap.put(key, so);
|
||||||
} else if (!scoped || idx >= resultInitialSize) {
|
} else if (!scoped || idx >= resultInitialSize) {
|
||||||
Object obj = resultMap.get(key);
|
Object obj = resultMap.get(key);
|
||||||
Object so = (map != null) ? map.get(key) : objs[i];
|
|
||||||
if (obj instanceof Object[]) {
|
if (obj instanceof Object[]) {
|
||||||
if (so instanceof IBinding || so instanceof IASTName)
|
if (so instanceof IBinding || so instanceof IASTName)
|
||||||
obj = ArrayUtil.append(Object.class, (Object[]) obj, so);
|
obj = ArrayUtil.append(Object.class, (Object[]) obj, so);
|
||||||
|
@ -621,9 +627,11 @@ public class CPPSemantics {
|
||||||
if (inScope != null) {
|
if (inScope != null) {
|
||||||
if (data.contentAssist) {
|
if (data.contentAssist) {
|
||||||
Object[] objs = ArrayUtil.addAll(Object.class, null, inScope);
|
Object[] objs = ArrayUtil.addAll(Object.class, null, inScope);
|
||||||
for (int i = 0; i < b.length; i++) {
|
if (b != null) {
|
||||||
if (isFromIndex(b[i]))
|
for (IBinding element : b) {
|
||||||
objs = ArrayUtil.append(Object.class, objs, b[i]);
|
if (isFromIndex(element))
|
||||||
|
objs = ArrayUtil.append(Object.class, objs, element);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mergeResults(data, objs, true);
|
mergeResults(data, objs, true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -650,8 +658,7 @@ public class CPPSemantics {
|
||||||
ICPPUsingDirective[] uds= blockScope.getUsingDirectives();
|
ICPPUsingDirective[] uds= blockScope.getUsingDirectives();
|
||||||
if (uds != null && uds.length > 0) {
|
if (uds != null && uds.length > 0) {
|
||||||
HashSet<ICPPNamespaceScope> handled= new HashSet<ICPPNamespaceScope>();
|
HashSet<ICPPNamespaceScope> handled= new HashSet<ICPPNamespaceScope>();
|
||||||
for (int i = 0; i < uds.length; i++) {
|
for (final ICPPUsingDirective ud : uds) {
|
||||||
final ICPPUsingDirective ud = uds[i];
|
|
||||||
if (CPPSemantics.declaredBefore(ud, data.astName, false)) {
|
if (CPPSemantics.declaredBefore(ud, data.astName, false)) {
|
||||||
storeUsingDirective(data, blockScope, ud, handled);
|
storeUsingDirective(data, blockScope, ud, handled);
|
||||||
}
|
}
|
||||||
|
@ -851,11 +858,11 @@ public class CPPSemantics {
|
||||||
|
|
||||||
ICPPBase[] bases = cls.getBases();
|
ICPPBase[] bases = cls.getBases();
|
||||||
|
|
||||||
for (int i = 0; i < bases.length; i++) {
|
for (ICPPBase base : bases) {
|
||||||
IBinding b = bases[i].getBaseClass();
|
IBinding b = base.getBaseClass();
|
||||||
if (b instanceof ICPPClassType) {
|
if (b instanceof ICPPClassType) {
|
||||||
IScope bScope = ((ICPPClassType)b).getCompositeScope();
|
IScope bScope = ((ICPPClassType)b).getCompositeScope();
|
||||||
if (bases[i].isVirtual()) {
|
if (base.isVirtual()) {
|
||||||
if (bScope != null)
|
if (bScope != null)
|
||||||
data.visited.put(bScope);
|
data.visited.put(bScope);
|
||||||
} else if (bScope != null) {
|
} else if (bScope != null) {
|
||||||
|
@ -879,9 +886,16 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
|
|
||||||
IBinding binding= (n instanceof IBinding) ? (IBinding) n : ((IASTName) n).resolveBinding();
|
IBinding binding= (n instanceof IBinding) ? (IBinding) n : ((IASTName) n).resolveBinding();
|
||||||
Object[] objs = (names instanceof Object[]) ? (Object[])names : null;
|
|
||||||
int idx = (objs != null && objs.length > 0) ? 0 : -1;
|
int idx= 0;
|
||||||
Object o = (idx != -1) ? objs[idx++] : names;
|
Object[] objs= null;
|
||||||
|
Object o= names;
|
||||||
|
if (names instanceof Object[]) {
|
||||||
|
objs= (Object[]) names;
|
||||||
|
o= objs[0];
|
||||||
|
idx= 1;
|
||||||
|
}
|
||||||
|
|
||||||
while (o != null) {
|
while (o != null) {
|
||||||
IBinding b = (o instanceof IBinding) ? (IBinding) o : ((IASTName)o).resolveBinding();
|
IBinding b = (o instanceof IBinding) ? (IBinding) o : ((IASTName)o).resolveBinding();
|
||||||
|
|
||||||
|
@ -910,7 +924,7 @@ public class CPPSemantics {
|
||||||
if (!ok)
|
if (!ok)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (idx > -1 && idx < objs.length)
|
if (objs != null && idx < objs.length)
|
||||||
o = objs[idx++];
|
o = objs[idx++];
|
||||||
else
|
else
|
||||||
o = null;
|
o = null;
|
||||||
|
@ -955,8 +969,8 @@ public class CPPSemantics {
|
||||||
data.tu.handleAdditionalDirectives(nominated);
|
data.tu.handleAdditionalDirectives(nominated);
|
||||||
}
|
}
|
||||||
ICPPUsingDirective[] transitive= nominated.getUsingDirectives();
|
ICPPUsingDirective[] transitive= nominated.getUsingDirectives();
|
||||||
for (int i = 0; i < transitive.length; i++) {
|
for (ICPPUsingDirective element : transitive) {
|
||||||
storeUsingDirective(data, container, transitive[i], handled);
|
storeUsingDirective(data, container, element, handled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1033,8 +1047,7 @@ public class CPPSemantics {
|
||||||
//need binding because namespaces can be split
|
//need binding because namespaces can be split
|
||||||
CPPNamespace namespace = (CPPNamespace) ((ICPPASTNamespaceDefinition)parent).getName().resolveBinding();
|
CPPNamespace namespace = (CPPNamespace) ((ICPPASTNamespaceDefinition)parent).getName().resolveBinding();
|
||||||
namespaceDefs = namespace.getNamespaceDefinitions();
|
namespaceDefs = namespace.getNamespaceDefinitions();
|
||||||
namespaceIdx= 0;
|
nodes = ((ICPPASTNamespaceDefinition)namespaceDefs[++namespaceIdx].getParent()).getDeclarations();
|
||||||
nodes = ((ICPPASTNamespaceDefinition)namespaceDefs[namespaceIdx].getParent()).getDeclarations();
|
|
||||||
while (nodes.length == 0 && ++namespaceIdx < namespaceDefs.length) {
|
while (nodes.length == 0 && ++namespaceIdx < namespaceDefs.length) {
|
||||||
nodes= ((ICPPASTNamespaceDefinition)namespaceDefs[namespaceIdx].getParent()).getDeclarations();
|
nodes= ((ICPPASTNamespaceDefinition)namespaceDefs[namespaceIdx].getParent()).getDeclarations();
|
||||||
}
|
}
|
||||||
|
@ -1108,14 +1121,14 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idx > -1 && ++idx < nodes.length) {
|
if (nodes != null && ++idx < nodes.length) {
|
||||||
item = nodes[idx];
|
item = nodes[idx];
|
||||||
} else {
|
} else {
|
||||||
item = null;
|
item = null;
|
||||||
while (item == null) {
|
while (true) {
|
||||||
if (namespaceIdx > -1) {
|
if (namespaceDefs != null) {
|
||||||
//check all definitions of this namespace
|
//check all definitions of this namespace
|
||||||
while (namespaceIdx > -1 && namespaceDefs.length > ++namespaceIdx) {
|
while (++namespaceIdx < namespaceDefs.length) {
|
||||||
nodes = ((ICPPASTNamespaceDefinition)namespaceDefs[namespaceIdx].getParent()).getDeclarations();
|
nodes = ((ICPPASTNamespaceDefinition)namespaceDefs[namespaceIdx].getParent()).getDeclarations();
|
||||||
if (nodes.length > 0) {
|
if (nodes.length > 0) {
|
||||||
idx = 0;
|
idx = 0;
|
||||||
|
@ -1136,14 +1149,14 @@ public class CPPSemantics {
|
||||||
parent = ((ICPPASTCatchHandler)parent).getCatchBody();
|
parent = ((ICPPASTCatchHandler)parent).getCatchBody();
|
||||||
if (parent instanceof IASTCompoundStatement) {
|
if (parent instanceof IASTCompoundStatement) {
|
||||||
nodes = ((IASTCompoundStatement)parent).getStatements();
|
nodes = ((IASTCompoundStatement)parent).getStatements();
|
||||||
}
|
|
||||||
if (nodes.length > 0) {
|
if (nodes.length > 0) {
|
||||||
idx = 0;
|
idx = 0;
|
||||||
item = nodes[0];
|
item = nodes[0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (item == null && nodeStackPos >= 0) {
|
}
|
||||||
|
if (item == null && nodeStack != null && nodeIdxStack != null && nodeStackPos >= 0) {
|
||||||
nodes = nodeStack[nodeStackPos];
|
nodes = nodeStack[nodeStackPos];
|
||||||
nodeStack[nodeStackPos] = null;
|
nodeStack[nodeStackPos] = null;
|
||||||
idx = nodeIdxStack[nodeStackPos--];
|
idx = nodeIdxStack[nodeStackPos--];
|
||||||
|
@ -1200,8 +1213,7 @@ public class CPPSemantics {
|
||||||
data.tu.handleAdditionalDirectives(nominated);
|
data.tu.handleAdditionalDirectives(nominated);
|
||||||
}
|
}
|
||||||
ICPPUsingDirective[] usings= nominated.getUsingDirectives();
|
ICPPUsingDirective[] usings= nominated.getUsingDirectives();
|
||||||
for (int i = 0; i < usings.length; i++) {
|
for (ICPPUsingDirective using : usings) {
|
||||||
ICPPUsingDirective using = usings[i];
|
|
||||||
storeUsingDirective(data, scope, using, null);
|
storeUsingDirective(data, scope, using, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1273,8 +1285,7 @@ public class CPPSemantics {
|
||||||
ICPPASTDeclSpecifier declSpec = (ICPPASTDeclSpecifier) simpleDeclaration.getDeclSpecifier();
|
ICPPASTDeclSpecifier declSpec = (ICPPASTDeclSpecifier) simpleDeclaration.getDeclSpecifier();
|
||||||
IASTDeclarator[] declarators = simpleDeclaration.getDeclarators();
|
IASTDeclarator[] declarators = simpleDeclaration.getDeclarators();
|
||||||
if (!declSpec.isFriend()) {
|
if (!declSpec.isFriend()) {
|
||||||
for (int i = 0; i < declarators.length; i++) {
|
for (IASTDeclarator declarator : declarators) {
|
||||||
IASTDeclarator declarator = declarators[i];
|
|
||||||
while (declarator.getNestedDeclarator() != null)
|
while (declarator.getNestedDeclarator() != null)
|
||||||
declarator = declarator.getNestedDeclarator();
|
declarator = declarator.getNestedDeclarator();
|
||||||
IASTName declaratorName = declarator.getName();
|
IASTName declaratorName = declarator.getName();
|
||||||
|
@ -1307,8 +1318,8 @@ public class CPPSemantics {
|
||||||
{
|
{
|
||||||
Object o = null;
|
Object o = null;
|
||||||
IASTDeclaration[] decls = compSpec.getMembers();
|
IASTDeclaration[] decls = compSpec.getMembers();
|
||||||
for (int i = 0; i < decls.length; i++) {
|
for (IASTDeclaration decl : decls) {
|
||||||
o = collectResult(data, scope, decls[i], checkAux);
|
o = collectResult(data, scope, decl, checkAux);
|
||||||
if (o instanceof IASTName) {
|
if (o instanceof IASTName) {
|
||||||
if (resultName == null)
|
if (resultName == null)
|
||||||
resultName = (IASTName) o;
|
resultName = (IASTName) o;
|
||||||
|
@ -1338,8 +1349,7 @@ public class CPPSemantics {
|
||||||
//check enumerators too
|
//check enumerators too
|
||||||
IASTEnumerator[] list = enumeration.getEnumerators();
|
IASTEnumerator[] list = enumeration.getEnumerators();
|
||||||
IASTName tempName;
|
IASTName tempName;
|
||||||
for (int i = 0; i < list.length; i++) {
|
for (IASTEnumerator enumerator : list) {
|
||||||
IASTEnumerator enumerator = list[i];
|
|
||||||
if (enumerator == null) break;
|
if (enumerator == null) break;
|
||||||
tempName = enumerator.getName();
|
tempName = enumerator.getName();
|
||||||
ASTInternal.addName(scope, tempName);
|
ASTInternal.addName(scope, tempName);
|
||||||
|
@ -1460,11 +1470,11 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
|
|
||||||
IBinding[] result = null;
|
IBinding[] result = null;
|
||||||
for (int i = 0; i < bindings.length; i++) {
|
for (Object binding : bindings) {
|
||||||
if (bindings[i] instanceof IASTName)
|
if (binding instanceof IASTName)
|
||||||
result = (IBinding[]) ArrayUtil.append(IBinding.class, result, ((IASTName)bindings[i]).resolveBinding());
|
result = (IBinding[]) ArrayUtil.append(IBinding.class, result, ((IASTName)binding).resolveBinding());
|
||||||
else if (bindings[i] instanceof IBinding)
|
else if (binding instanceof IBinding)
|
||||||
result = (IBinding[]) ArrayUtil.append(IBinding.class, result, bindings[i]);
|
result = (IBinding[]) ArrayUtil.append(IBinding.class, result, binding);
|
||||||
}
|
}
|
||||||
return new CPPCompositeBinding(result);
|
return new CPPCompositeBinding(result);
|
||||||
}
|
}
|
||||||
|
@ -1863,8 +1873,8 @@ public class CPPSemantics {
|
||||||
result[0] = implicitType;
|
result[0] = implicitType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < params.length; i++)
|
for (IParameter param : params)
|
||||||
result = (IType[]) ArrayUtil.append(IType.class, result, params[i].getType());
|
result = (IType[]) ArrayUtil.append(IType.class, result, param.getType());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1886,9 +1896,9 @@ public class CPPSemantics {
|
||||||
reduceToViable(data, fns);
|
reduceToViable(data, fns);
|
||||||
|
|
||||||
if (data.forDefinition() || data.forExplicitInstantiation()) {
|
if (data.forDefinition() || data.forExplicitInstantiation()) {
|
||||||
for (int i = 0; i < fns.length; i++) {
|
for (IFunction fn : fns) {
|
||||||
if (fns[i] != null) {
|
if (fn != null) {
|
||||||
return fns[i];
|
return fn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -2010,26 +2020,22 @@ public class CPPSemantics {
|
||||||
|
|
||||||
if (!hasWorse) {
|
if (!hasWorse) {
|
||||||
// if they are both template functions, we can order them that way
|
// if they are both template functions, we can order them that way
|
||||||
boolean bestIsTemplate = (bestFn instanceof ICPPSpecialization &&
|
ICPPFunctionTemplate bestAsTemplate= asTemplate(bestFn);
|
||||||
((ICPPSpecialization) bestFn).getSpecializedBinding() instanceof ICPPFunctionTemplate);
|
ICPPFunctionTemplate currAsTemplate= asTemplate(currFn);
|
||||||
boolean currIsTemplate = (currFn instanceof ICPPSpecialization &&
|
if (bestAsTemplate != null && currAsTemplate != null) {
|
||||||
((ICPPSpecialization) currFn).getSpecializedBinding() instanceof ICPPFunctionTemplate);
|
int order = CPPTemplates.orderTemplateFunctions(bestAsTemplate, currAsTemplate);
|
||||||
if (bestIsTemplate && currIsTemplate) {
|
|
||||||
ICPPFunctionTemplate t1 = (ICPPFunctionTemplate) ((ICPPSpecialization) bestFn).getSpecializedBinding();
|
|
||||||
ICPPFunctionTemplate t2 = (ICPPFunctionTemplate) ((ICPPSpecialization) currFn).getSpecializedBinding();
|
|
||||||
int order = CPPTemplates.orderTemplateFunctions(t1, t2);
|
|
||||||
if (order < 0) {
|
if (order < 0) {
|
||||||
hasBetter = true;
|
hasBetter = true;
|
||||||
} else if (order > 0) {
|
} else if (order > 0) {
|
||||||
ambiguous = false;
|
ambiguous = false;
|
||||||
}
|
}
|
||||||
} else if (bestIsTemplate && !currIsTemplate) {
|
} else if (bestAsTemplate != null) {
|
||||||
// we prefer normal functions over template functions, unless we specified template arguments
|
// we prefer normal functions over template functions, unless we specified template arguments
|
||||||
if (data.preferTemplateFunctions())
|
if (data.preferTemplateFunctions())
|
||||||
ambiguous = false;
|
ambiguous = false;
|
||||||
else
|
else
|
||||||
hasBetter = true;
|
hasBetter = true;
|
||||||
} else if (!bestIsTemplate && currIsTemplate) {
|
} else if (currAsTemplate != null) {
|
||||||
if (data.preferTemplateFunctions())
|
if (data.preferTemplateFunctions())
|
||||||
hasBetter = true;
|
hasBetter = true;
|
||||||
else
|
else
|
||||||
|
@ -2053,6 +2059,16 @@ public class CPPSemantics {
|
||||||
return bestFn;
|
return bestFn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ICPPFunctionTemplate asTemplate(IFunction function) {
|
||||||
|
if (function instanceof ICPPSpecialization) {
|
||||||
|
IBinding original= ((ICPPSpecialization) function).getSpecializedBinding();
|
||||||
|
if (original instanceof ICPPFunctionTemplate) {
|
||||||
|
return (ICPPFunctionTemplate) original;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 13.4-1 A use of an overloaded function without arguments is resolved in certain contexts to a function
|
* 13.4-1 A use of an overloaded function without arguments is resolved in certain contexts to a function
|
||||||
* @param data
|
* @param data
|
||||||
|
@ -2084,8 +2100,8 @@ public class CPPSemantics {
|
||||||
if (type == null || !(type instanceof IFunctionType))
|
if (type == null || !(type instanceof IFunctionType))
|
||||||
return new ProblemBinding(data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name());
|
return new ProblemBinding(data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name());
|
||||||
|
|
||||||
for (int i = 0; i < fns.length; i++) {
|
for (IBinding fn2 : fns) {
|
||||||
IFunction fn = (IFunction) fns[i];
|
IFunction fn = (IFunction) fn2;
|
||||||
IType ft = null;
|
IType ft = null;
|
||||||
try {
|
try {
|
||||||
ft = fn.getType();
|
ft = fn.getType();
|
||||||
|
@ -2100,7 +2116,7 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idx > 0 && ++idx < types.length) {
|
if (types != null && ++idx < types.length) {
|
||||||
type = types[idx];
|
type = types[idx];
|
||||||
} else {
|
} else {
|
||||||
type = null;
|
type = null;
|
||||||
|
@ -2248,8 +2264,7 @@ public class CPPSemantics {
|
||||||
if (data.hasResults()) {
|
if (data.hasResults()) {
|
||||||
Object[] items = (Object[]) data.foundItems;
|
Object[] items = (Object[]) data.foundItems;
|
||||||
IBinding temp = null;
|
IBinding temp = null;
|
||||||
for (int i = 0; i < items.length; i++) {
|
for (Object o : items) {
|
||||||
Object o = items[i];
|
|
||||||
if (o == null) break;
|
if (o == null) break;
|
||||||
if (o instanceof IASTName) {
|
if (o instanceof IASTName) {
|
||||||
temp = ((IASTName) o).resolveBinding();
|
temp = ((IASTName) o).resolveBinding();
|
||||||
|
@ -2402,11 +2417,11 @@ public class CPPSemantics {
|
||||||
|
|
||||||
ObjectSet<IBinding> set = new ObjectSet<IBinding>(items.length);
|
ObjectSet<IBinding> set = new ObjectSet<IBinding>(items.length);
|
||||||
IBinding binding = null;
|
IBinding binding = null;
|
||||||
for (int i = 0; i < items.length; i++) {
|
for (Object item : items) {
|
||||||
if (items[i] instanceof IASTName) {
|
if (item instanceof IASTName) {
|
||||||
binding = ((IASTName) items[i]).resolveBinding();
|
binding = ((IASTName) item).resolveBinding();
|
||||||
} else if (items[i] instanceof IBinding) {
|
} else if (item instanceof IBinding) {
|
||||||
binding = (IBinding) items[i];
|
binding = (IBinding) item;
|
||||||
} else {
|
} else {
|
||||||
binding = null;
|
binding = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,11 +182,11 @@ public class CPPTemplates {
|
||||||
int idx = templates.length;
|
int idx = templates.length;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
IASTName[] ns = ((ICPPASTQualifiedName) name).getNames();
|
IASTName[] ns = ((ICPPASTQualifiedName) name).getNames();
|
||||||
for (int j = 0; j < ns.length; j++) {
|
for (IASTName element : ns) {
|
||||||
if (ns[j] instanceof ICPPASTTemplateId) {
|
if (element instanceof ICPPASTTemplateId) {
|
||||||
++i;
|
++i;
|
||||||
if (i == idx) {
|
if (i == idx) {
|
||||||
binding = ((ICPPASTTemplateId) ns[j]).getTemplateName().resolveBinding();
|
binding = ((ICPPASTTemplateId) element).getTemplateName().resolveBinding();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,10 +253,6 @@ public class CPPTemplates {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static IBinding createBinding(ICPPASTTemplateId id) {
|
public static IBinding createBinding(ICPPASTTemplateId id) {
|
||||||
IASTNode parent = id.getParent();
|
IASTNode parent = id.getParent();
|
||||||
int segment = -1;
|
int segment = -1;
|
||||||
|
@ -407,9 +403,9 @@ public class CPPTemplates {
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
}
|
}
|
||||||
if (specializations != null) {
|
if (specializations != null) {
|
||||||
for (int i = 0; i < specializations.length; i++) {
|
for (ICPPClassTemplatePartialSpecialization specialization : specializations) {
|
||||||
if (isSameTemplate(specializations[i], id)) {
|
if (isSameTemplate(specialization, id)) {
|
||||||
spec = specializations[i];
|
spec = specialization;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -503,9 +499,7 @@ public class CPPTemplates {
|
||||||
return null;
|
return null;
|
||||||
ICPPFunctionTemplate[] templates = null;
|
ICPPFunctionTemplate[] templates = null;
|
||||||
IBinding temp = null;
|
IBinding temp = null;
|
||||||
for (int i = 0; i < items.length; i++) {
|
for (Object o : items) {
|
||||||
Object o = items[i];
|
|
||||||
|
|
||||||
if (o instanceof IASTName) {
|
if (o instanceof IASTName) {
|
||||||
temp = ((IASTName) o).resolveBinding();
|
temp = ((IASTName) o).resolveBinding();
|
||||||
if (temp == null)
|
if (temp == null)
|
||||||
|
@ -565,7 +559,7 @@ public class CPPTemplates {
|
||||||
IType arg = null;
|
IType arg = null;
|
||||||
for (int j = 0; j < numParams; j++) {
|
for (int j = 0; j < numParams; j++) {
|
||||||
ICPPTemplateParameter param = params[j];
|
ICPPTemplateParameter param = params[j];
|
||||||
if (j < numArgs) {
|
if (j < numArgs && templateArguments != null) {
|
||||||
arg = templateArguments[j];
|
arg = templateArguments[j];
|
||||||
} else {
|
} else {
|
||||||
arg = null;
|
arg = null;
|
||||||
|
@ -593,10 +587,6 @@ public class CPPTemplates {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return Object[] of { ObjectMap, IType[] }
|
* return Object[] of { ObjectMap, IType[] }
|
||||||
* @param primaryTemplate
|
|
||||||
* @param ps
|
|
||||||
* @param specArgs
|
|
||||||
* @return
|
|
||||||
* @throws DOMException
|
* @throws DOMException
|
||||||
*/
|
*/
|
||||||
static protected Object[] deduceTemplateFunctionArguments(ICPPFunctionTemplate primaryTemplate,
|
static protected Object[] deduceTemplateFunctionArguments(ICPPFunctionTemplate primaryTemplate,
|
||||||
|
@ -642,11 +632,6 @@ public class CPPTemplates {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param decl
|
|
||||||
* @param arguments
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static IBinding createInstance(ICPPScope scope, IBinding decl, ObjectMap argMap, IType[] args) {
|
public static IBinding createInstance(ICPPScope scope, IBinding decl, ObjectMap argMap, IType[] args) {
|
||||||
ICPPTemplateInstance instance = null;
|
ICPPTemplateInstance instance = null;
|
||||||
if (decl instanceof ICPPClassType) {
|
if (decl instanceof ICPPClassType) {
|
||||||
|
@ -919,9 +904,9 @@ public class CPPTemplates {
|
||||||
boolean clear = bindings.containsKey(name.getBinding());
|
boolean clear = bindings.containsKey(name.getBinding());
|
||||||
if (!clear && binding instanceof ICPPTemplateInstance) {
|
if (!clear && binding instanceof ICPPTemplateInstance) {
|
||||||
IType[] args = ((ICPPTemplateInstance) binding).getArguments();
|
IType[] args = ((ICPPTemplateInstance) binding).getArguments();
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (IType arg : args) {
|
||||||
if (args[i] instanceof IBinding) {
|
if (arg instanceof IBinding) {
|
||||||
if(bindings.containsKey((IBinding)args[i])) {
|
if(bindings.containsKey((IBinding)arg)) {
|
||||||
clear = true;
|
clear = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -941,11 +926,7 @@ public class CPPTemplates {
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @param definition
|
|
||||||
* @param declarator
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean isSameTemplate(ICPPTemplateDefinition definition, IASTName name) {
|
public static boolean isSameTemplate(ICPPTemplateDefinition definition, IASTName name) {
|
||||||
ICPPTemplateParameter[] defParams = null;
|
ICPPTemplateParameter[] defParams = null;
|
||||||
try {
|
try {
|
||||||
|
@ -1094,7 +1075,7 @@ public class CPPTemplates {
|
||||||
|
|
||||||
IType[] instanceArgs = null;
|
IType[] instanceArgs = null;
|
||||||
for (int i = 0; i < numTemplateParams; i++) {
|
for (int i = 0; i < numTemplateParams; i++) {
|
||||||
IType arg = (i < numTemplateArgs) ? CPPVisitor.createType(templateArguments[i]) : null;
|
IType arg = (i < numTemplateArgs && templateArguments != null) ? CPPVisitor.createType(templateArguments[i]) : null;
|
||||||
IType mapped = (IType) map.get(templateParams[i]);
|
IType mapped = (IType) map.get(templateParams[i]);
|
||||||
|
|
||||||
if (arg != null && mapped != null) {
|
if (arg != null && mapped != null) {
|
||||||
|
@ -1118,7 +1099,7 @@ public class CPPTemplates {
|
||||||
if (def != null) {
|
if (def != null) {
|
||||||
if (def instanceof ICPPTemplateParameter) {
|
if (def instanceof ICPPTemplateParameter) {
|
||||||
for (int j = 0; j < i; j++) {
|
for (int j = 0; j < i; j++) {
|
||||||
if (templateParams[j] == def) {
|
if (templateParams[j] == def && instanceArgs != null) {
|
||||||
def = instanceArgs[j];
|
def = instanceArgs[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1410,7 +1391,10 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
ICPPClassTemplatePartialSpecialization[] specializations = template.getPartialSpecializations();
|
ICPPClassTemplatePartialSpecialization[] specializations = template.getPartialSpecializations();
|
||||||
int size = (specializations != null) ? specializations.length : 0;
|
if (specializations == null) {
|
||||||
|
return template;
|
||||||
|
}
|
||||||
|
final int size= specializations.length;
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
@ -1490,9 +1474,7 @@ public class CPPTemplates {
|
||||||
public static final class CPPImplicitFunctionTemplate extends CPPFunctionTemplate {
|
public static final class CPPImplicitFunctionTemplate extends CPPFunctionTemplate {
|
||||||
IParameter[] functionParameters = null;
|
IParameter[] functionParameters = null;
|
||||||
ICPPTemplateParameter[] templateParameters = null;
|
ICPPTemplateParameter[] templateParameters = null;
|
||||||
/**
|
|
||||||
* @param name
|
|
||||||
*/
|
|
||||||
public CPPImplicitFunctionTemplate(ICPPTemplateParameter[] templateParameters, IParameter[] functionParameters) {
|
public CPPImplicitFunctionTemplate(ICPPTemplateParameter[] templateParameters, IParameter[] functionParameters) {
|
||||||
super(null);
|
super(null);
|
||||||
this.functionParameters = functionParameters;
|
this.functionParameters = functionParameters;
|
||||||
|
@ -1656,7 +1638,10 @@ public class CPPTemplates {
|
||||||
return e1.getProblem();
|
return e1.getProblem();
|
||||||
}
|
}
|
||||||
|
|
||||||
int numParams = (parameters != null) ? parameters.length : 0;
|
if (parameters == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final int numParams= parameters.length;
|
||||||
int numArgs = arguments.length;
|
int numArgs = arguments.length;
|
||||||
|
|
||||||
if (numParams == 0) {
|
if (numParams == 0) {
|
||||||
|
@ -1719,10 +1704,10 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argsContainTemplateParameters) {
|
||||||
if (map.isEmpty()) {
|
if (map.isEmpty()) {
|
||||||
map = null;
|
map = null;
|
||||||
}
|
}
|
||||||
if (argsContainTemplateParameters) {
|
|
||||||
return ((ICPPInternalTemplateInstantiator) template).deferredInstance(map, arguments);
|
return ((ICPPInternalTemplateInstantiator) template).deferredInstance(map, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1754,8 +1739,6 @@ public class CPPTemplates {
|
||||||
* Returns an array of specialized bases. The bases will be specialized versions of
|
* Returns an array of specialized bases. The bases will be specialized versions of
|
||||||
* the template instances associated specialized bindings bases.
|
* the template instances associated specialized bindings bases.
|
||||||
* binding.
|
* binding.
|
||||||
* @param classInstance
|
|
||||||
* @return
|
|
||||||
* @throws DOMException
|
* @throws DOMException
|
||||||
*/
|
*/
|
||||||
public static ICPPBase[] getBases(ICPPTemplateInstance classInstance) throws DOMException {
|
public static ICPPBase[] getBases(ICPPTemplateInstance classInstance) throws DOMException {
|
||||||
|
@ -1765,8 +1748,7 @@ public class CPPTemplates {
|
||||||
if (pdomBases != null) {
|
if (pdomBases != null) {
|
||||||
ICPPBase[] result = null;
|
ICPPBase[] result = null;
|
||||||
|
|
||||||
for (int i = 0; i < pdomBases.length; i++) {
|
for (ICPPBase origBase : pdomBases) {
|
||||||
ICPPBase origBase = pdomBases[i];
|
|
||||||
ICPPBase specBase = (ICPPBase) ((ICPPInternalBase) origBase).clone();
|
ICPPBase specBase = (ICPPBase) ((ICPPInternalBase) origBase).clone();
|
||||||
IBinding origClass = origBase.getBaseClass();
|
IBinding origClass = origBase.getBaseClass();
|
||||||
if (origClass instanceof IType) {
|
if (origClass instanceof IType) {
|
||||||
|
|
|
@ -284,7 +284,6 @@ class LookupData {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* an IType[] of function arguments, inluding the implied object argument
|
* an IType[] of function arguments, inluding the implied object argument
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public IType getImpliedObjectArgument() {
|
public IType getImpliedObjectArgument() {
|
||||||
IType implied = null;
|
IType implied = null;
|
||||||
|
|
|
@ -13,12 +13,11 @@ package org.eclipse.cdt.internal.core.index.composite.c;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||||
|
|
||||||
class CompositeCEnumerator extends CompositeCBinding implements IIndexBinding, IEnumerator {
|
class CompositeCEnumerator extends CompositeCBinding implements IEnumerator {
|
||||||
public CompositeCEnumerator(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
|
public CompositeCEnumerator(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
|
||||||
super(cf, rbinding);
|
super(cf, rbinding);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,10 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||||
|
|
||||||
class CompositeCField extends CompositeCVariable implements IIndexBinding, IField {
|
class CompositeCField extends CompositeCVariable implements IField {
|
||||||
public CompositeCField(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
|
public CompositeCField(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
|
||||||
super(cf, rbinding);
|
super(cf, rbinding);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,13 +16,12 @@ import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexScope;
|
import org.eclipse.cdt.internal.core.index.IIndexScope;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||||
|
|
||||||
class CompositeCFunction extends CompositeCBinding implements IIndexBinding, IFunction {
|
class CompositeCFunction extends CompositeCBinding implements IFunction {
|
||||||
|
|
||||||
public CompositeCFunction(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
|
public CompositeCFunction(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
|
||||||
super(cf, rbinding);
|
super(cf, rbinding);
|
||||||
|
|
|
@ -13,12 +13,11 @@ package org.eclipse.cdt.internal.core.index.composite.c;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||||
|
|
||||||
class CompositeCParameter extends CompositeCBinding implements IIndexBinding, IParameter {
|
class CompositeCParameter extends CompositeCBinding implements IParameter {
|
||||||
|
|
||||||
public CompositeCParameter(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
|
public CompositeCParameter(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
|
||||||
super(cf, rbinding);
|
super(cf, rbinding);
|
||||||
|
|
|
@ -13,12 +13,11 @@ package org.eclipse.cdt.internal.core.index.composite.c;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||||
|
|
||||||
class CompositeCVariable extends CompositeCBinding implements IIndexBinding, IVariable {
|
class CompositeCVariable extends CompositeCBinding implements IVariable {
|
||||||
|
|
||||||
public CompositeCVariable(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
|
public CompositeCVariable(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
|
||||||
super(cf, rbinding);
|
super(cf, rbinding);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class BTree {
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param db the database containing the btree
|
* @param db the database containing the btree
|
||||||
* @param root offset into database of the pointer to the root node
|
* @param rootPointer offset into database of the pointer to the root node
|
||||||
*/
|
*/
|
||||||
public BTree(Database db, int rootPointer, int degree, IBTreeComparator cmp) {
|
public BTree(Database db, int rootPointer, int degree, IBTreeComparator cmp) {
|
||||||
if(degree<2)
|
if(degree<2)
|
||||||
|
@ -93,8 +93,7 @@ public class BTree {
|
||||||
* key was already there, in which case we return the record
|
* key was already there, in which case we return the record
|
||||||
* that matched. In other cases, we just return the record back.
|
* that matched. In other cases, we just return the record back.
|
||||||
*
|
*
|
||||||
* @param offset of the record
|
* @param record offset of the record
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public int insert(int record) throws CoreException {
|
public int insert(int record) throws CoreException {
|
||||||
int root = getRoot();
|
int root = getRoot();
|
||||||
|
@ -229,7 +228,6 @@ public class BTree {
|
||||||
* The reference to the record in the btree is deleted.
|
* The reference to the record in the btree is deleted.
|
||||||
*
|
*
|
||||||
* @param record the record to delete
|
* @param record the record to delete
|
||||||
* @param cmp the comparator for locating the record
|
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public void delete(int record) throws CoreException {
|
public void delete(int record) throws CoreException {
|
||||||
|
@ -345,8 +343,11 @@ public class BTree {
|
||||||
|
|
||||||
/* Case 2c: Merge successor and predecessor */
|
/* Case 2c: Merge successor and predecessor */
|
||||||
// assert(pred!=null && succ!=null);
|
// assert(pred!=null && succ!=null);
|
||||||
|
if (pred != null) {
|
||||||
mergeNodes(succ, node, keyIndexInNode, pred);
|
mergeNodes(succ, node, keyIndexInNode, pred);
|
||||||
return deleteImp(key, pred.node, mode);
|
return deleteImp(key, pred.node, mode);
|
||||||
|
}
|
||||||
|
return key;
|
||||||
} else {
|
} else {
|
||||||
/* Case 3: non-leaf node which does not itself contain the key */
|
/* Case 3: non-leaf node which does not itself contain the key */
|
||||||
|
|
||||||
|
@ -422,7 +423,7 @@ public class BTree {
|
||||||
* 'keyProvider' as the source of the median key. Bounds checking is not
|
* 'keyProvider' as the source of the median key. Bounds checking is not
|
||||||
* performed.
|
* performed.
|
||||||
* @param src the key to merge into dst
|
* @param src the key to merge into dst
|
||||||
* @param mid the node that provides the median key for the new node
|
* @param keyProvider the node that provides the median key for the new node
|
||||||
* @param kIndex the index of the key in the node <i>mid</i> which is to become the new node's median key
|
* @param kIndex the index of the key in the node <i>mid</i> which is to become the new node's median key
|
||||||
* @param dst the node which is the basis and result of the merge
|
* @param dst the node which is the basis and result of the merge
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -125,7 +125,6 @@ public class DBProperties {
|
||||||
* it can be re-populated.
|
* it can be re-populated.
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("hiding")
|
|
||||||
public void clear() throws CoreException {
|
public void clear() throws CoreException {
|
||||||
index.accept(new IBTreeVisitor(){
|
index.accept(new IBTreeVisitor(){
|
||||||
public int compare(int record) throws CoreException {
|
public int compare(int record) throws CoreException {
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.db;
|
package org.eclipse.cdt.internal.core.pdom.db;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,11 +20,6 @@ public interface IBTreeComparator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare two records. Used for insert.
|
* Compare two records. Used for insert.
|
||||||
*
|
|
||||||
* @param record1
|
|
||||||
* @param record2
|
|
||||||
* @return
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
public abstract int compare(int record1, int record2) throws CoreException;
|
public abstract int compare(int record1, int record2) throws CoreException;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.db;
|
package org.eclipse.cdt.internal.core.pdom.db;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +27,7 @@ public interface IBTreeVisitor {
|
||||||
*
|
*
|
||||||
* @param record
|
* @param record
|
||||||
* @return -1 if record < key, 0 if record == key, 1 if record > key
|
* @return -1 if record < key, 0 if record == key, 1 if record > key
|
||||||
* @throws IOException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public abstract int compare(int record) throws CoreException;
|
public abstract int compare(int record) throws CoreException;
|
||||||
|
|
||||||
|
@ -37,7 +35,7 @@ public interface IBTreeVisitor {
|
||||||
* Visit a given record and return whether to continue or not.
|
* Visit a given record and return whether to continue or not.
|
||||||
|
|
||||||
* @return <code>true</code> to continue the visit, <code>false</code> to abort it.
|
* @return <code>true</code> to continue the visit, <code>false</code> to abort it.
|
||||||
* @throws IOException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public abstract boolean visit(int record) throws CoreException;
|
public abstract boolean visit(int record) throws CoreException;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
public interface IString {
|
public interface IString {
|
||||||
/**
|
/**
|
||||||
* Get the offset of this IString record in the PDOM
|
* Get the offset of this IString record in the PDOM
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public int getRecord();
|
public int getRecord();
|
||||||
|
|
||||||
|
@ -91,7 +90,7 @@ public interface IString {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare this IString record and the specified character array
|
* Compare this IString record and the specified character array
|
||||||
* @param chars
|
* @param name the name to compare to
|
||||||
* @param caseSensitive whether to compare in a case-sensitive way
|
* @param caseSensitive whether to compare in a case-sensitive way
|
||||||
* @return <ul><li> -1 if this < chars
|
* @return <ul><li> -1 if this < chars
|
||||||
* <li> 0 if this has a prefix chars
|
* <li> 0 if this has a prefix chars
|
||||||
|
|
|
@ -54,21 +54,19 @@ public class PDOMPointerType extends PDOMNode implements IPointerType,
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// type
|
// type
|
||||||
IType targetType= type.getType();
|
|
||||||
int typeRec = 0;
|
int typeRec = 0;
|
||||||
|
byte flags = 0;
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
|
IType targetType= type.getType();
|
||||||
PDOMNode targetTypeNode = getLinkageImpl().addType(this, targetType);
|
PDOMNode targetTypeNode = getLinkageImpl().addType(this, targetType);
|
||||||
if (targetTypeNode != null)
|
if (targetTypeNode != null)
|
||||||
typeRec = targetTypeNode.getRecord();
|
typeRec = targetTypeNode.getRecord();
|
||||||
}
|
|
||||||
db.putInt(record + TYPE, typeRec);
|
|
||||||
|
|
||||||
// flags
|
|
||||||
byte flags = 0;
|
|
||||||
if (type.isConst())
|
if (type.isConst())
|
||||||
flags |= CONST;
|
flags |= CONST;
|
||||||
if (type.isVolatile())
|
if (type.isVolatile())
|
||||||
flags |= VOLATILE;
|
flags |= VOLATILE;
|
||||||
|
}
|
||||||
|
db.putInt(record + TYPE, typeRec);
|
||||||
db.putByte(record + FLAGS, flags);
|
db.putByte(record + FLAGS, flags);
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
throw new CoreException(Util.createStatus(e));
|
throw new CoreException(Util.createStatus(e));
|
||||||
|
|
|
@ -57,14 +57,12 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType, ICQua
|
||||||
|
|
||||||
// type
|
// type
|
||||||
try {
|
try {
|
||||||
IType targetType = type.getType();
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
|
IType targetType = type.getType();
|
||||||
PDOMNode targetTypeNode = getLinkageImpl().addType(this, targetType);
|
PDOMNode targetTypeNode = getLinkageImpl().addType(this, targetType);
|
||||||
if (targetTypeNode != null) {
|
if (targetTypeNode != null) {
|
||||||
db.putInt(record + TYPE, targetTypeNode.getRecord());
|
db.putInt(record + TYPE, targetTypeNode.getRecord());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// flags
|
// flags
|
||||||
byte flags = 0;
|
byte flags = 0;
|
||||||
if (type.isConst())
|
if (type.isConst())
|
||||||
|
@ -74,6 +72,7 @@ public class PDOMQualifierType extends PDOMNode implements IQualifierType, ICQua
|
||||||
if (type instanceof ICQualifierType && ((ICQualifierType)type).isRestrict())
|
if (type instanceof ICQualifierType && ((ICQualifierType)type).isRestrict())
|
||||||
flags |= RESTRICT;
|
flags |= RESTRICT;
|
||||||
db.putByte(record + FLAGS, flags);
|
db.putByte(record + FLAGS, flags);
|
||||||
|
}
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
throw new CoreException(Util.createStatus(e));
|
throw new CoreException(Util.createStatus(e));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
/**
|
/**
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*/
|
*/
|
||||||
class PDOMCPPEnumeration extends PDOMCPPBinding
|
class PDOMCPPEnumeration extends PDOMCPPBinding implements IEnumeration, IIndexType {
|
||||||
implements IEnumeration, IIndexType, ICPPBinding {
|
|
||||||
|
|
||||||
private static final int FIRST_ENUMERATOR = PDOMBinding.RECORD_SIZE + 0;
|
private static final int FIRST_ENUMERATOR = PDOMBinding.RECORD_SIZE + 0;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||||
|
@ -26,7 +25,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class PDOMCPPEnumerator extends PDOMCPPBinding implements IEnumerator, ICPPBinding {
|
class PDOMCPPEnumerator extends PDOMCPPBinding implements IEnumerator {
|
||||||
|
|
||||||
private static final int ENUMERATION = PDOMBinding.RECORD_SIZE + 0;
|
private static final int ENUMERATION = PDOMBinding.RECORD_SIZE + 0;
|
||||||
private static final int NEXT_ENUMERATOR = PDOMBinding.RECORD_SIZE + 4;
|
private static final int NEXT_ENUMERATOR = PDOMBinding.RECORD_SIZE + 4;
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
|
||||||
import org.eclipse.cdt.internal.core.index.PointerTypeClone;
|
import org.eclipse.cdt.internal.core.index.PointerTypeClone;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
|
@ -25,8 +24,7 @@ import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMPointerType;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMPointerType;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
class PDOMCPPPointerToMemberType extends PDOMPointerType
|
class PDOMCPPPointerToMemberType extends PDOMPointerType implements ICPPPointerToMemberType {
|
||||||
implements ICPPPointerToMemberType, IIndexType {
|
|
||||||
|
|
||||||
private static final int TYPE = PDOMPointerType.RECORD_SIZE;
|
private static final int TYPE = PDOMPointerType.RECORD_SIZE;
|
||||||
@SuppressWarnings("hiding")
|
@SuppressWarnings("hiding")
|
||||||
|
|
|
@ -49,9 +49,9 @@ class PDOMCPPReferenceType extends PDOMNode implements ICPPReferenceType,
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// type
|
// type
|
||||||
IType targetType = type.getType();
|
|
||||||
int typeRec = 0;
|
int typeRec = 0;
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
|
IType targetType = type.getType();
|
||||||
PDOMNode targetTypeNode = getLinkageImpl().addType(this, targetType);
|
PDOMNode targetTypeNode = getLinkageImpl().addType(this, targetType);
|
||||||
if (targetTypeNode != null)
|
if (targetTypeNode != null)
|
||||||
typeRec = targetTypeNode.getRecord();
|
typeRec = targetTypeNode.getRecord();
|
||||||
|
|
|
@ -41,7 +41,6 @@ class PDOMCPPUsingDeclaration extends PDOMCPPBinding implements ICPPUsingDeclara
|
||||||
|
|
||||||
private IBinding[] delegates;
|
private IBinding[] delegates;
|
||||||
|
|
||||||
@SuppressWarnings("hiding")
|
|
||||||
public PDOMCPPUsingDeclaration(PDOM pdom, PDOMNode parent, ICPPUsingDeclaration using)
|
public PDOMCPPUsingDeclaration(PDOM pdom, PDOMNode parent, ICPPUsingDeclaration using)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
super(pdom, parent, using.getNameCharArray());
|
super(pdom, parent, using.getNameCharArray());
|
||||||
|
|
|
@ -15,12 +15,11 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPBasicType;
|
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPBasicType;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
class PDOMGPPBasicType extends PDOMCPPBasicType implements IGPPBasicType, IIndexType {
|
class PDOMGPPBasicType extends PDOMCPPBasicType implements IGPPBasicType {
|
||||||
|
|
||||||
public PDOMGPPBasicType(PDOM pdom, int record) {
|
public PDOMGPPBasicType(PDOM pdom, int record) {
|
||||||
super(pdom, record);
|
super(pdom, record);
|
||||||
|
|
|
@ -33,7 +33,6 @@ public class CLIUtil {
|
||||||
* @param arguments the arguments map
|
* @param arguments the arguments map
|
||||||
* @param opt the option name to check
|
* @param opt the option name to check
|
||||||
* @param number the number of parameters
|
* @param number the number of parameters
|
||||||
* @return
|
|
||||||
* @throws CoreException if the number of parameters is not the specified expected number
|
* @throws CoreException if the number of parameters is not the specified expected number
|
||||||
*/
|
*/
|
||||||
public static List<String> getArg(Map<String, List<String>> arguments, String opt, int number) throws CoreException {
|
public static List<String> getArg(Map<String, List<String>> arguments, String opt, int number) throws CoreException {
|
||||||
|
@ -47,23 +46,20 @@ public class CLIUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a map of String option to List of String parameters.
|
* Returns a map of String option to List of String parameters.
|
||||||
* <br>
|
|
||||||
* @param args
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static Map<String,List<String>> parseToMap(String[] args) {
|
public static Map<String,List<String>> parseToMap(String[] args) {
|
||||||
Map<String,List<String>> result = new HashMap<String,List<String>>();
|
Map<String,List<String>> result = new HashMap<String,List<String>>();
|
||||||
String current = null;
|
String current = null;
|
||||||
for(int i=0; i<args.length; i++) {
|
for (String arg : args) {
|
||||||
if(args[i].startsWith("-")) { //$NON-NLS-1$
|
if(arg.startsWith("-")) { //$NON-NLS-1$
|
||||||
current = args[i];
|
current = arg;
|
||||||
result.put(current, new ArrayList<String>());
|
result.put(current, new ArrayList<String>());
|
||||||
} else {
|
} else {
|
||||||
if(current==null) {
|
if(current==null) {
|
||||||
current= UNQUALIFIED_PARAMETERS;
|
current= UNQUALIFIED_PARAMETERS;
|
||||||
result.put(current, new ArrayList<String>());
|
result.put(current, new ArrayList<String>());
|
||||||
}
|
}
|
||||||
(result.get(current)).add(args[i]);
|
(result.get(current)).add(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class GeneratePDOM implements ISafeRunnable {
|
||||||
if(cproject==null) {
|
if(cproject==null) {
|
||||||
fail(MessageFormat.format(Messages.GeneratePDOM_ProjectProviderReturnedNullCProject,
|
fail(MessageFormat.format(Messages.GeneratePDOM_ProjectProviderReturnedNullCProject,
|
||||||
new Object [] {pm.getClass().getName()}));
|
new Object [] {pm.getClass().getName()}));
|
||||||
|
return; // cannot be reached, inform the compiler
|
||||||
}
|
}
|
||||||
|
|
||||||
IIndexLocationConverter converter= pm.getLocationConverter(cproject);
|
IIndexLocationConverter converter= pm.getLocationConverter(cproject);
|
||||||
|
|
|
@ -115,8 +115,7 @@ public class TodoTaskUpdater implements ITodoTaskUpdater {
|
||||||
// first collect all valid file-locations
|
// first collect all valid file-locations
|
||||||
final Map<IPath, TaskList> pathToTaskList= new HashMap<IPath, TaskList>();
|
final Map<IPath, TaskList> pathToTaskList= new HashMap<IPath, TaskList>();
|
||||||
final Set<IProject> projects= new HashSet<IProject>();
|
final Set<IProject> projects= new HashSet<IProject>();
|
||||||
for (int i = 0; i < filesToUpdate.length; i++) {
|
for (final IIndexFileLocation indexFileLocation : filesToUpdate) {
|
||||||
final IIndexFileLocation indexFileLocation = filesToUpdate[i];
|
|
||||||
final String filepath = indexFileLocation.getFullPath();
|
final String filepath = indexFileLocation.getFullPath();
|
||||||
if (filepath != null) {
|
if (filepath != null) {
|
||||||
IFile file = workspaceRoot.getFile(new Path(filepath));
|
IFile file = workspaceRoot.getFile(new Path(filepath));
|
||||||
|
@ -129,8 +128,7 @@ public class TodoTaskUpdater implements ITodoTaskUpdater {
|
||||||
|
|
||||||
if (comments.length > 0) {
|
if (comments.length > 0) {
|
||||||
final Task[] tasks = taskParser.parse(comments);
|
final Task[] tasks = taskParser.parse(comments);
|
||||||
for (int i = 0; i < tasks.length; i++) {
|
for (final Task task : tasks) {
|
||||||
final Task task = tasks[i];
|
|
||||||
TaskList list= pathToTaskList.get(new Path(task.getFileLocation()));
|
TaskList list= pathToTaskList.get(new Path(task.getFileLocation()));
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
list.add(task);
|
list.add(task);
|
||||||
|
@ -209,7 +207,7 @@ public class TodoTaskUpdater implements ITodoTaskUpdater {
|
||||||
@Override
|
@Override
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
try {
|
try {
|
||||||
if (resource == null || !resource.exists()) {
|
if (!resource.exists()) {
|
||||||
return Status.CANCEL_STATUS;
|
return Status.CANCEL_STATUS;
|
||||||
}
|
}
|
||||||
resource.deleteMarkers(ICModelMarker.TASK_MARKER, false, IResource.DEPTH_INFINITE);
|
resource.deleteMarkers(ICModelMarker.TASK_MARKER, false, IResource.DEPTH_INFINITE);
|
||||||
|
|
|
@ -47,8 +47,6 @@ public class CdtVariableException extends CoreException {
|
||||||
* @param macroName the name of the build macro whose resolution caused this status creation or null if none
|
* @param macroName the name of the build macro whose resolution caused this status creation or null if none
|
||||||
* @param expression the string whose resolutinon caused caused this status creation or null if none
|
* @param expression the string whose resolutinon caused caused this status creation or null if none
|
||||||
* @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
|
* @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
|
||||||
* @param contextType the context type used in the operation
|
|
||||||
* @param contextData the context data used in the operation
|
|
||||||
*/
|
*/
|
||||||
public CdtVariableException(int code,
|
public CdtVariableException(int code,
|
||||||
String message,
|
String message,
|
||||||
|
@ -66,13 +64,9 @@ public class CdtVariableException extends CoreException {
|
||||||
* Creates an exception containing a single IBuildMacroStatus status with the IStatus.ERROR severity and with the default message
|
* Creates an exception containing a single IBuildMacroStatus status with the IStatus.ERROR severity and with the default message
|
||||||
*
|
*
|
||||||
* @param code one of the IBuildMacroStatus.TYPE_xxx statusses
|
* @param code one of the IBuildMacroStatus.TYPE_xxx statusses
|
||||||
* @param exception a low-level exception, or <code>null</code> if not
|
|
||||||
* applicable
|
|
||||||
* @param macroName the name of the build macro whose resolution caused this status creation or null if none
|
* @param macroName the name of the build macro whose resolution caused this status creation or null if none
|
||||||
* @param expression the string whose resolutinon caused caused this status creation or null if none
|
* @param expression the string whose resolutinon caused caused this status creation or null if none
|
||||||
* @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
|
* @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
|
||||||
* @param contextType the context type used in the operation
|
|
||||||
* @param contextData the context data used in the operation
|
|
||||||
*/
|
*/
|
||||||
public CdtVariableException(int code,
|
public CdtVariableException(int code,
|
||||||
String macroName,
|
String macroName,
|
||||||
|
@ -97,9 +91,9 @@ public class CdtVariableException extends CoreException {
|
||||||
IStatus children[] = status.getChildren();
|
IStatus children[] = status.getChildren();
|
||||||
ICdtVariableStatus result[] = new ICdtVariableStatus[children.length];
|
ICdtVariableStatus result[] = new ICdtVariableStatus[children.length];
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for(int i = 0; i < children.length; i++){
|
for (IStatus element : children) {
|
||||||
if(children[i] instanceof ICdtVariableStatus)
|
if(element instanceof ICdtVariableStatus)
|
||||||
result[num++]=(ICdtVariableStatus)children[i];
|
result[num++]=(ICdtVariableStatus)element;
|
||||||
}
|
}
|
||||||
if(num != children.length){
|
if(num != children.length){
|
||||||
ICdtVariableStatus tmp[] = new ICdtVariableStatus[num];
|
ICdtVariableStatus tmp[] = new ICdtVariableStatus[num];
|
||||||
|
|
|
@ -20,18 +20,15 @@ import org.eclipse.core.runtime.Status;
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class CdtVariableStatus extends Status implements ICdtVariableStatus {
|
public class CdtVariableStatus extends Status implements ICdtVariableStatus {
|
||||||
/*
|
// private static final String PREFIX = "BuildMacroStatus"; //$NON-NLS-1$
|
||||||
* String constants
|
// private static final String STATUS = PREFIX + ".status"; //$NON-NLS-1$
|
||||||
*/
|
// private static final String STATUS_MACRO_UNDEFINED = STATUS + ".macro.undefined"; //$NON-NLS-1$
|
||||||
private static final String PREFIX = "BuildMacroStatus"; //$NON-NLS-1$
|
// private static final String STATUS_MACROS_REFERENCE_EACHOTHER = STATUS + ".reference.eachother"; //$NON-NLS-1$
|
||||||
private static final String STATUS = PREFIX + ".status"; //$NON-NLS-1$
|
// private static final String STATUS_MACRO_REFERENCE_INCORRECT = STATUS + ".reference.incorrect"; //$NON-NLS-1$
|
||||||
private static final String STATUS_MACRO_UNDEFINED = STATUS + ".macro.undefined"; //$NON-NLS-1$
|
// private static final String STATUS_MACRO_NOT_STRING = STATUS + ".macro.not.string"; //$NON-NLS-1$
|
||||||
private static final String STATUS_MACROS_REFERENCE_EACHOTHER = STATUS + ".reference.eachother"; //$NON-NLS-1$
|
// private static final String STATUS_MACRO_NOT_STRINGLIST = STATUS + ".macro.not.stringlist"; //$NON-NLS-1$
|
||||||
private static final String STATUS_MACRO_REFERENCE_INCORRECT = STATUS + ".reference.incorrect"; //$NON-NLS-1$
|
// private static final String STATUS_ERROR = STATUS + ".error"; //$NON-NLS-1$
|
||||||
private static final String STATUS_MACRO_NOT_STRING = STATUS + ".macro.not.string"; //$NON-NLS-1$
|
// private static final String VALUE_UNDEFINED = PREFIX + ".value.undefined"; //$NON-NLS-1$
|
||||||
private static final String STATUS_MACRO_NOT_STRINGLIST = STATUS + ".macro.not.stringlist"; //$NON-NLS-1$
|
|
||||||
private static final String STATUS_ERROR = STATUS + ".error"; //$NON-NLS-1$
|
|
||||||
private static final String VALUE_UNDEFINED = PREFIX + ".value.undefined"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
private String fMacroName;
|
private String fMacroName;
|
||||||
private String fExpression;
|
private String fExpression;
|
||||||
|
@ -42,17 +39,15 @@ public class CdtVariableStatus extends Status implements ICdtVariableStatus {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param severity one of the IStatus.xxx severity statuses
|
* @param severity as documented in {@link IStatus}
|
||||||
* @param code one of the IBuildMacroStatus.TYPE_xxx statusses
|
* @param code as provided by {@link ICdtVariableStatus}.
|
||||||
* @param message message, can be null. In this case the default message will
|
* @param message message, can be null. In this case the default message will
|
||||||
* be generated base upon the other status info
|
* be generated base upon the other status info
|
||||||
* @param exception a low-level exception, or <code>null</code> if not
|
* @param exception a low-level exception, or <code>null</code> if not
|
||||||
* applicable
|
* applicable
|
||||||
* @param macroName the name of the build macro whose resolution caused this status creation or null if none
|
* @param macroName the name of the build macro whose resolution caused this status creation or null if none
|
||||||
* @param expression the string whose resolutinon caused caused this status creation or null if none
|
* @param expression the string whose resolution caused this status creation or null if none
|
||||||
* @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
|
* @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
|
||||||
* @param contextType the context type used in the operation
|
|
||||||
* @param contextData the context data used in the operation
|
|
||||||
*/
|
*/
|
||||||
public CdtVariableStatus(int severity,
|
public CdtVariableStatus(int severity,
|
||||||
int code,
|
int code,
|
||||||
|
@ -87,8 +82,6 @@ public class CdtVariableStatus extends Status implements ICdtVariableStatus {
|
||||||
* @param macroName the name of the build macro whose resolution caused this status creation or null if none
|
* @param macroName the name of the build macro whose resolution caused this status creation or null if none
|
||||||
* @param expression the string whose resolutinon caused caused this status creation or null if none
|
* @param expression the string whose resolutinon caused caused this status creation or null if none
|
||||||
* @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
|
* @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
|
||||||
* @param contextType the context type used in the operation
|
|
||||||
* @param contextData the context data used in the operation
|
|
||||||
*/
|
*/
|
||||||
public CdtVariableStatus(
|
public CdtVariableStatus(
|
||||||
int code,
|
int code,
|
||||||
|
@ -108,13 +101,9 @@ public class CdtVariableStatus extends Status implements ICdtVariableStatus {
|
||||||
* Creates status with the IStatus.ERROR severity and with the default message
|
* Creates status with the IStatus.ERROR severity and with the default message
|
||||||
*
|
*
|
||||||
* @param code one of the IBuildMacroStatus.TYPE_xxx statusses
|
* @param code one of the IBuildMacroStatus.TYPE_xxx statusses
|
||||||
* @param exception a low-level exception, or <code>null</code> if not
|
|
||||||
* applicable
|
|
||||||
* @param macroName the name of the build macro whose resolution caused this status creation or null if none
|
* @param macroName the name of the build macro whose resolution caused this status creation or null if none
|
||||||
* @param expression the string whose resolutinon caused caused this status creation or null if none
|
* @param expression the string whose resolutinon caused caused this status creation or null if none
|
||||||
* @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
|
* @param referencedName the macro name referenced in the resolution string that caused this this status creation or null if none
|
||||||
* @param contextType the context type used in the operation
|
|
||||||
* @param contextData the context data used in the operation
|
|
||||||
*/
|
*/
|
||||||
public CdtVariableStatus(
|
public CdtVariableStatus(
|
||||||
int code,
|
int code,
|
||||||
|
|
|
@ -58,7 +58,6 @@ public interface ICdtVariable{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the macro name
|
* Returns the macro name
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
|
|
|
@ -31,29 +31,7 @@ public interface ICdtVariableManager{
|
||||||
*
|
*
|
||||||
* Returns reference to the IBuildMacro interface representing Macro of the
|
* Returns reference to the IBuildMacro interface representing Macro of the
|
||||||
* specified name or null if there is there is no such macro
|
* specified name or null if there is there is no such macro
|
||||||
* @param macroName macro name
|
* @param name macro name
|
||||||
* @param contextType represents the context type. Should be set to one of the the
|
|
||||||
* IBuildMacroProvider. CONTEXT_xxx constants
|
|
||||||
* @param contextData represents the additional data needed by the Build Macro Provider
|
|
||||||
* and Macro Suppliers in order to obtain the macro value. The type of the context data
|
|
||||||
* differs depending on the context type and can be one of the following:
|
|
||||||
* 1. IFileContextData interface � used to represent currently selected file context
|
|
||||||
* the IFileContextData interface is defined as follows:
|
|
||||||
* pulic interface IFileContextData{
|
|
||||||
* IFile getFile();
|
|
||||||
* IOption getOption();
|
|
||||||
* }
|
|
||||||
* NOTE: the IFileContextData is passed that represents the current file and the option
|
|
||||||
* for that file because Macro Value Provider needs to know what option should be used
|
|
||||||
* as a context in case macro is not found for �current file� context
|
|
||||||
* 2. IOptionContextData interface used to represent the currently selected option context
|
|
||||||
* 3. IConfiguration � used to represent the currently selected configuration context
|
|
||||||
* 4. IProject � used to represent current project context
|
|
||||||
* 5. IWorkspace � used to represent current workspace context
|
|
||||||
* 6. null � to represent the CDT and Eclipse installation context
|
|
||||||
* 7. null � to represent process environment context
|
|
||||||
* @param includeParentContext specifies whether lower-precedence context macros should
|
|
||||||
* be included
|
|
||||||
*/
|
*/
|
||||||
public ICdtVariable getVariable(String name, ICConfigurationDescription cfg);
|
public ICdtVariable getVariable(String name, ICConfigurationDescription cfg);
|
||||||
|
|
||||||
|
@ -91,8 +69,6 @@ public interface ICdtVariableManager{
|
||||||
* �<value_1>< listDelimiter ><value_2>< listDelimiter > ... <value_n>�
|
* �<value_1>< listDelimiter ><value_2>< listDelimiter > ... <value_n>�
|
||||||
* otherwise the BuildMacroException is thrown in case the string to be resolved references
|
* otherwise the BuildMacroException is thrown in case the string to be resolved references
|
||||||
* string-list macros
|
* string-list macros
|
||||||
* @param contextType context from which the macro search should be started
|
|
||||||
* @param contextData context data
|
|
||||||
*/
|
*/
|
||||||
public String resolveValue(String value,
|
public String resolveValue(String value,
|
||||||
String nonexistentMacrosValue,
|
String nonexistentMacrosValue,
|
||||||
|
@ -103,7 +79,6 @@ public interface ICdtVariableManager{
|
||||||
*
|
*
|
||||||
* if the string contains a value that can be treated as a StringList resolves it to arrays of strings
|
* if the string contains a value that can be treated as a StringList resolves it to arrays of strings
|
||||||
* otherwise throws the BuildMacroException exception
|
* otherwise throws the BuildMacroException exception
|
||||||
* @see isStringListValue
|
|
||||||
*/
|
*/
|
||||||
public String[] resolveStringListValue(String value,
|
public String[] resolveStringListValue(String value,
|
||||||
String nonexistentMacrosValue,
|
String nonexistentMacrosValue,
|
||||||
|
@ -114,7 +89,7 @@ public interface ICdtVariableManager{
|
||||||
*
|
*
|
||||||
* resolves macros in the array of string-list values
|
* resolves macros in the array of string-list values
|
||||||
*
|
*
|
||||||
* @see isStringListValue
|
* @see #isStringListValue
|
||||||
*/
|
*/
|
||||||
public String[] resolveStringListValues(String value[],
|
public String[] resolveStringListValues(String value[],
|
||||||
String nonexistentMacrosValue,
|
String nonexistentMacrosValue,
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.eclipse.core.runtime.Preferences;
|
||||||
|
|
||||||
public abstract class ACBuilder extends IncrementalProjectBuilder implements IMarkerGenerator {
|
public abstract class ACBuilder extends IncrementalProjectBuilder implements IMarkerGenerator {
|
||||||
|
|
||||||
private static final String PREF_BUILD_ALL_CONFIGS = "build.all.configs.enabled";
|
private static final String PREF_BUILD_ALL_CONFIGS = "build.all.configs.enabled"; //$NON-NLS-1$
|
||||||
private static final Preferences prefs = CCorePlugin.getDefault().getPluginPreferences();
|
private static final Preferences prefs = CCorePlugin.getDefault().getPluginPreferences();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,10 +52,10 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
||||||
* Try to find matching markers and don't put in duplicates
|
* Try to find matching markers and don't put in duplicates
|
||||||
*/
|
*/
|
||||||
if ((cur != null) && (cur.length > 0)) {
|
if ((cur != null) && (cur.length > 0)) {
|
||||||
for (int i = 0; i < cur.length; i++) {
|
for (IMarker element : cur) {
|
||||||
int line = ((Integer) cur[i].getAttribute(IMarker.LINE_NUMBER)).intValue();
|
int line = ((Integer) element.getAttribute(IMarker.LINE_NUMBER)).intValue();
|
||||||
int sev = ((Integer) cur[i].getAttribute(IMarker.SEVERITY)).intValue();
|
int sev = ((Integer) element.getAttribute(IMarker.SEVERITY)).intValue();
|
||||||
String mesg = (String) cur[i].getAttribute(IMarker.MESSAGE);
|
String mesg = (String) element.getAttribute(IMarker.MESSAGE);
|
||||||
if (line == problemMarkerInfo.lineNumber && sev == mapMarkerSeverity(problemMarkerInfo.severity) && mesg.equals(problemMarkerInfo.description)) {
|
if (line == problemMarkerInfo.lineNumber && sev == mapMarkerSeverity(problemMarkerInfo.severity) && mesg.equals(problemMarkerInfo.description)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,6 @@ public interface IPathEntryStore extends ICExtension {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the path entries save on the project.
|
* Returns the path entries save on the project.
|
||||||
* @param project
|
|
||||||
* @return
|
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
IPathEntry[] getRawPathEntries() throws CoreException;
|
IPathEntry[] getRawPathEntries() throws CoreException;
|
||||||
|
|
|
@ -33,8 +33,8 @@ public interface IPathEntryVariableChangeListener extends EventListener {
|
||||||
*
|
*
|
||||||
* @param event the path variable change event object describing which variable
|
* @param event the path variable change event object describing which variable
|
||||||
* changed and how
|
* changed and how
|
||||||
* @see IPathEntryVariableManager#addChangeListener(IPathVariableChangeListener)
|
* @see IPathEntryVariableManager#addChangeListener(IPathEntryVariableChangeListener)
|
||||||
* @see IPathEntryVariableManager#removeChangeListener(IPathVariableChangeListener)
|
* @see IPathEntryVariableManager#removeChangeListener(IPathEntryVariableChangeListener)
|
||||||
* @see PathEntryVariableChangeEvent
|
* @see PathEntryVariableChangeEvent
|
||||||
*/
|
*/
|
||||||
public void pathVariableChanged(PathEntryVariableChangeEvent event);
|
public void pathVariableChanged(PathEntryVariableChangeEvent event);
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
|
||||||
|
|
||||||
public class ScannerInfo implements IExtendedScannerInfo {
|
public class ScannerInfo implements IExtendedScannerInfo {
|
||||||
|
|
||||||
private final Map fMacroMap;
|
private final Map<String, String> fMacroMap;
|
||||||
private final String[] fSystemIncludePaths;
|
private final String[] fSystemIncludePaths;
|
||||||
private final String[] fMacroFiles;
|
private final String[] fMacroFiles;
|
||||||
private final String[] fIncludeFiles;
|
private final String[] fIncludeFiles;
|
||||||
|
@ -25,14 +25,20 @@ public class ScannerInfo implements IExtendedScannerInfo {
|
||||||
final static String[] EMPTY_ARRAY_STRING = new String[0];
|
final static String[] EMPTY_ARRAY_STRING = new String[0];
|
||||||
|
|
||||||
protected ScannerInfo(String[] systemIncludePaths, String[] localIncludePaths, String[] includeFiles,
|
protected ScannerInfo(String[] systemIncludePaths, String[] localIncludePaths, String[] includeFiles,
|
||||||
Map macroMap, String[] macroFiles) {
|
Map<String, String> macroMap, String[] macroFiles) {
|
||||||
fSystemIncludePaths = (systemIncludePaths == null) ? EMPTY_ARRAY_STRING : systemIncludePaths;
|
fSystemIncludePaths = (systemIncludePaths == null) ? EMPTY_ARRAY_STRING : systemIncludePaths;
|
||||||
fLocalIncludePaths = (localIncludePaths == null) ? EMPTY_ARRAY_STRING : localIncludePaths;
|
fLocalIncludePaths = (localIncludePaths == null) ? EMPTY_ARRAY_STRING : localIncludePaths;
|
||||||
fIncludeFiles = (includeFiles == null) ? EMPTY_ARRAY_STRING : includeFiles;
|
fIncludeFiles = (includeFiles == null) ? EMPTY_ARRAY_STRING : includeFiles;
|
||||||
fMacroFiles = (macroFiles == null) ? EMPTY_ARRAY_STRING : macroFiles;
|
fMacroFiles = (macroFiles == null) ? EMPTY_ARRAY_STRING : macroFiles;
|
||||||
fMacroMap = (macroMap == null) ? Collections.EMPTY_MAP : macroMap;
|
fMacroMap= nonNullMap(macroMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<String, String> nonNullMap(Map<String, String> macroMap) {
|
||||||
|
if (macroMap == null) {
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
return macroMap;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -47,7 +53,7 @@ public class ScannerInfo implements IExtendedScannerInfo {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
|
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths()
|
||||||
*/
|
*/
|
||||||
public synchronized Map getDefinedSymbols() {
|
public synchronized Map<String, String> getDefinedSymbols() {
|
||||||
return fMacroMap;
|
return fMacroMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.eclipse.core.runtime.IPath;
|
||||||
public class ScannerProvider extends AbstractCExtension implements IScannerInfoProvider, IElementChangedListener {
|
public class ScannerProvider extends AbstractCExtension implements IScannerInfoProvider, IElementChangedListener {
|
||||||
|
|
||||||
// Listeners interested in build model changes
|
// Listeners interested in build model changes
|
||||||
private static Map listeners;
|
private static Map<IProject, List<IScannerInfoChangeListener>> listeners;
|
||||||
|
|
||||||
private static ScannerProvider fProvider;
|
private static ScannerProvider fProvider;
|
||||||
|
|
||||||
|
@ -53,9 +53,9 @@ public class ScannerProvider extends AbstractCExtension implements IScannerInfoP
|
||||||
/*
|
/*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static Map getListeners() {
|
private static Map<IProject, List<IScannerInfoChangeListener>> getListeners() {
|
||||||
if (listeners == null) {
|
if (listeners == null) {
|
||||||
listeners = new HashMap();
|
listeners = new HashMap<IProject, List<IScannerInfoChangeListener>>();
|
||||||
}
|
}
|
||||||
return listeners;
|
return listeners;
|
||||||
}
|
}
|
||||||
|
@ -66,14 +66,14 @@ public class ScannerProvider extends AbstractCExtension implements IScannerInfoP
|
||||||
*/
|
*/
|
||||||
protected static void notifyInfoListeners(IProject project, IScannerInfo info) {
|
protected static void notifyInfoListeners(IProject project, IScannerInfo info) {
|
||||||
// Call in the cavalry
|
// Call in the cavalry
|
||||||
List listeners = (List)getListeners().get(project);
|
List<?> listeners = getListeners().get(project);
|
||||||
if (listeners == null) {
|
if (listeners == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IScannerInfoChangeListener[] observers = new IScannerInfoChangeListener[listeners.size()];
|
IScannerInfoChangeListener[] observers = new IScannerInfoChangeListener[listeners.size()];
|
||||||
listeners.toArray(observers);
|
listeners.toArray(observers);
|
||||||
for (int i = 0; i < observers.length; i++) {
|
for (IScannerInfoChangeListener observer : observers) {
|
||||||
observers[i].changeNotification(project, info);
|
observer.changeNotification(project, info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ public class ScannerProvider extends AbstractCExtension implements IScannerInfoP
|
||||||
|
|
||||||
// get the macros
|
// get the macros
|
||||||
IMacroEntry[] macros = CoreModel.getMacroEntries(resPath);
|
IMacroEntry[] macros = CoreModel.getMacroEntries(resPath);
|
||||||
Map symbolMap = new HashMap();
|
Map<String, String> symbolMap = new HashMap<String, String>();
|
||||||
for (int i = 0; i < macros.length; ++i) {
|
for (int i = 0; i < macros.length; ++i) {
|
||||||
symbolMap.put(macros[i].getMacroName(), macros[i].getMacroValue());
|
symbolMap.put(macros[i].getMacroName(), macros[i].getMacroValue());
|
||||||
}
|
}
|
||||||
|
@ -145,11 +145,11 @@ public class ScannerProvider extends AbstractCExtension implements IScannerInfoP
|
||||||
}
|
}
|
||||||
IProject project = resource.getProject();
|
IProject project = resource.getProject();
|
||||||
// Get listeners for this resource
|
// Get listeners for this resource
|
||||||
Map map = getListeners();
|
Map<IProject, List<IScannerInfoChangeListener>> map = getListeners();
|
||||||
List list = (List)map.get(project);
|
List<IScannerInfoChangeListener> list = map.get(project);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
// Create a new list
|
// Create a new list
|
||||||
list = new ArrayList();
|
list = new ArrayList<IScannerInfoChangeListener>();
|
||||||
map.put(project, list);
|
map.put(project, list);
|
||||||
}
|
}
|
||||||
if (!list.contains(listener)) {
|
if (!list.contains(listener)) {
|
||||||
|
@ -170,8 +170,8 @@ public class ScannerProvider extends AbstractCExtension implements IScannerInfoP
|
||||||
}
|
}
|
||||||
IProject project = resource.getProject();
|
IProject project = resource.getProject();
|
||||||
// Remove the listener
|
// Remove the listener
|
||||||
Map map = getListeners();
|
Map<IProject, List<IScannerInfoChangeListener>> map = getListeners();
|
||||||
List list = (List)map.get(project);
|
List<IScannerInfoChangeListener> list = map.get(project);
|
||||||
if (list != null && !list.isEmpty()) {
|
if (list != null && !list.isEmpty()) {
|
||||||
// The list is not empty so try to remove listener
|
// The list is not empty so try to remove listener
|
||||||
list.remove(listener);
|
list.remove(listener);
|
||||||
|
@ -213,8 +213,8 @@ public class ScannerProvider extends AbstractCExtension implements IScannerInfoP
|
||||||
}
|
}
|
||||||
|
|
||||||
ICElementDelta[] affectedChildren= delta.getAffectedChildren();
|
ICElementDelta[] affectedChildren= delta.getAffectedChildren();
|
||||||
for (int i= 0; i < affectedChildren.length; i++) {
|
for (ICElementDelta element2 : affectedChildren) {
|
||||||
processDelta(affectedChildren[i]);
|
processDelta(element2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.eclipse.core.runtime.SafeRunner;
|
||||||
*/
|
*/
|
||||||
public class PathEntryVariableManager implements IPathEntryVariableManager {
|
public class PathEntryVariableManager implements IPathEntryVariableManager {
|
||||||
|
|
||||||
private Set listeners;
|
private Set<IPathEntryVariableChangeListener> listeners;
|
||||||
private Preferences preferences;
|
private Preferences preferences;
|
||||||
|
|
||||||
static final String VARIABLE_PREFIX = "pathEntryVariable."; //$NON-NLS-1$
|
static final String VARIABLE_PREFIX = "pathEntryVariable."; //$NON-NLS-1$
|
||||||
|
@ -55,7 +55,7 @@ public class PathEntryVariableManager implements IPathEntryVariableManager {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private PathEntryVariableManager() {
|
private PathEntryVariableManager() {
|
||||||
this.listeners = Collections.synchronizedSet(new HashSet());
|
this.listeners = Collections.synchronizedSet(new HashSet<IPathEntryVariableChangeListener>());
|
||||||
this.preferences = CCorePlugin.getDefault().getPluginPreferences();
|
this.preferences = CCorePlugin.getDefault().getPluginPreferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class PathEntryVariableManager implements IPathEntryVariableManager {
|
||||||
* that. But then if they try and call #setValue using the same key it will throw
|
* that. But then if they try and call #setValue using the same key it will throw
|
||||||
* an exception. We may want to revisit this behaviour in the future.
|
* an exception. We may want to revisit this behaviour in the future.
|
||||||
*
|
*
|
||||||
* @see org.eclipse.core.resources.IPathEntryVariableManager#getValue(String)
|
* @see org.eclipse.cdt.core.resources.IPathEntryVariableManager#getValue(String)
|
||||||
*/
|
*/
|
||||||
public IPath getValue(String varName) {
|
public IPath getValue(String varName) {
|
||||||
String key = getKeyForName(varName);
|
String key = getKeyForName(varName);
|
||||||
|
@ -74,7 +74,7 @@ public class PathEntryVariableManager implements IPathEntryVariableManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.core.resources.IPathEntryVariableManager#setValue(String, IPath)
|
* @see org.eclipse.cdt.core.resources.IPathEntryVariableManager#setValue(String, IPath)
|
||||||
*/
|
*/
|
||||||
public void setValue(String varName, IPath newValue) throws CoreException {
|
public void setValue(String varName, IPath newValue) throws CoreException {
|
||||||
//if the location doesn't have a device, see if the OS will assign one
|
//if the location doesn't have a device, see if the OS will assign one
|
||||||
|
@ -86,10 +86,11 @@ public class PathEntryVariableManager implements IPathEntryVariableManager {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
IPath currentValue = getValue(varName);
|
IPath currentValue = getValue(varName);
|
||||||
boolean variableExists = currentValue != null;
|
boolean variableExists = currentValue != null;
|
||||||
if (!variableExists && newValue == null) {
|
if (currentValue == null) {
|
||||||
|
if (newValue == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (variableExists && currentValue.equals(newValue)) {
|
} else if (currentValue.equals(newValue)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (newValue == null) {
|
if (newValue == null) {
|
||||||
|
@ -112,7 +113,7 @@ public class PathEntryVariableManager implements IPathEntryVariableManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.core.resources.IPathEntryVariableManager#resolvePath(IPath)
|
* @see org.eclipse.cdt.core.resources.IPathEntryVariableManager#resolvePath(IPath)
|
||||||
*/
|
*/
|
||||||
public IPath resolvePath(IPath path) {
|
public IPath resolvePath(IPath path) {
|
||||||
if (path == null || path.segmentCount() == 0) {
|
if (path == null || path.segmentCount() == 0) {
|
||||||
|
@ -167,19 +168,19 @@ public class PathEntryVariableManager implements IPathEntryVariableManager {
|
||||||
* @see org.eclipse.core.resources.IPathVariableManager#getPathVariableNames()
|
* @see org.eclipse.core.resources.IPathVariableManager#getPathVariableNames()
|
||||||
*/
|
*/
|
||||||
public String[] getVariableNames() {
|
public String[] getVariableNames() {
|
||||||
List result = new LinkedList();
|
List<String> result = new LinkedList<String>();
|
||||||
String[] names = preferences.propertyNames();
|
String[] names = preferences.propertyNames();
|
||||||
for (int i = 0; i < names.length; i++) {
|
for (String name : names) {
|
||||||
if (names[i].startsWith(VARIABLE_PREFIX)) {
|
if (name.startsWith(VARIABLE_PREFIX)) {
|
||||||
String key = names[i].substring(VARIABLE_PREFIX.length());
|
String key = name.substring(VARIABLE_PREFIX.length());
|
||||||
result.add(key);
|
result.add(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (String[]) result.toArray(new String[result.size()]);
|
return result.toArray(new String[result.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.core.resources.
|
* @see org.eclipse.cdt.core.resources.
|
||||||
* IPathEntryVariableManager#addChangeListener(IPathEntryVariableChangeListener)
|
* IPathEntryVariableManager#addChangeListener(IPathEntryVariableChangeListener)
|
||||||
*/
|
*/
|
||||||
public void addChangeListener(IPathEntryVariableChangeListener listener) {
|
public void addChangeListener(IPathEntryVariableChangeListener listener) {
|
||||||
|
@ -187,7 +188,7 @@ public class PathEntryVariableManager implements IPathEntryVariableManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.core.resources.
|
* @see org.eclipse.cdt.core.resources.
|
||||||
* IPathEntryVariableManager#removeChangeListener(IPathEntryVariableChangeListener)
|
* IPathEntryVariableManager#removeChangeListener(IPathEntryVariableChangeListener)
|
||||||
*/
|
*/
|
||||||
public void removeChangeListener(IPathEntryVariableChangeListener listener) {
|
public void removeChangeListener(IPathEntryVariableChangeListener listener) {
|
||||||
|
|
|
@ -131,16 +131,16 @@ public class CdtMacroSupplier extends CoreMacroSupplierBase {
|
||||||
private String[] getMacroNames(int contextType, boolean clone){
|
private String[] getMacroNames(int contextType, boolean clone){
|
||||||
String names[] = null;
|
String names[] = null;
|
||||||
switch(contextType){
|
switch(contextType){
|
||||||
case DefaultVariableContextInfo.CONTEXT_CONFIGURATION:
|
case ICoreVariableContextInfo.CONTEXT_CONFIGURATION:
|
||||||
names = fConfigurationMacros;
|
names = fConfigurationMacros;
|
||||||
break;
|
break;
|
||||||
case DefaultVariableContextInfo.CONTEXT_WORKSPACE:
|
case ICoreVariableContextInfo.CONTEXT_WORKSPACE:
|
||||||
names = fWorkspaceMacros;
|
names = fWorkspaceMacros;
|
||||||
break;
|
break;
|
||||||
case DefaultVariableContextInfo.CONTEXT_INSTALLATIONS:
|
case ICoreVariableContextInfo.CONTEXT_INSTALLATIONS:
|
||||||
names = fCDTEclipseMacros;
|
names = fCDTEclipseMacros;
|
||||||
break;
|
break;
|
||||||
case DefaultVariableContextInfo.CONTEXT_ECLIPSEENV:
|
case ICoreVariableContextInfo.CONTEXT_ECLIPSEENV:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(names != null)
|
if(names != null)
|
||||||
|
@ -166,22 +166,22 @@ public class CdtMacroSupplier extends CoreMacroSupplierBase {
|
||||||
Object contextData) {
|
Object contextData) {
|
||||||
ICdtVariable macro = null;
|
ICdtVariable macro = null;
|
||||||
switch(contextType){
|
switch(contextType){
|
||||||
case DefaultVariableContextInfo.CONTEXT_CONFIGURATION:
|
case ICoreVariableContextInfo.CONTEXT_CONFIGURATION:
|
||||||
if(contextData instanceof ICConfigurationDescription){
|
if(contextData instanceof ICConfigurationDescription){
|
||||||
macro = getMacro(macroName, (ICConfigurationDescription)contextData);
|
macro = getMacro(macroName, (ICConfigurationDescription)contextData);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DefaultVariableContextInfo.CONTEXT_WORKSPACE:
|
case ICoreVariableContextInfo.CONTEXT_WORKSPACE:
|
||||||
if(contextData == null || contextData instanceof IWorkspace){
|
if(contextData == null || contextData instanceof IWorkspace){
|
||||||
macro = getMacro(macroName, (IWorkspace)contextData);
|
macro = getMacro(macroName, (IWorkspace)contextData);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DefaultVariableContextInfo.CONTEXT_INSTALLATIONS:
|
case ICoreVariableContextInfo.CONTEXT_INSTALLATIONS:
|
||||||
if(contextData == null){
|
if(contextData == null){
|
||||||
macro = getMacro(macroName);
|
macro = getMacro(macroName);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DefaultVariableContextInfo.CONTEXT_ECLIPSEENV:
|
case ICoreVariableContextInfo.CONTEXT_ECLIPSEENV:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,23 +368,23 @@ public class CdtMacroSupplier extends CoreMacroSupplierBase {
|
||||||
return macro;
|
return macro;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getBaseName(String name){
|
// private String getBaseName(String name){
|
||||||
String value = null;
|
// String value = null;
|
||||||
int index = name.lastIndexOf('.');
|
// int index = name.lastIndexOf('.');
|
||||||
if(index == -1)
|
// if(index == -1)
|
||||||
value = name;
|
// value = name;
|
||||||
else
|
// else
|
||||||
value = name.substring(0,index);
|
// value = name.substring(0,index);
|
||||||
return value;
|
// return value;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private String getExtension(String name){
|
// private String getExtension(String name){
|
||||||
String value = null;
|
// String value = null;
|
||||||
int index = name.lastIndexOf('.');
|
// int index = name.lastIndexOf('.');
|
||||||
if(index != -1)
|
// if(index != -1)
|
||||||
value = name.substring(index+1);
|
// value = name.substring(index+1);
|
||||||
return value;
|
// return value;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/* public IBuildMacro getMacro(String macroName, IManagedProject mngProj){
|
/* public IBuildMacro getMacro(String macroName, IManagedProject mngProj){
|
||||||
IBuildMacro macro = null;
|
IBuildMacro macro = null;
|
||||||
|
@ -474,8 +474,8 @@ public class CdtMacroSupplier extends CoreMacroSupplierBase {
|
||||||
if(names != null){
|
if(names != null){
|
||||||
ICdtVariable macros[] = new ICdtVariable[names.length];
|
ICdtVariable macros[] = new ICdtVariable[names.length];
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for(int i = 0; i < names.length; i++){
|
for (String name : names) {
|
||||||
ICdtVariable macro = getMacro(names[i],contextType,contextData);
|
ICdtVariable macro = getMacro(name,contextType,contextData);
|
||||||
if(macro != null)
|
if(macro != null)
|
||||||
macros[num++] = macro;
|
macros[num++] = macro;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,9 @@ import org.eclipse.core.variables.VariablesPlugin;
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class EclipseVariablesVariableSupplier implements ICdtVariableSupplier {
|
public class EclipseVariablesVariableSupplier implements ICdtVariableSupplier {
|
||||||
private static final String VAR_PREFIX = "${"; //$NON-NLS-1$
|
// private static final String VAR_PREFIX = "${"; //$NON-NLS-1$
|
||||||
private static final char VAR_SUFFIX = '}'; //$NON-NLS-1$
|
// private static final char VAR_SUFFIX = '}';
|
||||||
private static final char COLON = ':'; //$NON-NLS-1$
|
private static final char COLON = ':';
|
||||||
|
|
||||||
private static EclipseVariablesVariableSupplier fInstance;
|
private static EclipseVariablesVariableSupplier fInstance;
|
||||||
|
|
||||||
|
@ -155,30 +155,30 @@ public class EclipseVariablesVariableSupplier implements ICdtVariableSupplier {
|
||||||
|
|
||||||
IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
|
IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
|
||||||
IDynamicVariable vars[] = mngr.getDynamicVariables();
|
IDynamicVariable vars[] = mngr.getDynamicVariables();
|
||||||
Map map = new HashMap();
|
Map<String, IStringVariable> map = new HashMap<String, IStringVariable>();
|
||||||
for(int i = 0; i < vars.length; i++)
|
for (IDynamicVariable var : vars)
|
||||||
map.put(vars[i].getName(),vars[i]);
|
map.put(var.getName(),var);
|
||||||
|
|
||||||
IValueVariable valVars[] = mngr.getValueVariables();
|
IValueVariable valVars[] = mngr.getValueVariables();
|
||||||
for(int i = 0; i < valVars.length; i++)
|
for (IValueVariable valVar : valVars)
|
||||||
map.put(valVars[i].getName(),valVars[i]);
|
map.put(valVar.getName(),valVar);
|
||||||
|
|
||||||
Collection collection = map.values();
|
Collection<IStringVariable> collection = map.values();
|
||||||
EclipseVarMacro macros[] = new EclipseVarMacro[collection.size()];
|
EclipseVarMacro macros[] = new EclipseVarMacro[collection.size()];
|
||||||
Iterator iter = collection.iterator();
|
Iterator<IStringVariable> iter = collection.iterator();
|
||||||
for(int i = 0; i < macros.length ; i++)
|
for(int i = 0; i < macros.length ; i++)
|
||||||
macros[i] = new EclipseVarMacro((IStringVariable)iter.next());
|
macros[i] = new EclipseVarMacro(iter.next());
|
||||||
|
|
||||||
return macros;
|
return macros;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMacroValue(String name){
|
// private String getMacroValue(String name){
|
||||||
IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
|
// IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
|
||||||
try{
|
// try{
|
||||||
return mngr.performStringSubstitution(VAR_PREFIX + name + VAR_SUFFIX);
|
// return mngr.performStringSubstitution(VAR_PREFIX + name + VAR_SUFFIX);
|
||||||
}catch (CoreException e){
|
// }catch (CoreException e){
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,8 @@ public class StorableCdtVariables implements IStorableCdtVariables {
|
||||||
|
|
||||||
public StorableCdtVariables(ICdtVariable vars[], boolean readOnly) {
|
public StorableCdtVariables(ICdtVariable vars[], boolean readOnly) {
|
||||||
fMacros = new HashMap<String, ICdtVariable>(vars.length);
|
fMacros = new HashMap<String, ICdtVariable>(vars.length);
|
||||||
for(int i = 0; i < vars.length; i++){
|
for (ICdtVariable var : vars) {
|
||||||
addMacro(vars[i]);
|
addMacro(var);
|
||||||
}
|
}
|
||||||
fIsReadOnly = readOnly;
|
fIsReadOnly = readOnly;
|
||||||
}
|
}
|
||||||
|
@ -199,8 +199,8 @@ public class StorableCdtVariables implements IStorableCdtVariables {
|
||||||
public void createMacros(ICdtVariable macros[]){
|
public void createMacros(ICdtVariable macros[]){
|
||||||
if(fIsReadOnly)
|
if(fIsReadOnly)
|
||||||
throw ExceptionFactory.createIsReadOnlyException();
|
throw ExceptionFactory.createIsReadOnlyException();
|
||||||
for(int i = 0; i < macros.length; i++){
|
for (ICdtVariable macro : macros) {
|
||||||
createMacro(macros[i]);
|
createMacro(macro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,12 +319,12 @@ public class StorableCdtVariables implements IStorableCdtVariables {
|
||||||
if(name == null || "".equals(name = name.trim())) //$NON-NLS-1$
|
if(name == null || "".equals(name = name.trim())) //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
ICdtVariable var = (ICdtVariable)getMap().get(name);
|
ICdtVariable var = getMap().get(name);
|
||||||
if(var == null){
|
if(var == null){
|
||||||
int indx = name.indexOf(':');
|
int indx = name.indexOf(':');
|
||||||
if(indx != -1){
|
if(indx != -1){
|
||||||
String baseName = name.substring(0, indx);
|
String baseName = name.substring(0, indx);
|
||||||
ICdtVariable tmp = (ICdtVariable)getMap().get(baseName);
|
ICdtVariable tmp = getMap().get(baseName);
|
||||||
if(tmp != null
|
if(tmp != null
|
||||||
&& CdtVariableManager.getDefault().toEclipseVariable(tmp, null) != null){
|
&& CdtVariableManager.getDefault().toEclipseVariable(tmp, null) != null){
|
||||||
var = EclipseVariablesVariableSupplier.getInstance().getVariable(name);
|
var = EclipseVariablesVariableSupplier.getInstance().getVariable(name);
|
||||||
|
@ -346,7 +346,7 @@ public class StorableCdtVariables implements IStorableCdtVariables {
|
||||||
if(name == null || "".equals(name = name.trim())) //$NON-NLS-1$
|
if(name == null || "".equals(name = name.trim())) //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
ICdtVariable macro = (ICdtVariable)getMap().remove(name);
|
ICdtVariable macro = getMap().remove(name);
|
||||||
if(macro != null){
|
if(macro != null){
|
||||||
fIsDirty = true;
|
fIsDirty = true;
|
||||||
fIsChanged = true;
|
fIsChanged = true;
|
||||||
|
|
|
@ -18,7 +18,6 @@ import java.io.UnsupportedEncodingException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
@ -350,8 +349,8 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
try {
|
try {
|
||||||
String[] value = fVar.getStringListValue();
|
String[] value = fVar.getStringListValue();
|
||||||
if(value != null){
|
if(value != null){
|
||||||
for(int i = 0; i < value.length; i++){
|
for (String element : value) {
|
||||||
code += value[i].hashCode();
|
code += element.hashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CdtVariableException e) {
|
} catch (CdtVariableException e) {
|
||||||
|
@ -395,19 +394,19 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
|
|
||||||
if(oldVars == null || oldVars.length == 0){
|
if(oldVars == null || oldVars.length == 0){
|
||||||
if(newVars != null && newVars.length != 0)
|
if(newVars != null && newVars.length != 0)
|
||||||
addedVars = (ICdtVariable[])newVars.clone() ;
|
addedVars = newVars.clone() ;
|
||||||
} else if(newVars == null || newVars.length == 0){
|
} else if(newVars == null || newVars.length == 0){
|
||||||
removedVars = (ICdtVariable[])oldVars.clone();
|
removedVars = oldVars.clone();
|
||||||
} else {
|
} else {
|
||||||
HashSet<VarKey> newSet = new HashSet<VarKey>(newVars.length);
|
HashSet<VarKey> newSet = new HashSet<VarKey>(newVars.length);
|
||||||
HashSet<VarKey> oldSet = new HashSet<VarKey>(oldVars.length);
|
HashSet<VarKey> oldSet = new HashSet<VarKey>(oldVars.length);
|
||||||
|
|
||||||
for(int i = 0; i < newVars.length; i++){
|
for (ICdtVariable newVar : newVars) {
|
||||||
newSet.add(new VarKey(newVars[i], true));
|
newSet.add(new VarKey(newVar, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < oldVars.length; i++){
|
for (ICdtVariable oldVar : oldVars) {
|
||||||
oldSet.add(new VarKey(oldVars[i], true));
|
oldSet.add(new VarKey(oldVar, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
HashSet<VarKey> newSetCopy = (HashSet<VarKey>)newSet.clone();
|
HashSet<VarKey> newSetCopy = (HashSet<VarKey>)newSet.clone();
|
||||||
|
@ -426,13 +425,13 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
newSetCopy.removeAll(newSet);
|
newSetCopy.removeAll(newSet);
|
||||||
|
|
||||||
HashSet modifiedSet = new HashSet(newSetCopy.size());
|
HashSet modifiedSet = new HashSet(newSetCopy.size());
|
||||||
for(Iterator iter = newSetCopy.iterator(); iter.hasNext();){
|
for (Object element : newSetCopy) {
|
||||||
VarKey key = (VarKey)iter.next();
|
VarKey key = (VarKey)element;
|
||||||
modifiedSet.add(new VarKey(key.getVariable(), false));
|
modifiedSet.add(new VarKey(key.getVariable(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < oldVars.length; i++){
|
for (ICdtVariable oldVar : oldVars) {
|
||||||
modifiedSet.remove(new VarKey(oldVars[i], false));
|
modifiedSet.remove(new VarKey(oldVar, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(modifiedSet.size() != 0)
|
if(modifiedSet.size() != 0)
|
||||||
|
@ -513,8 +512,7 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
protected void loadPathEntryVariables(StorableCdtVariables vars){
|
protected void loadPathEntryVariables(StorableCdtVariables vars){
|
||||||
org.eclipse.core.runtime.Preferences prefs = CCorePlugin.getDefault().getPluginPreferences();
|
org.eclipse.core.runtime.Preferences prefs = CCorePlugin.getDefault().getPluginPreferences();
|
||||||
String[] names = prefs.propertyNames();
|
String[] names = prefs.propertyNames();
|
||||||
for(int i = 0; i < names.length; i++){
|
for (String name : names) {
|
||||||
String name = names[i];
|
|
||||||
if (name.startsWith(OLD_VARIABLE_PREFIX)) {
|
if (name.startsWith(OLD_VARIABLE_PREFIX)) {
|
||||||
String value = prefs.getString(name);
|
String value = prefs.getString(name);
|
||||||
prefs.setToDefault(name);
|
prefs.setToDefault(name);
|
||||||
|
@ -662,9 +660,9 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notifyListeners(VariableChangeEvent event){
|
private void notifyListeners(VariableChangeEvent event){
|
||||||
ICdtVariableChangeListener[] listeners = (ICdtVariableChangeListener[])fListeners.toArray(new ICdtVariableChangeListener[fListeners.size()]);
|
ICdtVariableChangeListener[] listeners = fListeners.toArray(new ICdtVariableChangeListener[fListeners.size()]);
|
||||||
for(int i = 0; i < listeners.length; i++){
|
for (ICdtVariableChangeListener listener : listeners) {
|
||||||
listeners[i].variablesChanged(event);
|
listener.variablesChanged(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package org.eclipse.cdt.internal.core.dom;
|
package org.eclipse.cdt.internal.core.dom;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.CDOM;
|
import org.eclipse.cdt.core.dom.CDOM;
|
||||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopyProvider;
|
import org.eclipse.cdt.core.model.IWorkingCopyProvider;
|
||||||
import org.eclipse.cdt.core.parser.CodeReader;
|
import org.eclipse.cdt.core.parser.CodeReader;
|
||||||
import org.eclipse.cdt.core.parser.IScanner;
|
import org.eclipse.cdt.core.parser.IScanner;
|
||||||
|
@ -19,8 +18,7 @@ import org.eclipse.cdt.core.parser.IScanner;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class WorkingCopyCodeReaderFactory extends
|
public class WorkingCopyCodeReaderFactory extends PartialWorkingCopyCodeReaderFactory {
|
||||||
PartialWorkingCopyCodeReaderFactory implements ICodeReaderFactory {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param provider
|
* @param provider
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class EnvironmentVariableManager implements
|
||||||
|
|
||||||
if(contextInfo == null)
|
if(contextInfo == null)
|
||||||
return null;
|
return null;
|
||||||
if((variableName = EnvVarOperationProcessor.normalizeName(variableName)) == null) //$NON-NLS-1$
|
if((variableName = EnvVarOperationProcessor.normalizeName(variableName)) == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,8 +133,8 @@ public class EnvironmentVariableManager implements
|
||||||
if(!includeParentLevels){
|
if(!includeParentLevels){
|
||||||
ICoreEnvironmentVariableSupplier suppliers[] = infos[0].getSuppliers();
|
ICoreEnvironmentVariableSupplier suppliers[] = infos[0].getSuppliers();
|
||||||
boolean bVarFound = false;
|
boolean bVarFound = false;
|
||||||
for(int i = 0; i < suppliers.length; i++){
|
for (ICoreEnvironmentVariableSupplier supplier : suppliers) {
|
||||||
if(suppliers[i].getVariable(variableName,infos[0].getContext()) != null){
|
if(supplier.getVariable(variableName,infos[0].getContext()) != null){
|
||||||
bVarFound = true;
|
bVarFound = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -224,16 +224,16 @@ public class EnvironmentVariableManager implements
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
IEnvironmentContextInfo infos[] = getAllContextInfos(contextInfo);
|
IEnvironmentContextInfo infos[] = getAllContextInfos(contextInfo);
|
||||||
HashSet set = null;
|
HashSet<String> set = null;
|
||||||
|
|
||||||
if(!includeParentLevels){
|
if(!includeParentLevels){
|
||||||
ICoreEnvironmentVariableSupplier suppliers[] = infos[0].getSuppliers();
|
ICoreEnvironmentVariableSupplier suppliers[] = infos[0].getSuppliers();
|
||||||
set = new HashSet();
|
set = new HashSet<String>();
|
||||||
for(int i = 0; i < suppliers.length; i++){
|
for(int i = 0; i < suppliers.length; i++){
|
||||||
IEnvironmentVariable vars[] = suppliers[i].getVariables(infos[0].getContext());
|
IEnvironmentVariable vars[] = suppliers[i].getVariables(infos[0].getContext());
|
||||||
if(vars != null){
|
if(vars != null){
|
||||||
for(int j = 0; j < vars.length; j++){
|
for (IEnvironmentVariable var : vars) {
|
||||||
String name = EnvVarOperationProcessor.normalizeName(vars[j].
|
String name = EnvVarOperationProcessor.normalizeName(var.
|
||||||
getName());
|
getName());
|
||||||
if(name != null)
|
if(name != null)
|
||||||
set.add(name);
|
set.add(name);
|
||||||
|
@ -260,15 +260,15 @@ public class EnvironmentVariableManager implements
|
||||||
|
|
||||||
IEnvironmentVariable vars[] = null;
|
IEnvironmentVariable vars[] = null;
|
||||||
if(set != null){
|
if(set != null){
|
||||||
List varList = new ArrayList();
|
List<IEnvironmentVariable> varList = new ArrayList<IEnvironmentVariable>();
|
||||||
Iterator iter = set.iterator();
|
Iterator<String> iter = set.iterator();
|
||||||
|
|
||||||
while(iter.hasNext()){
|
while(iter.hasNext()){
|
||||||
IEnvironmentVariable var = supplier.getVariable((String)iter.next(),info.getContext());
|
IEnvironmentVariable var = supplier.getVariable(iter.next(),info.getContext());
|
||||||
if(var != null)
|
if(var != null)
|
||||||
varList.add(var);
|
varList.add(var);
|
||||||
}
|
}
|
||||||
vars = (IEnvironmentVariable[])varList.toArray(new IEnvironmentVariable[varList.size()]);
|
vars = varList.toArray(new IEnvironmentVariable[varList.size()]);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
vars = supplier.getVariables(info.getContext());
|
vars = supplier.getVariables(info.getContext());
|
||||||
|
@ -311,14 +311,14 @@ public class EnvironmentVariableManager implements
|
||||||
if(contextInfo == null)
|
if(contextInfo == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
List list = new ArrayList();
|
List<IEnvironmentContextInfo> list = new ArrayList<IEnvironmentContextInfo>();
|
||||||
|
|
||||||
list.add(contextInfo);
|
list.add(contextInfo);
|
||||||
|
|
||||||
while((contextInfo = contextInfo.getNext()) != null)
|
while((contextInfo = contextInfo.getNext()) != null)
|
||||||
list.add(contextInfo);
|
list.add(contextInfo);
|
||||||
|
|
||||||
return (IEnvironmentContextInfo[])list.toArray(new IEnvironmentContextInfo[list.size()]);
|
return list.toArray(new IEnvironmentContextInfo[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isWin32(){
|
private boolean isWin32(){
|
||||||
|
@ -371,7 +371,7 @@ public class EnvironmentVariableManager implements
|
||||||
if(des == null || info == null)
|
if(des == null || info == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return calculateResolvedVariable(des,getVariableSubstitutor(getMacroContextInfoForContext(info.getContext()),""," ")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
return calculateResolvedVariable(des,getVariableSubstitutor(getMacroContextInfoForContext(info.getContext()),""," ")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnvironmentVariable calculateResolvedVariable(EnvVarDescriptor des, IVariableSubstitutor sub){
|
public IEnvironmentVariable calculateResolvedVariable(EnvVarDescriptor des, IVariableSubstitutor sub){
|
||||||
|
|
|
@ -185,7 +185,7 @@ public class UserDefinedEnvironmentSupplier extends
|
||||||
else if(context == null || context instanceof IWorkspace){
|
else if(context == null || context instanceof IWorkspace){
|
||||||
final Preferences prefs = getWorkspaceNode();
|
final Preferences prefs = getWorkspaceNode();
|
||||||
final String name = PREFNAME_WORKSPACE;
|
final String name = PREFNAME_WORKSPACE;
|
||||||
if(prefs != null && name != null)
|
if (prefs != null)
|
||||||
serializeInfo = new ISerializeInfo(){
|
serializeInfo = new ISerializeInfo(){
|
||||||
public Preferences getNode(){
|
public Preferences getNode(){
|
||||||
return prefs;
|
return prefs;
|
||||||
|
@ -237,9 +237,9 @@ public class UserDefinedEnvironmentSupplier extends
|
||||||
try{
|
try{
|
||||||
String ids[] = prefNode.keys();
|
String ids[] = prefNode.keys();
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for( int i = 0; i < ids.length; i++){
|
for (String id : ids) {
|
||||||
if(projDes.getConfigurationById(ids[i]) == null){
|
if(projDes.getConfigurationById(id) == null){
|
||||||
prefNode.remove(ids[i]);
|
prefNode.remove(id);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -285,22 +285,23 @@ public class UserDefinedEnvironmentSupplier extends
|
||||||
|
|
||||||
if(oldVars == null || oldVars.length == 0){
|
if(oldVars == null || oldVars.length == 0){
|
||||||
if(newVars != null && newVars.length != 0)
|
if(newVars != null && newVars.length != 0)
|
||||||
addedVars = (IEnvironmentVariable[])newVars.clone() ;
|
addedVars = newVars.clone();
|
||||||
} else if(newVars == null || newVars.length == 0){
|
} else if(newVars == null || newVars.length == 0){
|
||||||
removedVars = (IEnvironmentVariable[])oldVars.clone();
|
removedVars = oldVars.clone();
|
||||||
} else {
|
} else {
|
||||||
HashSet newSet = new HashSet(newVars.length);
|
HashSet<VarKey> newSet = new HashSet<VarKey>(newVars.length);
|
||||||
HashSet oldSet = new HashSet(oldVars.length);
|
HashSet<VarKey> oldSet = new HashSet<VarKey>(oldVars.length);
|
||||||
|
|
||||||
for(int i = 0; i < newVars.length; i++){
|
for (IEnvironmentVariable newVar : newVars) {
|
||||||
newSet.add(new VarKey(newVars[i], true));
|
newSet.add(new VarKey(newVar, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < oldVars.length; i++){
|
for (IEnvironmentVariable oldVar : oldVars) {
|
||||||
oldSet.add(new VarKey(oldVars[i], true));
|
oldSet.add(new VarKey(oldVar, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
HashSet newSetCopy = (HashSet)newSet.clone();
|
@SuppressWarnings("unchecked")
|
||||||
|
HashSet<VarKey> newSetCopy = (HashSet<VarKey>)newSet.clone();
|
||||||
|
|
||||||
newSet.removeAll(oldSet);
|
newSet.removeAll(oldSet);
|
||||||
oldSet.removeAll(newSetCopy);
|
oldSet.removeAll(newSetCopy);
|
||||||
|
@ -315,14 +316,13 @@ public class UserDefinedEnvironmentSupplier extends
|
||||||
|
|
||||||
newSetCopy.removeAll(newSet);
|
newSetCopy.removeAll(newSet);
|
||||||
|
|
||||||
HashSet modifiedSet = new HashSet(newSetCopy.size());
|
HashSet<VarKey> modifiedSet = new HashSet<VarKey>(newSetCopy.size());
|
||||||
for(Iterator iter = newSetCopy.iterator(); iter.hasNext();){
|
for (VarKey key : newSetCopy) {
|
||||||
VarKey key = (VarKey)iter.next();
|
|
||||||
modifiedSet.add(new VarKey(key.getVariable(), false));
|
modifiedSet.add(new VarKey(key.getVariable(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < oldVars.length; i++){
|
for (IEnvironmentVariable oldVar : oldVars) {
|
||||||
modifiedSet.remove(new VarKey(oldVars[i], false));
|
modifiedSet.remove(new VarKey(oldVar, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(modifiedSet.size() != 0)
|
if(modifiedSet.size() != 0)
|
||||||
|
@ -334,11 +334,11 @@ public class UserDefinedEnvironmentSupplier extends
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IEnvironmentVariable[] varsFromKeySet(Set set){
|
static IEnvironmentVariable[] varsFromKeySet(Set<VarKey> set){
|
||||||
IEnvironmentVariable vars[] = new IEnvironmentVariable[set.size()];
|
IEnvironmentVariable vars[] = new IEnvironmentVariable[set.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(Iterator iter = set.iterator(); iter.hasNext(); i++){
|
for(Iterator<VarKey> iter = set.iterator(); iter.hasNext(); i++){
|
||||||
VarKey key = (VarKey)iter.next();
|
VarKey key = iter.next();
|
||||||
vars[i] = key.getVariable();
|
vars[i] = key.getVariable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,8 +348,8 @@ public class UserDefinedEnvironmentSupplier extends
|
||||||
|
|
||||||
public void storeProjectEnvironment(ICProjectDescription des, boolean force){
|
public void storeProjectEnvironment(ICProjectDescription des, boolean force){
|
||||||
ICConfigurationDescription cfgs[] = des.getConfigurations();
|
ICConfigurationDescription cfgs[] = des.getConfigurations();
|
||||||
for(int i = 0; i < cfgs.length; i++){
|
for (ICConfigurationDescription cfg : cfgs) {
|
||||||
storeEnvironment(cfgs[i], force, false);
|
storeEnvironment(cfg, force, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Preferences node = getProjectNode(des);
|
Preferences node = getProjectNode(des);
|
||||||
|
|
|
@ -158,7 +158,7 @@ public class ErrorPattern {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
CygPath cygpath = null ;
|
CygPath cygpath = null ;
|
||||||
try {
|
try {
|
||||||
cygpath = new CygPath("cygpath");
|
cygpath = new CygPath("cygpath"); //$NON-NLS-1$
|
||||||
String cygfilename = cygpath.getFileName(filename);
|
String cygfilename = cygpath.getFileName(filename);
|
||||||
path = new Path(cygfilename);
|
path = new Path(cygfilename);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
public class MakeErrorParser extends AbstractErrorParser {
|
public class MakeErrorParser extends AbstractErrorParser {
|
||||||
private static final ErrorPattern[] patterns = {
|
private static final ErrorPattern[] patterns = {
|
||||||
new ErrorPattern("make\\[(.*)\\]: Entering directory `(.*)'", 0, 0) { //$NON-NLS-1
|
new ErrorPattern("make\\[(.*)\\]: Entering directory `(.*)'", 0, 0) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
int level;
|
int level;
|
||||||
|
@ -42,14 +42,14 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new ErrorPattern("make\\[.*\\]: Leaving directory", 0, 0) { //$NON-NLS-1
|
new ErrorPattern("make\\[.*\\]: Leaving directory", 0, 0) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
eoParser.popDirectory();
|
eoParser.popDirectory();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new ErrorPattern("(make: \\*\\*\\* \\[.*\\] Error .*)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make: \\*\\*\\* \\[.*\\] Error .*)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -57,7 +57,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//make [foo] Error NN
|
//make [foo] Error NN
|
||||||
new ErrorPattern("(make.*\\[.*\\] Error [-]{0,1}\\d*.*)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*\\[.*\\] Error [-]{0,1}\\d*.*)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -68,14 +68,14 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
//[foo] signal description
|
//[foo] signal description
|
||||||
// Turning off for now, bug 203269
|
// Turning off for now, bug 203269
|
||||||
// This is reporting an error on the line 'make -j8 ...'
|
// This is reporting an error on the line 'make -j8 ...'
|
||||||
// new ErrorPattern("(make.*\\d+\\s+\\w+.*)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
// new ErrorPattern("(make.*\\d+\\s+\\w+.*)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
// protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
// protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
// super.recordError(matcher, eoParser);
|
// super.recordError(matcher, eoParser);
|
||||||
// return true;
|
// return true;
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
//missing separator. Stop.
|
//missing separator. Stop.
|
||||||
new ErrorPattern("(make.*missing separator.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*missing separator.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -83,7 +83,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//missing separator (did you mean TAB instead of 8 spaces?\\). Stop.
|
//missing separator (did you mean TAB instead of 8 spaces?\\). Stop.
|
||||||
new ErrorPattern("(make.*missing separator \\(did you mean TAB instead of 8 spaces?\\).\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*missing separator \\(did you mean TAB instead of 8 spaces?\\).\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -91,7 +91,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//commands commence before first target. Stop.
|
//commands commence before first target. Stop.
|
||||||
new ErrorPattern("(make.*commands commence before first target.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*commands commence before first target.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -99,7 +99,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//commands commence before first target. Stop.
|
//commands commence before first target. Stop.
|
||||||
new ErrorPattern("(make.*commands commence before first target.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*commands commence before first target.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -107,7 +107,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//missing rule before commands. Stop.
|
//missing rule before commands. Stop.
|
||||||
new ErrorPattern("(make.*missing rule before commands.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*missing rule before commands.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -115,7 +115,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//missing rule before commands. Stop.
|
//missing rule before commands. Stop.
|
||||||
new ErrorPattern("(make.*missing rule before commands.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*missing rule before commands.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -123,7 +123,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//No rule to make target `xxx'.
|
//No rule to make target `xxx'.
|
||||||
new ErrorPattern("(make.*No rule to make target `.*'.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*No rule to make target `.*'.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -131,7 +131,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//No rule to make target `xxx', needed by `yyy'.
|
//No rule to make target `xxx', needed by `yyy'.
|
||||||
new ErrorPattern("(make.*No rule to make target `.*', needed by `.*'.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*No rule to make target `.*', needed by `.*'.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -139,7 +139,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//No targets specified and no makefile found. Stop.
|
//No targets specified and no makefile found. Stop.
|
||||||
new ErrorPattern("(make.*No targets specified and no makefile found.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*No targets specified and no makefile found.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -147,7 +147,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//No targets. Stop.
|
//No targets. Stop.
|
||||||
new ErrorPattern("(make.*No targets.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*No targets.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -155,7 +155,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//Makefile `xxx' was not found.
|
//Makefile `xxx' was not found.
|
||||||
new ErrorPattern("(make.*Makefile `.*' was not found.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*Makefile `.*' was not found.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -163,7 +163,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//Included makefile `xxx' was not found.
|
//Included makefile `xxx' was not found.
|
||||||
new ErrorPattern("(make.*Included makefile `.*' was not found.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*Included makefile `.*' was not found.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -171,7 +171,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//warning: overriding commands for target `xxx'
|
//warning: overriding commands for target `xxx'
|
||||||
new ErrorPattern("(make.*warning: overriding commands for target `.*')", 1, IMarkerGenerator.SEVERITY_WARNING) { //$NON-NLS-1
|
new ErrorPattern("(make.*warning: overriding commands for target `.*')", 1, IMarkerGenerator.SEVERITY_WARNING) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -179,7 +179,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//warning: ignoring old commands for target `xxx'
|
//warning: ignoring old commands for target `xxx'
|
||||||
new ErrorPattern("(make.*warning: ignoring old commands for target `.*')", 1, IMarkerGenerator.SEVERITY_WARNING) { //$NON-NLS-1
|
new ErrorPattern("(make.*warning: ignoring old commands for target `.*')", 1, IMarkerGenerator.SEVERITY_WARNING) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -187,7 +187,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//Circular .+ <- .+ dependency dropped.
|
//Circular .+ <- .+ dependency dropped.
|
||||||
new ErrorPattern("(make.*Circular .+ <- .+ dependency dropped.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*Circular .+ <- .+ dependency dropped.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -195,7 +195,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//Recursive variable `xxx' references itself (eventually). Stop.
|
//Recursive variable `xxx' references itself (eventually). Stop.
|
||||||
new ErrorPattern("(make.*Recursive variable `.*' references itself \\(eventually\\).\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*Recursive variable `.*' references itself \\(eventually\\).\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -203,7 +203,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//Unterminated variable reference. Stop.
|
//Unterminated variable reference. Stop.
|
||||||
new ErrorPattern("(make.*[uU]nterminated variable reference.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*[uU]nterminated variable reference.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -211,7 +211,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//insufficient arguments to function `.*'. Stop.
|
//insufficient arguments to function `.*'. Stop.
|
||||||
new ErrorPattern("(make.*insufficient arguments to function `.*'.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*insufficient arguments to function `.*'.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -219,7 +219,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//missing target pattern. Stop.
|
//missing target pattern. Stop.
|
||||||
new ErrorPattern("(make.*missing target pattern.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*missing target pattern.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -227,7 +227,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//multiple target patterns. Stop.
|
//multiple target patterns. Stop.
|
||||||
new ErrorPattern("(make.*multiple target patterns.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*multiple target patterns.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -235,7 +235,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//target pattern contains no `%'. Stop.
|
//target pattern contains no `%'. Stop.
|
||||||
new ErrorPattern("(make.*target pattern contains no `%'.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*target pattern contains no `%'.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -243,7 +243,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//mixed implicit and static pattern rules. Stop.
|
//mixed implicit and static pattern rules. Stop.
|
||||||
new ErrorPattern("(make.*mixed implicit and static pattern rules.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*mixed implicit and static pattern rules.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -251,7 +251,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//mixed implicit and static pattern rules. Stop.
|
//mixed implicit and static pattern rules. Stop.
|
||||||
new ErrorPattern("(make.*mixed implicit and static pattern rules.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*mixed implicit and static pattern rules.\\s*Stop.)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -259,7 +259,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//warning: -jN forced in submake: disabling jobserver mode.
|
//warning: -jN forced in submake: disabling jobserver mode.
|
||||||
new ErrorPattern("(make.*warning: -jN forced in submake: disabling jobserver mode.)", 1, IMarkerGenerator.SEVERITY_WARNING) { //$NON-NLS-1
|
new ErrorPattern("(make.*warning: -jN forced in submake: disabling jobserver mode.)", 1, IMarkerGenerator.SEVERITY_WARNING) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -267,7 +267,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//warning: jobserver unavailable: using -j1. Add `+' to parent make rule.
|
//warning: jobserver unavailable: using -j1. Add `+' to parent make rule.
|
||||||
new ErrorPattern("(make.*warning: jobserver unavailable: using -j1. Add `+' to parent make rule.)", 1, IMarkerGenerator.SEVERITY_WARNING) { //$NON-NLS-1
|
new ErrorPattern("(make.*warning: jobserver unavailable: using -j1. Add `+' to parent make rule.)", 1, IMarkerGenerator.SEVERITY_WARNING) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -275,7 +275,7 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//target `abc' doesn't match the target pattern
|
//target `abc' doesn't match the target pattern
|
||||||
new ErrorPattern("(make.*target `.*' doesn't match the target pattern)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1
|
new ErrorPattern("(make.*target `.*' doesn't match the target pattern)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
|
||||||
super.recordError(matcher, eoParser);
|
super.recordError(matcher, eoParser);
|
||||||
|
@ -287,4 +287,4 @@ public class MakeErrorParser extends AbstractErrorParser {
|
||||||
public MakeErrorParser() {
|
public MakeErrorParser() {
|
||||||
super(patterns);
|
super(patterns);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@ import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
public class VCErrorParser extends AbstractErrorParser {
|
public class VCErrorParser extends AbstractErrorParser {
|
||||||
|
|
||||||
private static final ErrorPattern[] patterns = {
|
private static final ErrorPattern[] patterns = {
|
||||||
new ErrorPattern("(.+?)(\\(([0-9]+)\\))? : (fatal error|error|warning) (.*)", 1, 3, 5, 0, 0) {
|
new ErrorPattern("(.+?)(\\(([0-9]+)\\))? : (fatal error|error|warning) (.*)", 1, 3, 5, 0, 0) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
public int getSeverity(Matcher matcher) {
|
public int getSeverity(Matcher matcher) {
|
||||||
return "warning".equals(matcher.group(4))
|
return "warning".equals(matcher.group(4)) //$NON-NLS-1$
|
||||||
? IMarkerGenerator.SEVERITY_WARNING
|
? IMarkerGenerator.SEVERITY_WARNING
|
||||||
: IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
|
: IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,14 +41,14 @@ public abstract class BinaryFile extends PlatformObject implements IBinaryFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getFile()
|
* @see org.eclipse.cdt.core.IBinaryParser.IBinaryFile#getPath()
|
||||||
*/
|
*/
|
||||||
public final IPath getPath() {
|
public final IPath getPath() {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getType()
|
* @see org.eclipse.cdt.core.IBinaryParser.IBinaryFile#getType()
|
||||||
*/
|
*/
|
||||||
public final int getType() {
|
public final int getType() {
|
||||||
return type;
|
return type;
|
||||||
|
@ -56,7 +56,7 @@ public abstract class BinaryFile extends PlatformObject implements IBinaryFile {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getContents()
|
* @see org.eclipse.cdt.core.IBinaryParser.IBinaryFile#getContents()
|
||||||
*/
|
*/
|
||||||
public InputStream getContents() throws IOException {
|
public InputStream getContents() throws IOException {
|
||||||
InputStream stream = null;
|
InputStream stream = null;
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class WindowsRegistry {
|
||||||
if (registry == null && !failed) {
|
if (registry == null && !failed) {
|
||||||
if (Platform.getOS().equals(Platform.OS_WIN32)) {
|
if (Platform.getOS().equals(Platform.OS_WIN32)) {
|
||||||
try {
|
try {
|
||||||
System.loadLibrary("winreg");
|
System.loadLibrary("winreg"); //$NON-NLS-1$
|
||||||
registry = new WindowsRegistry();
|
registry = new WindowsRegistry();
|
||||||
} catch (UnsatisfiedLinkError e) {
|
} catch (UnsatisfiedLinkError e) {
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|
|
@ -28,8 +28,8 @@ public class CdtVariableResolver {
|
||||||
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String VARIABLE_PREFIX = "${"; //$NON-NLS-1$
|
public static final String VARIABLE_PREFIX = "${"; //$NON-NLS-1$
|
||||||
public static final char VARIABLE_SUFFIX = '}'; //$NON-NLS-1$
|
public static final char VARIABLE_SUFFIX = '}';
|
||||||
public static final char VARIABLE_ESCAPE_CHAR = '\\'; //$NON-NLS-1$
|
public static final char VARIABLE_ESCAPE_CHAR = '\\';
|
||||||
private static final int VARIABLE_PREFIX_LENGTH = VARIABLE_PREFIX.length();
|
private static final int VARIABLE_PREFIX_LENGTH = VARIABLE_PREFIX.length();
|
||||||
|
|
||||||
static public String convertStringListToString(String value[], String listDelimiter) {
|
static public String convertStringListToString(String value[], String listDelimiter) {
|
||||||
|
@ -168,10 +168,6 @@ public class CdtVariableResolver {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* resolves macros in the array of string-list values
|
* resolves macros in the array of string-list values
|
||||||
* @param values
|
|
||||||
* @param substitutor
|
|
||||||
* @param ignoreErrors
|
|
||||||
* @return
|
|
||||||
* @throws CdtVariableException
|
* @throws CdtVariableException
|
||||||
*/
|
*/
|
||||||
static public String[] resolveStringListValues(String values[], IVariableSubstitutor substitutor, boolean ignoreErrors)
|
static public String[] resolveStringListValues(String values[], IVariableSubstitutor substitutor, boolean ignoreErrors)
|
||||||
|
@ -187,11 +183,11 @@ public class CdtVariableResolver {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
List list = new ArrayList();
|
List<String> list = new ArrayList<String>();
|
||||||
for(int i = 0; i < values.length; i++){
|
for (String value : values) {
|
||||||
String resolved[];
|
String resolved[];
|
||||||
try {
|
try {
|
||||||
resolved = CdtVariableResolver.resolveToStringList(values[i], substitutor);
|
resolved = CdtVariableResolver.resolveToStringList(value, substitutor);
|
||||||
if(resolved != null && resolved.length > 0)
|
if(resolved != null && resolved.length > 0)
|
||||||
list.addAll(Arrays.asList(resolved));
|
list.addAll(Arrays.asList(resolved));
|
||||||
} catch (CdtVariableException e) {
|
} catch (CdtVariableException e) {
|
||||||
|
@ -200,17 +196,13 @@ public class CdtVariableResolver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = (String[])list.toArray(new String[list.size()]);
|
result = list.toArray(new String[list.size()]);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves macros in the given String to the String-list
|
* Resolves macros in the given String to the String-list
|
||||||
*
|
|
||||||
* @param string
|
|
||||||
* @param substitutor
|
|
||||||
* @return
|
|
||||||
* @throws CdtVariableException
|
* @throws CdtVariableException
|
||||||
*/
|
*/
|
||||||
static public String[] resolveToStringList(String string, IVariableSubstitutor substitutor)
|
static public String[] resolveToStringList(String string, IVariableSubstitutor substitutor)
|
||||||
|
@ -220,9 +212,6 @@ public class CdtVariableResolver {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns true if the given macro is a String-list macro.
|
* returns true if the given macro is a String-list macro.
|
||||||
*
|
|
||||||
* @param macroType
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static boolean isStringListVariable(int macroType){
|
public static boolean isStringListVariable(int macroType){
|
||||||
switch(macroType){
|
switch(macroType){
|
||||||
|
@ -238,10 +227,6 @@ public class CdtVariableResolver {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks the macros integrity for the given context
|
* checks the macros integrity for the given context
|
||||||
*
|
|
||||||
* @param provider
|
|
||||||
* @param contextType
|
|
||||||
* @param contextData
|
|
||||||
* @throws CdtVariableException
|
* @throws CdtVariableException
|
||||||
*/
|
*/
|
||||||
public static void checkIntegrity(
|
public static void checkIntegrity(
|
||||||
|
@ -251,8 +236,7 @@ public class CdtVariableResolver {
|
||||||
if(info != null){
|
if(info != null){
|
||||||
ICdtVariable macros[] = SupplierBasedCdtVariableManager.getVariables(info,true);
|
ICdtVariable macros[] = SupplierBasedCdtVariableManager.getVariables(info,true);
|
||||||
if(macros != null){
|
if(macros != null){
|
||||||
for(int i = 0; i < macros.length; i++){
|
for (ICdtVariable macro : macros) {
|
||||||
ICdtVariable macro = macros[i];
|
|
||||||
if(isStringListVariable(macro.getValueType()))
|
if(isStringListVariable(macro.getValueType()))
|
||||||
substitutor.resolveToStringList(macro.getName());
|
substitutor.resolveToStringList(macro.getName());
|
||||||
else
|
else
|
||||||
|
|
|
@ -24,13 +24,13 @@ import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
|
||||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariableStatus;
|
import org.eclipse.cdt.core.cdtvariables.ICdtVariableStatus;
|
||||||
|
|
||||||
public class SupplierBasedCdtVariableSubstitutor implements IVariableSubstitutor {
|
public class SupplierBasedCdtVariableSubstitutor implements IVariableSubstitutor {
|
||||||
private static final Object UNDEFINED_MACRO_VALUE = new Object();
|
// private static final Object UNDEFINED_MACRO_VALUE = new Object();
|
||||||
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||||
private IVariableContextInfo fContextInfo;
|
private IVariableContextInfo fContextInfo;
|
||||||
private String fInexistentMacroValue;
|
private String fInexistentMacroValue;
|
||||||
private String fListDelimiter;
|
private String fListDelimiter;
|
||||||
private String fIncorrectlyReferencedMacroValue;
|
private String fIncorrectlyReferencedMacroValue;
|
||||||
private Map fDelimiterMap;
|
private Map<?, ?> fDelimiterMap;
|
||||||
|
|
||||||
protected class ResolvedMacro extends CdtVariable{
|
protected class ResolvedMacro extends CdtVariable{
|
||||||
private boolean fIsDefined;
|
private boolean fIsDefined;
|
||||||
|
@ -99,9 +99,8 @@ public class SupplierBasedCdtVariableSubstitutor implements IVariableSubstitutor
|
||||||
protected String stringListToString(String values[]) throws CdtVariableException {
|
protected String stringListToString(String values[]) throws CdtVariableException {
|
||||||
String result = null;
|
String result = null;
|
||||||
String delimiter;
|
String delimiter;
|
||||||
if(values == null)
|
if (values != null) {
|
||||||
result = null;
|
if(values.length == 0)
|
||||||
else if(values.length == 0)
|
|
||||||
result = EMPTY_STRING;
|
result = EMPTY_STRING;
|
||||||
else if(values.length == 1)
|
else if(values.length == 1)
|
||||||
result = values[0];
|
result = values[0];
|
||||||
|
@ -121,9 +120,8 @@ public class SupplierBasedCdtVariableSubstitutor implements IVariableSubstitutor
|
||||||
fContextInfo);
|
fContextInfo);
|
||||||
throw new CdtVariableException(eStatus);
|
throw new CdtVariableException(eStatus);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isList(){
|
public boolean isList(){
|
||||||
|
@ -144,7 +142,7 @@ public class SupplierBasedCdtVariableSubstitutor implements IVariableSubstitutor
|
||||||
private ICdtVariable fMacro;
|
private ICdtVariable fMacro;
|
||||||
private boolean fInitialized;
|
private boolean fInitialized;
|
||||||
private int fSupplierNum;
|
private int fSupplierNum;
|
||||||
private int fEnvSupplierNum;
|
// private int fEnvSupplierNum;
|
||||||
|
|
||||||
public MacroDescriptor(String name, IVariableContextInfo info){
|
public MacroDescriptor(String name, IVariableContextInfo info){
|
||||||
fName = name;
|
fName = name;
|
||||||
|
@ -203,15 +201,15 @@ public class SupplierBasedCdtVariableSubstitutor implements IVariableSubstitutor
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map fResolvedMacros = new HashMap();
|
private Map<String, ResolvedMacro> fResolvedMacros = new HashMap<String, ResolvedMacro>();
|
||||||
private HashSet fMacrosUnderResolution = new HashSet();
|
private HashSet<String> fMacrosUnderResolution = new HashSet<String>();
|
||||||
private Stack fMacroDescriptors = new Stack();
|
private Stack<MacroDescriptor> fMacroDescriptors = new Stack<MacroDescriptor>();
|
||||||
|
|
||||||
public SupplierBasedCdtVariableSubstitutor(IVariableContextInfo contextInfo, String inexistentMacroValue, String listDelimiter){
|
public SupplierBasedCdtVariableSubstitutor(IVariableContextInfo contextInfo, String inexistentMacroValue, String listDelimiter){
|
||||||
this(contextInfo, inexistentMacroValue, listDelimiter, null ,inexistentMacroValue);
|
this(contextInfo, inexistentMacroValue, listDelimiter, null ,inexistentMacroValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SupplierBasedCdtVariableSubstitutor(IVariableContextInfo contextInfo, String inexistentMacroValue, String listDelimiter, Map delimiterMap, String incorrectlyReferencedMacroValue){
|
public SupplierBasedCdtVariableSubstitutor(IVariableContextInfo contextInfo, String inexistentMacroValue, String listDelimiter, Map<?, ?> delimiterMap, String incorrectlyReferencedMacroValue){
|
||||||
fContextInfo = contextInfo;
|
fContextInfo = contextInfo;
|
||||||
fInexistentMacroValue = inexistentMacroValue;
|
fInexistentMacroValue = inexistentMacroValue;
|
||||||
fListDelimiter = listDelimiter;
|
fListDelimiter = listDelimiter;
|
||||||
|
@ -344,11 +342,11 @@ public class SupplierBasedCdtVariableSubstitutor implements IVariableSubstitutor
|
||||||
if(resolvedValues.length == 1)
|
if(resolvedValues.length == 1)
|
||||||
result = resolvedValues[0];
|
result = resolvedValues[0];
|
||||||
else{
|
else{
|
||||||
List list = new ArrayList();
|
List<String> list = new ArrayList<String>();
|
||||||
for(int i = 0; i < resolvedValues.length; i++)
|
for (String[] resolvedValue : resolvedValues)
|
||||||
list.addAll(Arrays.asList(resolvedValues[i]));
|
list.addAll(Arrays.asList(resolvedValue));
|
||||||
|
|
||||||
result = (String[])list.toArray(new String[list.size()]);
|
result = list.toArray(new String[list.size()]);
|
||||||
}
|
}
|
||||||
resolvedMacro = new ResolvedMacro(macroName,result);
|
resolvedMacro = new ResolvedMacro(macroName,result);
|
||||||
}
|
}
|
||||||
|
@ -377,7 +375,7 @@ public class SupplierBasedCdtVariableSubstitutor implements IVariableSubstitutor
|
||||||
private ResolvedMacro checkResolvingMacro(MacroDescriptor des)
|
private ResolvedMacro checkResolvingMacro(MacroDescriptor des)
|
||||||
throws CdtVariableException{
|
throws CdtVariableException{
|
||||||
String name = des.fName;
|
String name = des.fName;
|
||||||
ResolvedMacro value = (ResolvedMacro)fResolvedMacros.get(name);
|
ResolvedMacro value = fResolvedMacros.get(name);
|
||||||
if(value == null){
|
if(value == null){
|
||||||
if(fMacrosUnderResolution.add(name)) {
|
if(fMacrosUnderResolution.add(name)) {
|
||||||
fMacroDescriptors.push(des);
|
fMacroDescriptors.push(des);
|
||||||
|
@ -393,7 +391,7 @@ public class SupplierBasedCdtVariableSubstitutor implements IVariableSubstitutor
|
||||||
// ${macro1} = "...${macro1}..."
|
// ${macro1} = "...${macro1}..."
|
||||||
// In the above example the ${macro1} reference will be expanded to the value of the ${macro1} macro of the
|
// In the above example the ${macro1} reference will be expanded to the value of the ${macro1} macro of the
|
||||||
// parent context or to an empty string if there is no such macro defined in the parent contexts
|
// parent context or to an empty string if there is no such macro defined in the parent contexts
|
||||||
MacroDescriptor last = (MacroDescriptor)fMacroDescriptors.lastElement();
|
MacroDescriptor last = fMacroDescriptors.lastElement();
|
||||||
if(last != null && last.fName.equals(name)) {
|
if(last != null && last.fName.equals(name)) {
|
||||||
value = resolveParentMacro(last);
|
value = resolveParentMacro(last);
|
||||||
if(value == null)
|
if(value == null)
|
||||||
|
@ -422,7 +420,7 @@ public class SupplierBasedCdtVariableSubstitutor implements IVariableSubstitutor
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ResolvedMacro removeResolvedMacro(String name){
|
protected ResolvedMacro removeResolvedMacro(String name){
|
||||||
return (ResolvedMacro)fResolvedMacros.remove(name);
|
return fResolvedMacros.remove(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -439,11 +437,11 @@ public class SupplierBasedCdtVariableSubstitutor implements IVariableSubstitutor
|
||||||
fResolvedMacros.clear();
|
fResolvedMacros.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getDelimiterMap() {
|
public Map<?, ?> getDelimiterMap() {
|
||||||
return fDelimiterMap;
|
return fDelimiterMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDelimiterMap(Map delimiterMap) throws CdtVariableException {
|
public void setDelimiterMap(Map<?, ?> delimiterMap) throws CdtVariableException {
|
||||||
if(checkEqual(fDelimiterMap,delimiterMap))
|
if(checkEqual(fDelimiterMap,delimiterMap))
|
||||||
return;
|
return;
|
||||||
reset();
|
reset();
|
||||||
|
|
|
@ -65,10 +65,10 @@ public class PEArchive {
|
||||||
public class ARHeader {
|
public class ARHeader {
|
||||||
|
|
||||||
private String object_name;
|
private String object_name;
|
||||||
private String modification_time;
|
// private String modification_time;
|
||||||
private String uid;
|
// private String uid;
|
||||||
private String gid;
|
// private String gid;
|
||||||
private String mode;
|
// private String mode;
|
||||||
private long size;
|
private long size;
|
||||||
private long elf_offset;
|
private long elf_offset;
|
||||||
|
|
||||||
|
@ -147,10 +147,10 @@ public class PEArchive {
|
||||||
// Convert the raw bytes into strings and numbers.
|
// Convert the raw bytes into strings and numbers.
|
||||||
//
|
//
|
||||||
this.object_name = removeBlanks(new String(object_name));
|
this.object_name = removeBlanks(new String(object_name));
|
||||||
this.modification_time = new String(modification_time);
|
// this.modification_time = new String(modification_time);
|
||||||
this.uid = new String(uid);
|
// this.uid = new String(uid);
|
||||||
this.gid = new String(gid);
|
// this.gid = new String(gid);
|
||||||
this.mode = new String(mode);
|
// this.mode = new String(mode);
|
||||||
this.size = Long.parseLong(removeBlanks(new String(size)));
|
this.size = Long.parseLong(removeBlanks(new String(size)));
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -246,7 +246,7 @@ public class PEArchive {
|
||||||
if (headers != null)
|
if (headers != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Vector v = new Vector();
|
Vector<ARHeader> v = new Vector<ARHeader>();
|
||||||
try {
|
try {
|
||||||
//
|
//
|
||||||
// Check for EOF condition
|
// Check for EOF condition
|
||||||
|
@ -280,7 +280,7 @@ public class PEArchive {
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
headers = (ARHeader[]) v.toArray(new ARHeader[0]);
|
headers = v.toArray(new ARHeader[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -297,30 +297,30 @@ public class PEArchive {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean stringInStrings(String str, String[] set) {
|
private boolean stringInStrings(String str, String[] set) {
|
||||||
for (int i = 0; i < set.length; i++)
|
for (String element : set)
|
||||||
if (str.compareTo(set[i]) == 0)
|
if (str.compareTo(element) == 0)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] extractFiles(String outdir, String[] names)
|
public String[] extractFiles(String outdir, String[] names)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Vector names_used = new Vector();
|
Vector<String> names_used = new Vector<String>();
|
||||||
String object_name;
|
String object_name;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
loadHeaders();
|
loadHeaders();
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for (int i = 0; i < headers.length; i++) {
|
for (ARHeader header : headers) {
|
||||||
object_name = headers[i].getObjectName();
|
object_name = header.getObjectName();
|
||||||
if (names != null && !stringInStrings(object_name, names))
|
if (names != null && !stringInStrings(object_name, names))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
object_name = "" + count + "_" + object_name; //$NON-NLS-1$ //$NON-NLS-2$
|
object_name = "" + count + "_" + object_name; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
byte[] data = headers[i].getObjectData();
|
byte[] data = header.getObjectData();
|
||||||
File output = new File(outdir, object_name);
|
File output = new File(outdir, object_name);
|
||||||
names_used.add(object_name);
|
names_used.add(object_name);
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ public class PEArchive {
|
||||||
rfile.close();
|
rfile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (String[]) names_used.toArray(new String[0]);
|
return names_used.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] extractFiles(String outdir) throws IOException {
|
public String[] extractFiles(String outdir) throws IOException {
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.cdt.utils.debug.IDebugEntryRequestor;
|
||||||
import org.eclipse.cdt.utils.debug.tools.DebugSym;
|
import org.eclipse.cdt.utils.debug.tools.DebugSym;
|
||||||
import org.eclipse.cdt.utils.debug.tools.DebugSymsRequestor;
|
import org.eclipse.cdt.utils.debug.tools.DebugSymsRequestor;
|
||||||
import org.eclipse.cdt.utils.elf.Elf;
|
import org.eclipse.cdt.utils.elf.Elf;
|
||||||
|
import org.eclipse.cdt.utils.elf.Elf.Section;
|
||||||
|
|
||||||
public class Dwarf {
|
public class Dwarf {
|
||||||
|
|
||||||
|
@ -83,12 +84,12 @@ public class Dwarf {
|
||||||
/* unsigned */
|
/* unsigned */
|
||||||
long tag;
|
long tag;
|
||||||
byte hasChildren;
|
byte hasChildren;
|
||||||
List attributes;
|
List<Attribute> attributes;
|
||||||
AbbreviationEntry(long c, long t, byte h) {
|
AbbreviationEntry(long c, long t, byte h) {
|
||||||
code = c;
|
code = c;
|
||||||
tag = t;
|
tag = t;
|
||||||
hasChildren = h;
|
hasChildren = h;
|
||||||
attributes = new ArrayList();
|
attributes = new ArrayList<Attribute>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +123,7 @@ public class Dwarf {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append(attribute.toString()).append(' ');
|
sb.append(attribute.toString()).append(' ');
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
Class clazz = value.getClass();
|
Class<? extends Object> clazz = value.getClass();
|
||||||
if (clazz.isArray()) {
|
if (clazz.isArray()) {
|
||||||
int len = Array.getLength(value);
|
int len = Array.getLength(value);
|
||||||
sb.append(len).append(' ');
|
sb.append(len).append(' ');
|
||||||
|
@ -159,8 +160,8 @@ public class Dwarf {
|
||||||
int identifierCase;
|
int identifierCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map dwarfSections = new HashMap();
|
Map<String, byte[]> dwarfSections = new HashMap<String, byte[]>();
|
||||||
Map abbreviationMaps = new HashMap();
|
Map<Integer, Map<Long, AbbreviationEntry>> abbreviationMaps = new HashMap<Integer, Map<Long, AbbreviationEntry>>();
|
||||||
|
|
||||||
boolean isLE;
|
boolean isLE;
|
||||||
|
|
||||||
|
@ -183,11 +184,11 @@ public class Dwarf {
|
||||||
isLE = header.e_ident[Elf.ELFhdr.EI_DATA] == Elf.ELFhdr.ELFDATA2LSB;
|
isLE = header.e_ident[Elf.ELFhdr.EI_DATA] == Elf.ELFhdr.ELFDATA2LSB;
|
||||||
|
|
||||||
Elf.Section[] sections = exe.getSections();
|
Elf.Section[] sections = exe.getSections();
|
||||||
for (int i = 0; i < sections.length; i++) {
|
for (Section section : sections) {
|
||||||
String name = sections[i].toString();
|
String name = section.toString();
|
||||||
for (int j = 0; j < DWARF_SCNNAMES.length; j++) {
|
for (String element : DWARF_SCNNAMES) {
|
||||||
if (name.equals(DWARF_SCNNAMES[j])) {
|
if (name.equals(element)) {
|
||||||
dwarfSections.put(DWARF_SCNNAMES[j], sections[i].loadSectionData());
|
dwarfSections.put(element, section.loadSectionData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -334,7 +335,7 @@ public class Dwarf {
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseDebugInfo(IDebugEntryRequestor requestor) {
|
void parseDebugInfo(IDebugEntryRequestor requestor) {
|
||||||
byte[] data = (byte[]) dwarfSections.get(DWARF_DEBUG_INFO);
|
byte[] data = dwarfSections.get(DWARF_DEBUG_INFO);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
try {
|
try {
|
||||||
int length = 0;
|
int length = 0;
|
||||||
|
@ -353,7 +354,7 @@ public class Dwarf {
|
||||||
// read the abbrev section.
|
// read the abbrev section.
|
||||||
// Note "length+4" is the total size in bytes of the CU data.
|
// Note "length+4" is the total size in bytes of the CU data.
|
||||||
InputStream in = new ByteArrayInputStream(data, offset + 11, length+4-11);
|
InputStream in = new ByteArrayInputStream(data, offset + 11, length+4-11);
|
||||||
Map abbrevs = parseDebugAbbreviation(header);
|
Map<Long, AbbreviationEntry> abbrevs = parseDebugAbbreviation(header);
|
||||||
parseDebugInfoEntry(requestor, in, abbrevs, header);
|
parseDebugInfoEntry(requestor, in, abbrevs, header);
|
||||||
|
|
||||||
if (printEnabled)
|
if (printEnabled)
|
||||||
|
@ -365,14 +366,14 @@ public class Dwarf {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map parseDebugAbbreviation(CompilationUnitHeader header) throws IOException {
|
Map<Long, AbbreviationEntry> parseDebugAbbreviation(CompilationUnitHeader header) throws IOException {
|
||||||
int offset = header.abbreviationOffset;
|
int offset = header.abbreviationOffset;
|
||||||
Integer key = new Integer(offset);
|
Integer key = new Integer(offset);
|
||||||
Map abbrevs = (Map) abbreviationMaps.get(key);
|
Map<Long, AbbreviationEntry> abbrevs = abbreviationMaps.get(key);
|
||||||
if (abbrevs == null) {
|
if (abbrevs == null) {
|
||||||
abbrevs = new HashMap();
|
abbrevs = new HashMap<Long, AbbreviationEntry>();
|
||||||
abbreviationMaps.put(key, abbrevs);
|
abbreviationMaps.put(key, abbrevs);
|
||||||
byte[] data = (byte[]) dwarfSections.get(DWARF_DEBUG_ABBREV);
|
byte[] data = dwarfSections.get(DWARF_DEBUG_ABBREV);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
InputStream in = new ByteArrayInputStream(data);
|
InputStream in = new ByteArrayInputStream(data);
|
||||||
in.skip(offset);
|
in.skip(offset);
|
||||||
|
@ -405,17 +406,17 @@ public class Dwarf {
|
||||||
return abbrevs;
|
return abbrevs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseDebugInfoEntry(IDebugEntryRequestor requestor, InputStream in, Map abbrevs, CompilationUnitHeader header)
|
void parseDebugInfoEntry(IDebugEntryRequestor requestor, InputStream in, Map<Long, AbbreviationEntry> abbrevs, CompilationUnitHeader header)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
while (in.available() > 0) {
|
while (in.available() > 0) {
|
||||||
long code = read_unsigned_leb128(in);
|
long code = read_unsigned_leb128(in);
|
||||||
AbbreviationEntry entry = (AbbreviationEntry) abbrevs.get(new Long(code));
|
AbbreviationEntry entry = abbrevs.get(new Long(code));
|
||||||
if (entry != null) {
|
if (entry != null) {
|
||||||
int len = entry.attributes.size();
|
int len = entry.attributes.size();
|
||||||
List list = new ArrayList(len);
|
List<AttributeValue> list = new ArrayList<AttributeValue>(len);
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
Attribute attr = (Attribute) entry.attributes.get(i);
|
Attribute attr = entry.attributes.get(i);
|
||||||
Object obj = readAttribute((int) attr.form, in, header);
|
Object obj = readAttribute((int) attr.form, in, header);
|
||||||
list.add(new AttributeValue(attr, obj));
|
list.add(new AttributeValue(attr, obj));
|
||||||
}
|
}
|
||||||
|
@ -516,7 +517,7 @@ public class Dwarf {
|
||||||
case DwarfConstants.DW_FORM_strp :
|
case DwarfConstants.DW_FORM_strp :
|
||||||
{
|
{
|
||||||
int offset = read_4_bytes(in);
|
int offset = read_4_bytes(in);
|
||||||
byte[] data = (byte[]) dwarfSections.get(DWARF_DEBUG_STR);
|
byte[] data = dwarfSections.get(DWARF_DEBUG_STR);
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
obj = new String();
|
obj = new String();
|
||||||
} else if (offset < 0 || offset > data.length) {
|
} else if (offset < 0 || offset > data.length) {
|
||||||
|
@ -568,14 +569,14 @@ public class Dwarf {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
void processDebugInfoEntry(IDebugEntryRequestor requestor, AbbreviationEntry entry, List list) {
|
void processDebugInfoEntry(IDebugEntryRequestor requestor, AbbreviationEntry entry, List<AttributeValue> list) {
|
||||||
int len = list.size();
|
int len = list.size();
|
||||||
int tag = (int) entry.tag;
|
int tag = (int) entry.tag;
|
||||||
if (printEnabled)
|
if (printEnabled)
|
||||||
System.out.println("Abbrev Number " + entry.code); //$NON-NLS-1$
|
System.out.println("Abbrev Number " + entry.code); //$NON-NLS-1$
|
||||||
|
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
AttributeValue av = (AttributeValue) list.get(i);
|
AttributeValue av = list.get(i);
|
||||||
if (printEnabled)
|
if (printEnabled)
|
||||||
System.out.println(av);
|
System.out.println(av);
|
||||||
// We are only interrested in certain tags.
|
// We are only interrested in certain tags.
|
||||||
|
@ -665,14 +666,14 @@ public class Dwarf {
|
||||||
return new Long(value);
|
return new Long(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void processSubProgram(IDebugEntryRequestor requestor, List list) {
|
void processSubProgram(IDebugEntryRequestor requestor, List<AttributeValue> list) {
|
||||||
long lowPC = 0;
|
long lowPC = 0;
|
||||||
long highPC = 0;
|
long highPC = 0;
|
||||||
String funcName = ""; //$NON-NLS-1$
|
String funcName = ""; //$NON-NLS-1$
|
||||||
boolean isExtern = false;
|
boolean isExtern = false;
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
AttributeValue av = (AttributeValue)list.get(i);
|
AttributeValue av = list.get(i);
|
||||||
try {
|
try {
|
||||||
int name = (int)av.attribute.name;
|
int name = (int)av.attribute.name;
|
||||||
switch(name) {
|
switch(name) {
|
||||||
|
@ -699,13 +700,13 @@ public class Dwarf {
|
||||||
requestor.exitFunction(highPC);
|
requestor.exitFunction(highPC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void processCompileUnit(IDebugEntryRequestor requestor, List list) {
|
void processCompileUnit(IDebugEntryRequestor requestor, List<AttributeValue> list) {
|
||||||
if (currentCU != null) {
|
if (currentCU != null) {
|
||||||
requestor.exitCompilationUnit(currentCU.highPC);
|
requestor.exitCompilationUnit(currentCU.highPC);
|
||||||
}
|
}
|
||||||
currentCU = new CompileUnit();
|
currentCU = new CompileUnit();
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
AttributeValue av = (AttributeValue)list.get(i);
|
AttributeValue av = list.get(i);
|
||||||
try {
|
try {
|
||||||
int name = (int)av.attribute.name;
|
int name = (int)av.attribute.name;
|
||||||
switch(name) {
|
switch(name) {
|
||||||
|
@ -755,8 +756,7 @@ public class Dwarf {
|
||||||
Dwarf dwarf = new Dwarf(args[0]);
|
Dwarf dwarf = new Dwarf(args[0]);
|
||||||
dwarf.parse(symreq);
|
dwarf.parse(symreq);
|
||||||
DebugSym[] entries = symreq.getEntries();
|
DebugSym[] entries = symreq.getEntries();
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (DebugSym entry : entries) {
|
||||||
DebugSym entry = entries[i];
|
|
||||||
System.out.println(entry);
|
System.out.println(entry);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
||||||
import org.eclipse.cdt.core.ISymbolReader;
|
import org.eclipse.cdt.core.ISymbolReader;
|
||||||
import org.eclipse.cdt.utils.debug.IDebugEntryRequestor;
|
import org.eclipse.cdt.utils.debug.IDebugEntryRequestor;
|
||||||
import org.eclipse.cdt.utils.elf.Elf;
|
import org.eclipse.cdt.utils.elf.Elf;
|
||||||
|
import org.eclipse.cdt.utils.elf.Elf.Section;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
|
@ -39,13 +40,13 @@ public class DwarfReader extends Dwarf implements ISymbolReader {
|
||||||
DWARF_DEBUG_STR // this is optional. Some compilers don't generate it.
|
DWARF_DEBUG_STR // this is optional. Some compilers don't generate it.
|
||||||
};
|
};
|
||||||
|
|
||||||
private Collection m_fileCollection = new ArrayList();
|
private Collection<String> m_fileCollection = new ArrayList<String>();
|
||||||
private String[] m_fileNames = null;
|
private String[] m_fileNames = null;
|
||||||
private String m_exeFileWin32Drive; // Win32 drive of the exe file.
|
private String m_exeFileWin32Drive; // Win32 drive of the exe file.
|
||||||
private boolean m_onWindows;
|
private boolean m_onWindows;
|
||||||
private boolean m_parsed = false;
|
private boolean m_parsed = false;
|
||||||
private int m_leb128Size = 0;
|
private int m_leb128Size = 0;
|
||||||
private ArrayList m_parsedLineTableOffsets = new ArrayList();
|
private ArrayList<Integer> m_parsedLineTableOffsets = new ArrayList<Integer>();
|
||||||
private int m_parsedLineTableSize = 0;
|
private int m_parsedLineTableSize = 0;
|
||||||
|
|
||||||
public DwarfReader(String file) throws IOException {
|
public DwarfReader(String file) throws IOException {
|
||||||
|
@ -67,11 +68,11 @@ public class DwarfReader extends Dwarf implements ISymbolReader {
|
||||||
|
|
||||||
// Read in sections (and only the sections) we care about.
|
// Read in sections (and only the sections) we care about.
|
||||||
//
|
//
|
||||||
for (int i = 0; i < sections.length; i++) {
|
for (Section section : sections) {
|
||||||
String name = sections[i].toString();
|
String name = section.toString();
|
||||||
for (int j = 0; j < DWARF_SectionsToParse.length; j++) {
|
for (String element : DWARF_SectionsToParse) {
|
||||||
if (name.equals(DWARF_SectionsToParse[j])) {
|
if (name.equals(element)) {
|
||||||
dwarfSections.put(DWARF_SectionsToParse[j], sections[i].loadSectionData());
|
dwarfSections.put(element, section.loadSectionData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +96,7 @@ public class DwarfReader extends Dwarf implements ISymbolReader {
|
||||||
String cuCompDir, // compilation directory of the CU
|
String cuCompDir, // compilation directory of the CU
|
||||||
int cuStmtList) // offset of the CU line table in .debug_line section
|
int cuStmtList) // offset of the CU line table in .debug_line section
|
||||||
{
|
{
|
||||||
byte[] data = (byte[]) dwarfSections.get(DWARF_DEBUG_LINE);
|
byte[] data = dwarfSections.get(DWARF_DEBUG_LINE);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
try {
|
try {
|
||||||
int offset = cuStmtList;
|
int offset = cuStmtList;
|
||||||
|
@ -134,7 +135,7 @@ public class DwarfReader extends Dwarf implements ISymbolReader {
|
||||||
|
|
||||||
// Read in directories.
|
// Read in directories.
|
||||||
//
|
//
|
||||||
ArrayList dirList = new ArrayList();
|
ArrayList<String> dirList = new ArrayList<String>();
|
||||||
|
|
||||||
// Put the compilation directory of the CU as the first dir
|
// Put the compilation directory of the CU as the first dir
|
||||||
dirList.add(cuCompDir);
|
dirList.add(cuCompDir);
|
||||||
|
@ -163,7 +164,7 @@ public class DwarfReader extends Dwarf implements ISymbolReader {
|
||||||
leb128 = read_unsigned_leb128(data, offset);
|
leb128 = read_unsigned_leb128(data, offset);
|
||||||
offset += m_leb128Size;
|
offset += m_leb128Size;
|
||||||
|
|
||||||
addSourceFile((String)dirList.get((int)leb128), fileName);
|
addSourceFile(dirList.get((int)leb128), fileName);
|
||||||
|
|
||||||
// Skip the followings
|
// Skip the followings
|
||||||
//
|
//
|
||||||
|
@ -191,7 +192,7 @@ public class DwarfReader extends Dwarf implements ISymbolReader {
|
||||||
*/
|
*/
|
||||||
private void getSourceFilesFromDebugLineSection()
|
private void getSourceFilesFromDebugLineSection()
|
||||||
{
|
{
|
||||||
byte[] data = (byte[]) dwarfSections.get(DWARF_DEBUG_LINE);
|
byte[] data = dwarfSections.get(DWARF_DEBUG_LINE);
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -272,12 +273,12 @@ public class DwarfReader extends Dwarf implements ISymbolReader {
|
||||||
|
|
||||||
// Read in directories.
|
// Read in directories.
|
||||||
//
|
//
|
||||||
ArrayList dirList = new ArrayList();
|
ArrayList<String> dirList = new ArrayList<String>();
|
||||||
|
|
||||||
String str, fileName;
|
String str, fileName;
|
||||||
|
|
||||||
// first dir should be TAG_comp_dir from CU, which we don't have here.
|
// first dir should be TAG_comp_dir from CU, which we don't have here.
|
||||||
dirList.add("");
|
dirList.add(""); //$NON-NLS-1$
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
str = readString(data, offset);
|
str = readString(data, offset);
|
||||||
|
@ -301,7 +302,7 @@ public class DwarfReader extends Dwarf implements ISymbolReader {
|
||||||
leb128 = read_unsigned_leb128(data, offset);
|
leb128 = read_unsigned_leb128(data, offset);
|
||||||
offset += m_leb128Size;
|
offset += m_leb128Size;
|
||||||
|
|
||||||
addSourceFile((String) dirList.get((int) leb128), fileName);
|
addSourceFile(dirList.get((int) leb128), fileName);
|
||||||
|
|
||||||
// Skip the followings
|
// Skip the followings
|
||||||
//
|
//
|
||||||
|
@ -422,7 +423,7 @@ public class DwarfReader extends Dwarf implements ISymbolReader {
|
||||||
|
|
||||||
m_leb128Size = 0;
|
m_leb128Size = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
b = (short) data[offset++];
|
b = data[offset++];
|
||||||
if (data.length == offset)
|
if (data.length == offset)
|
||||||
break; //throw new IOException("no more data");
|
break; //throw new IOException("no more data");
|
||||||
m_leb128Size++;
|
m_leb128Size++;
|
||||||
|
@ -438,7 +439,7 @@ public class DwarfReader extends Dwarf implements ISymbolReader {
|
||||||
|
|
||||||
// Override parent: only handle TAG_Compile_Unit.
|
// Override parent: only handle TAG_Compile_Unit.
|
||||||
@Override
|
@Override
|
||||||
void processDebugInfoEntry(IDebugEntryRequestor requestor, AbbreviationEntry entry, List list) {
|
void processDebugInfoEntry(IDebugEntryRequestor requestor, AbbreviationEntry entry, List<Dwarf.AttributeValue> list) {
|
||||||
int tag = (int) entry.tag;
|
int tag = (int) entry.tag;
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case DwarfConstants.DW_TAG_compile_unit :
|
case DwarfConstants.DW_TAG_compile_unit :
|
||||||
|
@ -453,15 +454,15 @@ public class DwarfReader extends Dwarf implements ISymbolReader {
|
||||||
// Just get the file name of the CU.
|
// Just get the file name of the CU.
|
||||||
// Argument "requestor" is ignored.
|
// Argument "requestor" is ignored.
|
||||||
@Override
|
@Override
|
||||||
void processCompileUnit(IDebugEntryRequestor requestor, List list) {
|
void processCompileUnit(IDebugEntryRequestor requestor, List<AttributeValue> list) {
|
||||||
|
|
||||||
String cuName, cuCompDir;
|
String cuName, cuCompDir;
|
||||||
int stmtList = -1;
|
int stmtList = -1;
|
||||||
|
|
||||||
cuName = cuCompDir = "";
|
cuName = cuCompDir = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
AttributeValue av = (AttributeValue)list.get(i);
|
AttributeValue av = list.get(i);
|
||||||
try {
|
try {
|
||||||
int name = (int)av.attribute.name;
|
int name = (int)av.attribute.name;
|
||||||
switch(name) {
|
switch(name) {
|
||||||
|
|
|
@ -18,6 +18,9 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.utils.coff.PE;
|
||||||
|
import org.eclipse.cdt.utils.coff.Coff.SectionHeader;
|
||||||
|
import org.eclipse.cdt.utils.coff.PE.Attribute;
|
||||||
import org.eclipse.cdt.utils.debug.DebugArrayType;
|
import org.eclipse.cdt.utils.debug.DebugArrayType;
|
||||||
import org.eclipse.cdt.utils.debug.DebugBaseType;
|
import org.eclipse.cdt.utils.debug.DebugBaseType;
|
||||||
import org.eclipse.cdt.utils.debug.DebugCrossRefType;
|
import org.eclipse.cdt.utils.debug.DebugCrossRefType;
|
||||||
|
@ -36,9 +39,7 @@ import org.eclipse.cdt.utils.debug.IDebugEntryRequestor;
|
||||||
import org.eclipse.cdt.utils.debug.tools.DebugSym;
|
import org.eclipse.cdt.utils.debug.tools.DebugSym;
|
||||||
import org.eclipse.cdt.utils.debug.tools.DebugSymsRequestor;
|
import org.eclipse.cdt.utils.debug.tools.DebugSymsRequestor;
|
||||||
import org.eclipse.cdt.utils.elf.Elf;
|
import org.eclipse.cdt.utils.elf.Elf;
|
||||||
import org.eclipse.cdt.utils.coff.PE;
|
import org.eclipse.cdt.utils.elf.Elf.Section;
|
||||||
import org.eclipse.cdt.utils.coff.Coff.SectionHeader;
|
|
||||||
import org.eclipse.cdt.utils.coff.PE.Attribute;
|
|
||||||
|
|
||||||
public class Stabs {
|
public class Stabs {
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ public class Stabs {
|
||||||
int bracket;
|
int bracket;
|
||||||
String currentFile;
|
String currentFile;
|
||||||
|
|
||||||
Map mapTypes = new HashMap();
|
Map<TypeNumber, DebugType> mapTypes = new HashMap<TypeNumber, DebugType>();
|
||||||
DebugType voidType = new DebugBaseType("void", 0, false); //$NON-NLS-1$
|
DebugType voidType = new DebugBaseType("void", 0, false); //$NON-NLS-1$
|
||||||
|
|
||||||
public Stabs(String file) throws IOException {
|
public Stabs(String file) throws IOException {
|
||||||
|
@ -87,12 +88,12 @@ public class Stabs {
|
||||||
byte[] data = null;
|
byte[] data = null;
|
||||||
byte[] stabstr = null;
|
byte[] stabstr = null;
|
||||||
Elf.Section[] sections = exe.getSections();
|
Elf.Section[] sections = exe.getSections();
|
||||||
for (int i = 0; i < sections.length; i++) {
|
for (Section section : sections) {
|
||||||
String name = sections[i].toString();
|
String name = section.toString();
|
||||||
if (name.equals(".stab")) { //$NON-NLS-1$
|
if (name.equals(".stab")) { //$NON-NLS-1$
|
||||||
data = sections[i].loadSectionData();
|
data = section.loadSectionData();
|
||||||
} else if (name.equals(".stabstr")) { //$NON-NLS-1$
|
} else if (name.equals(".stabstr")) { //$NON-NLS-1$
|
||||||
stabstr = sections[i].loadSectionData();
|
stabstr = section.loadSectionData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Elf.ELFhdr header = exe.getELFhdr();
|
Elf.ELFhdr header = exe.getELFhdr();
|
||||||
|
@ -107,12 +108,12 @@ public class Stabs {
|
||||||
byte[] stabstr = null;
|
byte[] stabstr = null;
|
||||||
|
|
||||||
SectionHeader[] sections = exe.getSectionHeaders();
|
SectionHeader[] sections = exe.getSectionHeaders();
|
||||||
for (int i = 0; i < sections.length; i++) {
|
for (SectionHeader section : sections) {
|
||||||
String name = new String(sections[i].s_name).trim();
|
String name = new String(section.s_name).trim();
|
||||||
if (name.equals(".stab")) { //$NON-NLS-1$
|
if (name.equals(".stab")) { //$NON-NLS-1$
|
||||||
data = sections[i].getRawData();
|
data = section.getRawData();
|
||||||
} else if (name.equals(".stabstr")) { //$NON-NLS-1$
|
} else if (name.equals(".stabstr")) { //$NON-NLS-1$
|
||||||
stabstr = sections[i].getRawData();
|
stabstr = section.getRawData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,7 +489,7 @@ public class Stabs {
|
||||||
// According to the doc 't' can follow the 'T'. If so just
|
// According to the doc 't' can follow the 'T'. If so just
|
||||||
// strip the T and go again.
|
// strip the T and go again.
|
||||||
if (infoField.length() > 0 && infoField.charAt(0) == 't') {
|
if (infoField.length() > 0 && infoField.charAt(0) == 't') {
|
||||||
String s = field.replaceFirst(":T", ":");
|
String s = field.replaceFirst(":T", ":"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
parseStabString(requestor, s, value);
|
parseStabString(requestor, s, value);
|
||||||
} else {
|
} else {
|
||||||
// Just register the type.
|
// Just register the type.
|
||||||
|
@ -994,7 +995,7 @@ public class Stabs {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
DebugType parseStabEnumType(String name, Reader reader) throws IOException {
|
DebugType parseStabEnumType(String name, Reader reader) throws IOException {
|
||||||
List list = new ArrayList();
|
List<DebugEnumField> list = new ArrayList<DebugEnumField>();
|
||||||
String fieldName = null;
|
String fieldName = null;
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
int c;
|
int c;
|
||||||
|
@ -1190,10 +1191,6 @@ public class Stabs {
|
||||||
overflowUpperBound = true;
|
overflowUpperBound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeNumber == null) {
|
|
||||||
typeNumber = new TypeNumber(0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean self = typeNumber.equals(number);
|
boolean self = typeNumber.equals(number);
|
||||||
|
|
||||||
// Probably trying 64 bits range like "long long"
|
// Probably trying 64 bits range like "long long"
|
||||||
|
@ -1365,7 +1362,7 @@ public class Stabs {
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugType getDebugType(TypeNumber tn) {
|
DebugType getDebugType(TypeNumber tn) {
|
||||||
return (DebugType) mapTypes.get(tn);
|
return mapTypes.get(tn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -1374,8 +1371,7 @@ public class Stabs {
|
||||||
Stabs stabs = new Stabs(args[0]);
|
Stabs stabs = new Stabs(args[0]);
|
||||||
stabs.parse(symreq);
|
stabs.parse(symreq);
|
||||||
DebugSym[] entries = symreq.getEntries();
|
DebugSym[] entries = symreq.getEntries();
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (DebugSym entry : entries) {
|
||||||
DebugSym entry = entries[i];
|
|
||||||
System.out.println(entry);
|
System.out.println(entry);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
package org.eclipse.cdt.utils.debug.stabs;
|
package org.eclipse.cdt.utils.debug.stabs;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.ISymbolReader;
|
import org.eclipse.cdt.core.ISymbolReader;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public class StabsReader implements ISymbolReader {
|
||||||
byte[] stabData;
|
byte[] stabData;
|
||||||
byte[] stabstrData;
|
byte[] stabstrData;
|
||||||
boolean isLe;
|
boolean isLe;
|
||||||
List fileList;
|
List<String> fileList;
|
||||||
String[] files = null;
|
String[] files = null;
|
||||||
boolean parsed = false;
|
boolean parsed = false;
|
||||||
String currentFile;
|
String currentFile;
|
||||||
|
@ -31,7 +31,7 @@ public class StabsReader implements ISymbolReader {
|
||||||
stabstrData = stabstr;
|
stabstrData = stabstr;
|
||||||
isLe = littleEndian;
|
isLe = littleEndian;
|
||||||
|
|
||||||
fileList = new ArrayList();
|
fileList = new ArrayList<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getSourceFiles() {
|
public String[] getSourceFiles() {
|
||||||
|
@ -42,7 +42,7 @@ public class StabsReader implements ISymbolReader {
|
||||||
|
|
||||||
files = new String[fileList.size()];
|
files = new String[fileList.size()];
|
||||||
for (int i = 0; i < fileList.size(); i++) {
|
for (int i = 0; i < fileList.size(); i++) {
|
||||||
files[i] = (String)fileList.get(i);
|
files[i] = fileList.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,10 +83,10 @@ public class StabsReader implements ISymbolReader {
|
||||||
|
|
||||||
private String fixUpPath(String path) {
|
private String fixUpPath(String path) {
|
||||||
// some compilers generate extra back slashes
|
// some compilers generate extra back slashes
|
||||||
path = path.replaceAll("\\\\\\\\", "\\\\");
|
path = path.replaceAll("\\\\\\\\", "\\\\"); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
|
|
||||||
// translate any cygwin drive paths, e.g. //G/System/main.cpp or /cygdrive/c/system/main.c
|
// translate any cygwin drive paths, e.g. //G/System/main.cpp or /cygdrive/c/system/main.c
|
||||||
if (path.startsWith("/cygdrive/") && ('/' == path.charAt(11))) {
|
if (path.startsWith("/cygdrive/") && ('/' == path.charAt(11))) { //$NON-NLS-1$
|
||||||
char driveLetter = path.charAt(10);
|
char driveLetter = path.charAt(10);
|
||||||
driveLetter = (Character.isLowerCase(driveLetter)) ? Character.toUpperCase(driveLetter) : driveLetter;
|
driveLetter = (Character.isLowerCase(driveLetter)) ? Character.toUpperCase(driveLetter) : driveLetter;
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public class StabsReader implements ISymbolReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
// translate any cygwin drive paths, e.g. //G/System/main.cpp or /cygdrive/c/system/main.c
|
// translate any cygwin drive paths, e.g. //G/System/main.cpp or /cygdrive/c/system/main.c
|
||||||
if (path.startsWith("//") && ('/' == path.charAt(3))) {
|
if (path.startsWith("//") && ('/' == path.charAt(3))) { //$NON-NLS-1$
|
||||||
char driveLetter = path.charAt(2);
|
char driveLetter = path.charAt(2);
|
||||||
driveLetter = (Character.isLowerCase(driveLetter)) ? Character.toUpperCase(driveLetter) : driveLetter;
|
driveLetter = (Character.isLowerCase(driveLetter)) ? Character.toUpperCase(driveLetter) : driveLetter;
|
||||||
|
|
||||||
|
|
|
@ -63,10 +63,10 @@ public class AR {
|
||||||
public class ARHeader {
|
public class ARHeader {
|
||||||
|
|
||||||
private String object_name;
|
private String object_name;
|
||||||
private String modification_time;
|
// private String modification_time;
|
||||||
private String uid;
|
// private String uid;
|
||||||
private String gid;
|
// private String gid;
|
||||||
private String mode;
|
// private String mode;
|
||||||
private long size;
|
private long size;
|
||||||
private long elf_offset;
|
private long elf_offset;
|
||||||
|
|
||||||
|
@ -145,10 +145,10 @@ public class AR {
|
||||||
// Convert the raw bytes into strings and numbers.
|
// Convert the raw bytes into strings and numbers.
|
||||||
//
|
//
|
||||||
this.object_name = removeBlanks(new String(object_name));
|
this.object_name = removeBlanks(new String(object_name));
|
||||||
this.modification_time = new String(modification_time);
|
// this.modification_time = new String(modification_time);
|
||||||
this.uid = new String(uid);
|
// this.uid = new String(uid);
|
||||||
this.gid = new String(gid);
|
// this.gid = new String(gid);
|
||||||
this.mode = new String(mode);
|
// this.mode = new String(mode);
|
||||||
this.size = Long.parseLong(removeBlanks(new String(size)));
|
this.size = Long.parseLong(removeBlanks(new String(size)));
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -250,7 +250,7 @@ public class AR {
|
||||||
if (headers != null)
|
if (headers != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Vector v = new Vector();
|
Vector<ARHeader> v = new Vector<ARHeader>();
|
||||||
try {
|
try {
|
||||||
//
|
//
|
||||||
// Check for EOF condition
|
// Check for EOF condition
|
||||||
|
@ -284,7 +284,7 @@ public class AR {
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
headers = (ARHeader[]) v.toArray(new ARHeader[0]);
|
headers = v.toArray(new ARHeader[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -301,29 +301,29 @@ public class AR {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean stringInStrings(String str, String[] set) {
|
private boolean stringInStrings(String str, String[] set) {
|
||||||
for (int i = 0; i < set.length; i++)
|
for (String element : set)
|
||||||
if (str.compareTo(set[i]) == 0)
|
if (str.compareTo(element) == 0)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] extractFiles(String outdir, String[] names) throws IOException {
|
public String[] extractFiles(String outdir, String[] names) throws IOException {
|
||||||
Vector names_used = new Vector();
|
Vector<String> names_used = new Vector<String>();
|
||||||
String object_name;
|
String object_name;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
loadHeaders();
|
loadHeaders();
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for (int i = 0; i < headers.length; i++) {
|
for (ARHeader header : headers) {
|
||||||
object_name = headers[i].getObjectName();
|
object_name = header.getObjectName();
|
||||||
if (names != null && !stringInStrings(object_name, names))
|
if (names != null && !stringInStrings(object_name, names))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
object_name = "" + count + "_" + object_name; //$NON-NLS-1$ //$NON-NLS-2$
|
object_name = "" + count + "_" + object_name; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
byte[] data = headers[i].getObjectData();
|
byte[] data = header.getObjectData();
|
||||||
File output = new File(outdir, object_name);
|
File output = new File(outdir, object_name);
|
||||||
names_used.add(object_name);
|
names_used.add(object_name);
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ public class AR {
|
||||||
rfile.close();
|
rfile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (String[]) names_used.toArray(new String[0]);
|
return names_used.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] extractFiles(String outdir) throws IOException {
|
public String[] extractFiles(String outdir) throws IOException {
|
||||||
|
|
|
@ -87,8 +87,8 @@ public class EnvVarOperationProcessor {
|
||||||
return prepend ? addValue + initialValue : initialValue + addValue;
|
return prepend ? addValue + initialValue : initialValue + addValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
List value = convertToList(initialValue, delimiter);
|
List<String> value = convertToList(initialValue, delimiter);
|
||||||
List added = convertToList(addValue, delimiter);
|
List<String> added = convertToList(addValue, delimiter);
|
||||||
|
|
||||||
value = removeDuplicates(value, added);
|
value = removeDuplicates(value, added);
|
||||||
|
|
||||||
|
@ -151,10 +151,9 @@ public class EnvVarOperationProcessor {
|
||||||
* Converts a given value to string using a delimiter passed to this method
|
* Converts a given value to string using a delimiter passed to this method
|
||||||
* @param value
|
* @param value
|
||||||
* @param delimiter
|
* @param delimiter
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
static public List convertToList(String value, String delimiter){
|
static public List<String> convertToList(String value, String delimiter){
|
||||||
List list = new ArrayList();
|
List<String> list = new ArrayList<String>();
|
||||||
int delLength = delimiter.length();
|
int delLength = delimiter.length();
|
||||||
int valLength = value.length();
|
int valLength = value.length();
|
||||||
|
|
||||||
|
@ -180,15 +179,15 @@ public class EnvVarOperationProcessor {
|
||||||
/*
|
/*
|
||||||
* removes duplicates
|
* removes duplicates
|
||||||
*/
|
*/
|
||||||
static public List removeDuplicates(List value, List duplicates){
|
static public List<String> removeDuplicates(List<String> value, List<String> duplicates){
|
||||||
List list = new ArrayList();
|
List<String> list = new ArrayList<String>();
|
||||||
Iterator valueIter = value.iterator();
|
Iterator<String> valueIter = value.iterator();
|
||||||
while(valueIter.hasNext()){
|
while(valueIter.hasNext()){
|
||||||
String curVal = (String)valueIter.next();
|
String curVal = valueIter.next();
|
||||||
boolean duplFound = false;
|
boolean duplFound = false;
|
||||||
Iterator duplicatesIter = duplicates.iterator();
|
Iterator<String> duplicatesIter = duplicates.iterator();
|
||||||
while(duplicatesIter.hasNext()){
|
while(duplicatesIter.hasNext()){
|
||||||
String curDupl = (String)duplicatesIter.next();
|
String curDupl = duplicatesIter.next();
|
||||||
if(curVal.equals(curDupl)){
|
if(curVal.equals(curDupl)){
|
||||||
duplFound = true;
|
duplFound = true;
|
||||||
break;
|
break;
|
||||||
|
@ -207,12 +206,12 @@ public class EnvVarOperationProcessor {
|
||||||
* @param delimiter
|
* @param delimiter
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
static public String convertToString(List list, String delimiter){
|
static public String convertToString(List<String> list, String delimiter){
|
||||||
Iterator iter = list.iterator();
|
Iterator<String> iter = list.iterator();
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
|
||||||
while(iter.hasNext()){
|
while(iter.hasNext()){
|
||||||
buffer.append((String)iter.next());
|
buffer.append(iter.next());
|
||||||
|
|
||||||
if(iter.hasNext())
|
if(iter.hasNext())
|
||||||
buffer.append(delimiter);
|
buffer.append(delimiter);
|
||||||
|
@ -221,19 +220,6 @@ public class EnvVarOperationProcessor {
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* concatenetes two Strings
|
|
||||||
* Returns a resulting string
|
|
||||||
*/
|
|
||||||
static private String concatenateStrings(String str1, String str2, String delimiter){
|
|
||||||
if(str1 == null || "".equals(str1)) //$NON-NLS-1$
|
|
||||||
return str2;
|
|
||||||
if(str2 == null || "".equals(str2)) //$NON-NLS-1$
|
|
||||||
return str1;
|
|
||||||
|
|
||||||
return str1 + delimiter + str2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* normalizes the variable name. That is: removes prepended and appended spaces
|
* normalizes the variable name. That is: removes prepended and appended spaces
|
||||||
* and converts the name to upper-case for Win32 systems
|
* and converts the name to upper-case for Win32 systems
|
||||||
|
@ -256,14 +242,13 @@ public class EnvVarOperationProcessor {
|
||||||
|
|
||||||
IEnvironmentVariable filtered[] = new IEnvironmentVariable[variables.length];
|
IEnvironmentVariable filtered[] = new IEnvironmentVariable[variables.length];
|
||||||
int filteredNum = 0;
|
int filteredNum = 0;
|
||||||
for(int i = 0; i < variables.length; i++){
|
for (IEnvironmentVariable var : variables) {
|
||||||
IEnvironmentVariable var = variables[i];
|
|
||||||
String name = null;
|
String name = null;
|
||||||
if(var != null && (name = normalizeName(var.getName())) != null){
|
if(var != null && (name = normalizeName(var.getName())) != null){
|
||||||
boolean skip = false;
|
boolean skip = false;
|
||||||
if(remove != null && remove.length > 0){
|
if(remove != null && remove.length > 0){
|
||||||
for(int j = 0; j < remove.length; j++){
|
for (String element : remove) {
|
||||||
if(remove[j] != null && remove[j].equals(name)){
|
if(element != null && element.equals(name)){
|
||||||
skip = true;
|
skip = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,9 +63,6 @@ public abstract class StorableEnvironmentLoader {
|
||||||
* this method should return the ISerializeInfo representing the information
|
* this method should return the ISerializeInfo representing the information
|
||||||
* of where the variable should be stored and loaded
|
* of where the variable should be stored and loaded
|
||||||
* If the given context is not supported this method should return null
|
* If the given context is not supported this method should return null
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
protected abstract ISerializeInfo getSerializeInfo(Object context);
|
protected abstract ISerializeInfo getSerializeInfo(Object context);
|
||||||
|
|
||||||
|
@ -198,9 +195,9 @@ public abstract class StorableEnvironmentLoader {
|
||||||
CCorePlugin.PLUGIN_ID,
|
CCorePlugin.PLUGIN_ID,
|
||||||
-1,
|
-1,
|
||||||
//TODO:ManagedMakeMessages.getResourceString(
|
//TODO:ManagedMakeMessages.getResourceString(
|
||||||
"StorableEnvironmentLoader.storeOutputStream.wrong.arguments"
|
"StorableEnvironmentLoader.storeOutputStream.wrong.arguments" //$NON-NLS-1$
|
||||||
//)
|
//)
|
||||||
, //$NON-NLS-1$
|
,
|
||||||
null));
|
null));
|
||||||
byte[] bytes= stream.toByteArray();
|
byte[] bytes= stream.toByteArray();
|
||||||
|
|
||||||
|
|
|
@ -60,12 +60,12 @@ public class AR {
|
||||||
public class ARHeader {
|
public class ARHeader {
|
||||||
|
|
||||||
private String object_name;
|
private String object_name;
|
||||||
private String modification_time;
|
// private String modification_time;
|
||||||
private String uid;
|
// private String uid;
|
||||||
private String gid;
|
// private String gid;
|
||||||
private String mode;
|
// private String mode;
|
||||||
private long size;
|
private long size;
|
||||||
private long file_offset;
|
// private long file_offset;
|
||||||
private long macho_offset;
|
private long macho_offset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,23 +88,23 @@ public class AR {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* <code>offset</code> not in string table bounds.
|
* <code>offset</code> not in string table bounds.
|
||||||
*/
|
*/
|
||||||
private String nameFromStringTable(long offset) throws IOException {
|
// private String nameFromStringTable(long offset) throws IOException {
|
||||||
StringBuffer name = new StringBuffer(0);
|
// StringBuffer name = new StringBuffer(0);
|
||||||
long pos = efile.getFilePointer();
|
// long pos = efile.getFilePointer();
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
if (strtbl_pos != -1) {
|
// if (strtbl_pos != -1) {
|
||||||
byte temp;
|
// byte temp;
|
||||||
efile.seek(strtbl_pos + offset);
|
// efile.seek(strtbl_pos + offset);
|
||||||
while ((temp = efile.readByte()) != '\n')
|
// while ((temp = efile.readByte()) != '\n')
|
||||||
name.append((char) temp);
|
// name.append((char) temp);
|
||||||
}
|
// }
|
||||||
} finally {
|
// } finally {
|
||||||
efile.seek(pos);
|
// efile.seek(pos);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return name.toString();
|
// return name.toString();
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new archive header object.
|
* Creates a new archive header object.
|
||||||
|
@ -143,10 +143,10 @@ public class AR {
|
||||||
// Convert the raw bytes into strings and numbers.
|
// Convert the raw bytes into strings and numbers.
|
||||||
//
|
//
|
||||||
this.object_name = removeBlanks(new String(object_name));
|
this.object_name = removeBlanks(new String(object_name));
|
||||||
this.modification_time = new String(modification_time);
|
// this.modification_time = new String(modification_time);
|
||||||
this.uid = new String(uid);
|
// this.uid = new String(uid);
|
||||||
this.gid = new String(gid);
|
// this.gid = new String(gid);
|
||||||
this.mode = new String(mode);
|
// this.mode = new String(mode);
|
||||||
this.size = Long.parseLong(removeBlanks(new String(size)));
|
this.size = Long.parseLong(removeBlanks(new String(size)));
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -256,14 +256,14 @@ public class AR {
|
||||||
if (headers != null)
|
if (headers != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Vector v = new Vector();
|
Vector<ARHeader> v = new Vector<ARHeader>();
|
||||||
try {
|
try {
|
||||||
//
|
//
|
||||||
// Check for EOF condition
|
// Check for EOF condition
|
||||||
//
|
//
|
||||||
while (efile.getFilePointer() < efile.length()) {
|
while (efile.getFilePointer() < efile.length()) {
|
||||||
ARHeader header = new ARHeader();
|
ARHeader header = new ARHeader();
|
||||||
String name = header.getObjectName();
|
header.getObjectName();
|
||||||
|
|
||||||
long pos = efile.getFilePointer();
|
long pos = efile.getFilePointer();
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ public class AR {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
// strtbl_pos = ???;
|
// strtbl_pos = ???;
|
||||||
headers = (ARHeader[]) v.toArray(new ARHeader[0]);
|
headers = v.toArray(new ARHeader[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -298,29 +298,29 @@ public class AR {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean stringInStrings(String str, String[] set) {
|
private boolean stringInStrings(String str, String[] set) {
|
||||||
for (int i = 0; i < set.length; i++)
|
for (String element : set)
|
||||||
if (str.compareTo(set[i]) == 0)
|
if (str.compareTo(element) == 0)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] extractFiles(String outdir, String[] names) throws IOException {
|
public String[] extractFiles(String outdir, String[] names) throws IOException {
|
||||||
Vector names_used = new Vector();
|
Vector<String> names_used = new Vector<String>();
|
||||||
String object_name;
|
String object_name;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
loadHeaders();
|
loadHeaders();
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for (int i = 0; i < headers.length; i++) {
|
for (ARHeader header : headers) {
|
||||||
object_name = headers[i].getObjectName();
|
object_name = header.getObjectName();
|
||||||
if (names != null && !stringInStrings(object_name, names))
|
if (names != null && !stringInStrings(object_name, names))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
object_name = "" + count + "_" + object_name; //$NON-NLS-1$ //$NON-NLS-2$
|
object_name = "" + count + "_" + object_name; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
byte[] data = headers[i].getObjectData();
|
byte[] data = header.getObjectData();
|
||||||
File output = new File(outdir, object_name);
|
File output = new File(outdir, object_name);
|
||||||
names_used.add(object_name);
|
names_used.add(object_name);
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ public class AR {
|
||||||
rfile.close();
|
rfile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (String[]) names_used.toArray(new String[0]);
|
return names_used.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] extractFiles(String outdir) throws IOException {
|
public String[] extractFiles(String outdir) throws IOException {
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class MachO {
|
||||||
private Symbol[] local_symbols; /* local symbols from DySymtabCommand */
|
private Symbol[] local_symbols; /* local symbols from DySymtabCommand */
|
||||||
private boolean dynsym = false; /* set if DynSymtabCommand is present */
|
private boolean dynsym = false; /* set if DynSymtabCommand is present */
|
||||||
Line[] lines; /* line table */
|
Line[] lines; /* line table */
|
||||||
private ArrayList sections = new ArrayList(); /* sections from SegmentCommand */
|
private ArrayList<Section> sections = new ArrayList<Section>(); /* sections from SegmentCommand */
|
||||||
SymtabCommand symtab; /* SymtabCommand that contains the symbol table */
|
SymtabCommand symtab; /* SymtabCommand that contains the symbol table */
|
||||||
|
|
||||||
protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||||
|
@ -171,17 +171,17 @@ public class MachO {
|
||||||
else
|
else
|
||||||
if ( magic == MH_UNIVERSAL)
|
if ( magic == MH_UNIVERSAL)
|
||||||
{
|
{
|
||||||
String arch = System.getProperty("os.arch");
|
String arch = System.getProperty("os.arch"); //$NON-NLS-1$
|
||||||
int numArchives = efile.readIntE();
|
int numArchives = efile.readIntE();
|
||||||
while (numArchives-- > 0)
|
while (numArchives-- > 0)
|
||||||
{
|
{
|
||||||
int cpuType = efile.readIntE();
|
int cpuType = efile.readIntE(); // cpuType
|
||||||
int cpuSubType = efile.readIntE();
|
efile.readIntE(); // cpuSubType
|
||||||
int archiveOffset = efile.readIntE();
|
int archiveOffset = efile.readIntE(); // archiveOffset
|
||||||
int archiveSize = efile.readIntE();
|
efile.readIntE(); // archiveSize
|
||||||
int archiveAlignment = efile.readIntE();
|
efile.readIntE(); // archiveAlignment
|
||||||
if ((cpuType == MachO.MachOhdr.CPU_TYPE_I386 && arch.equalsIgnoreCase("i386")) ||
|
if ((cpuType == MachO.MachOhdr.CPU_TYPE_I386 && arch.equalsIgnoreCase("i386")) || //$NON-NLS-1$
|
||||||
(cpuType == MachO.MachOhdr.CPU_TYPE_POWERPC && arch.equalsIgnoreCase("ppc")))
|
(cpuType == MachO.MachOhdr.CPU_TYPE_POWERPC && arch.equalsIgnoreCase("ppc"))) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
efile.seek(archiveOffset);
|
efile.seek(archiveOffset);
|
||||||
magic = efile.readIntE();
|
magic = efile.readIntE();
|
||||||
|
@ -212,17 +212,17 @@ public class MachO {
|
||||||
else
|
else
|
||||||
if ( magic == MH_UNIVERSAL)
|
if ( magic == MH_UNIVERSAL)
|
||||||
{
|
{
|
||||||
String arch = System.getProperty("os.arch");
|
String arch = System.getProperty("os.arch"); //$NON-NLS-1$
|
||||||
int numArchives = makeInt(bytes, offset, isle); offset += 4;
|
int numArchives = makeInt(bytes, offset, isle); offset += 4;
|
||||||
while (numArchives-- > 0)
|
while (numArchives-- > 0)
|
||||||
{
|
{
|
||||||
int cpuType = makeInt(bytes, offset, isle); offset += 4;
|
int cpuType = makeInt(bytes, offset, isle); offset += 4;
|
||||||
int cpuSubType = makeInt(bytes, offset, isle); offset += 4;
|
offset += 4; // cpuSubType
|
||||||
int archiveOffset = makeInt(bytes, offset, isle); offset += 4;
|
int archiveOffset = makeInt(bytes, offset, isle); offset += 4;
|
||||||
int archiveSize = makeInt(bytes, offset, isle); offset += 4;
|
offset += 4; // archiveSize
|
||||||
int archiveAlignment = makeInt(bytes, offset, isle); offset += 4;
|
offset += 4; // archiveAlignment
|
||||||
if ((cpuType == MachO.MachOhdr.CPU_TYPE_I386 && arch.equalsIgnoreCase("i386")) ||
|
if ((cpuType == MachO.MachOhdr.CPU_TYPE_I386 && arch.equalsIgnoreCase("i386")) || //$NON-NLS-1$
|
||||||
(cpuType == MachO.MachOhdr.CPU_TYPE_POWERPC && arch.equalsIgnoreCase("ppc")))
|
(cpuType == MachO.MachOhdr.CPU_TYPE_POWERPC && arch.equalsIgnoreCase("ppc"))) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
offset = archiveOffset;
|
offset = archiveOffset;
|
||||||
magic = makeInt(bytes, offset, isle); offset += 4;
|
magic = makeInt(bytes, offset, isle); offset += 4;
|
||||||
|
@ -245,15 +245,6 @@ public class MachO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final short makeShort(byte [] val, int offset, boolean isle) throws IOException {
|
|
||||||
if (val.length < offset + 2)
|
|
||||||
throw new IOException();
|
|
||||||
if ( isle ) {
|
|
||||||
return (short)(((val[offset + 1] & 0xff) << 8) + (val[offset + 0] & 0xff));
|
|
||||||
}
|
|
||||||
return (short)(((val[offset + 0] & 0xff) << 8) + (val[offset + 1] & 0xff));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int makeInt(byte [] val, int offset, boolean isle) throws IOException
|
private static final int makeInt(byte [] val, int offset, boolean isle) throws IOException
|
||||||
{
|
{
|
||||||
if (val.length < offset + 4)
|
if (val.length < offset + 4)
|
||||||
|
@ -644,7 +635,7 @@ public class MachO {
|
||||||
return getCStr();
|
return getCStr();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Symbol implements Comparable {
|
public class Symbol implements Comparable<Object> {
|
||||||
/* n_type bit masks */
|
/* n_type bit masks */
|
||||||
public final static int N_STAB = 0xe0;
|
public final static int N_STAB = 0xe0;
|
||||||
public final static int N_PEXT = 0x10;
|
public final static int N_PEXT = 0x10;
|
||||||
|
@ -889,7 +880,7 @@ public class MachO {
|
||||||
* and the Long doesn't know how to compare against a Symbol so if
|
* and the Long doesn't know how to compare against a Symbol so if
|
||||||
* we compare Symbol vs Long it is ok, but not if we do Long vs Symbol.
|
* we compare Symbol vs Long it is ok, but not if we do Long vs Symbol.
|
||||||
*/
|
*/
|
||||||
public static class SymbolComparator implements Comparator {
|
public static class SymbolComparator implements Comparator<Object> {
|
||||||
long val1, val2;
|
long val1, val2;
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(Object o1, Object o2) {
|
||||||
|
|
||||||
|
@ -916,7 +907,7 @@ public class MachO {
|
||||||
/**
|
/**
|
||||||
* Simple class to implement a line table
|
* Simple class to implement a line table
|
||||||
*/
|
*/
|
||||||
public static class Line implements Comparable {
|
public static class Line implements Comparable<Object> {
|
||||||
public long address;
|
public long address;
|
||||||
public int lineno;
|
public int lineno;
|
||||||
public String file;
|
public String file;
|
||||||
|
@ -1141,12 +1132,12 @@ public class MachO {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DySymtabCommand dysymtab = null;
|
DySymtabCommand dysymtab = null;
|
||||||
for (int c = 0; c < loadcommands.length; c++) {
|
for (LoadCommand loadcommand : loadcommands) {
|
||||||
switch (loadcommands[c].cmd) {
|
switch (loadcommand.cmd) {
|
||||||
case LoadCommand.LC_SYMTAB:
|
case LoadCommand.LC_SYMTAB:
|
||||||
symtab = (SymtabCommand)loadcommands[c];
|
symtab = (SymtabCommand)loadcommand;
|
||||||
efile.seek(symtab.symoff);
|
efile.seek(symtab.symoff);
|
||||||
ArrayList symList = new ArrayList(symtab.nsyms);
|
ArrayList<Symbol> symList = new ArrayList<Symbol>(symtab.nsyms);
|
||||||
for (int s = 0; s < symtab.nsyms; s++) {
|
for (int s = 0; s < symtab.nsyms; s++) {
|
||||||
Symbol symbol = new Symbol();
|
Symbol symbol = new Symbol();
|
||||||
symbol.n_strx = efile.readIntE();
|
symbol.n_strx = efile.readIntE();
|
||||||
|
@ -1159,20 +1150,20 @@ public class MachO {
|
||||||
debugsym = true;
|
debugsym = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
symbols = (Symbol[])symList.toArray(new Symbol[0]);
|
symbols = symList.toArray(new Symbol[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LoadCommand.LC_DYSYMTAB:
|
case LoadCommand.LC_DYSYMTAB:
|
||||||
dysymtab = (DySymtabCommand)loadcommands[c];
|
dysymtab = (DySymtabCommand)loadcommand;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dysymtab != null) {
|
if (dysymtab != null) {
|
||||||
ArrayList symList = new ArrayList(dysymtab.nlocalsym);
|
ArrayList<Symbol> symList = new ArrayList<Symbol>(dysymtab.nlocalsym);
|
||||||
for (int s = dysymtab.ilocalsym; s < dysymtab.nlocalsym; s++) {
|
for (int s = dysymtab.ilocalsym; s < dysymtab.nlocalsym; s++) {
|
||||||
symList.add(symbols[s]);
|
symList.add(symbols[s]);
|
||||||
}
|
}
|
||||||
local_symbols = (Symbol[])symList.toArray(new Symbol[0]);
|
local_symbols = symList.toArray(new Symbol[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1182,8 +1173,8 @@ public class MachO {
|
||||||
}
|
}
|
||||||
/* count number of source line entries */
|
/* count number of source line entries */
|
||||||
int nlines = 0;
|
int nlines = 0;
|
||||||
for (int s = 0; s < symbols.length; s++) {
|
for (Symbol symbol : symbols) {
|
||||||
if (symbols[s].n_type == Symbol.N_SLINE || symbols[s].n_type == Symbol.N_FUN) {
|
if (symbol.n_type == Symbol.N_SLINE || symbol.n_type == Symbol.N_FUN) {
|
||||||
nlines++;
|
nlines++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1192,15 +1183,14 @@ public class MachO {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now create line table, sorted on address */
|
/* now create line table, sorted on address */
|
||||||
Map lineList = new HashMap(nlines);
|
Map<Line, Line> lineList = new HashMap<Line, Line>(nlines);
|
||||||
for (int s = 0; s < symbols.length; s++) {
|
for (Symbol sym : symbols) {
|
||||||
Symbol sym = symbols[s];
|
|
||||||
if (sym.n_type == Symbol.N_SLINE || sym.n_type == Symbol.N_FUN) {
|
if (sym.n_type == Symbol.N_SLINE || sym.n_type == Symbol.N_FUN) {
|
||||||
Line lentry = new Line();
|
Line lentry = new Line();
|
||||||
lentry.address = sym.n_value;
|
lentry.address = sym.n_value;
|
||||||
lentry.lineno = sym.n_desc;
|
lentry.lineno = sym.n_desc;
|
||||||
|
|
||||||
Line lookup = (Line)lineList.get(lentry);
|
Line lookup = lineList.get(lentry);
|
||||||
if (lookup != null) {
|
if (lookup != null) {
|
||||||
lentry = lookup;
|
lentry = lookup;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1221,13 +1211,12 @@ public class MachO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Set k = lineList.keySet();
|
Set<Line> k = lineList.keySet();
|
||||||
lines = (Line[]) k.toArray(new Line[k.size()]);
|
lines = k.toArray(new Line[k.size()]);
|
||||||
Arrays.sort(lines);
|
Arrays.sort(lines);
|
||||||
|
|
||||||
/* now check for file names */
|
/* now check for file names */
|
||||||
for (int s = 0; s < symbols.length; s++) {
|
for (Symbol sym : symbols) {
|
||||||
Symbol sym = symbols[s];
|
|
||||||
if (sym.n_type == Symbol.N_SO) {
|
if (sym.n_type == Symbol.N_SO) {
|
||||||
Line line = getLine(sym.n_value);
|
Line line = getLine(sym.n_value);
|
||||||
if (line != null) {
|
if (line != null) {
|
||||||
|
@ -1238,11 +1227,11 @@ public class MachO {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList getSections(SegmentCommand seg) throws IOException {
|
private ArrayList<Section> getSections(SegmentCommand seg) throws IOException {
|
||||||
if ( seg.nsects == 0 ) {
|
if ( seg.nsects == 0 ) {
|
||||||
return new ArrayList();
|
return new ArrayList<Section>();
|
||||||
}
|
}
|
||||||
ArrayList sections = new ArrayList();
|
ArrayList<Section> sections = new ArrayList<Section>();
|
||||||
for ( int i = 0; i < seg.nsects; i++ ) {
|
for ( int i = 0; i < seg.nsects; i++ ) {
|
||||||
Section section = new Section();
|
Section section = new Section();
|
||||||
byte[] sectname = new byte[16];
|
byte[] sectname = new byte[16];
|
||||||
|
@ -1266,19 +1255,19 @@ public class MachO {
|
||||||
return sections;
|
return sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TwoLevelHint[] getTwoLevelHints(int nhints) throws IOException {
|
// private TwoLevelHint[] getTwoLevelHints(int nhints) throws IOException {
|
||||||
if ( nhints == 0 ) {
|
// if ( nhints == 0 ) {
|
||||||
return new TwoLevelHint[0];
|
// return new TwoLevelHint[0];
|
||||||
}
|
// }
|
||||||
TwoLevelHint[] tlhints = new TwoLevelHint[nhints];
|
// TwoLevelHint[] tlhints = new TwoLevelHint[nhints];
|
||||||
for ( int i = 0; i < nhints; i++ ) {
|
// for ( int i = 0; i < nhints; i++ ) {
|
||||||
int field = efile.readIntE();
|
// int field = efile.readIntE();
|
||||||
tlhints[i] = new TwoLevelHint();
|
// tlhints[i] = new TwoLevelHint();
|
||||||
tlhints[i].isub_image = (field & 0xff000000) >> 24;
|
// tlhints[i].isub_image = (field & 0xff000000) >> 24;
|
||||||
tlhints[i].itoc = field & 0x00ffffff;
|
// tlhints[i].itoc = field & 0x00ffffff;
|
||||||
}
|
// }
|
||||||
return tlhints;
|
// return tlhints;
|
||||||
}
|
// }
|
||||||
|
|
||||||
private String getCStr() throws IOException {
|
private String getCStr() throws IOException {
|
||||||
StringBuffer str = new StringBuffer();
|
StringBuffer str = new StringBuffer();
|
||||||
|
@ -1597,18 +1586,18 @@ public class MachO {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Section[] getSections() {
|
public Section[] getSections() {
|
||||||
return (Section[]) sections.toArray(new Section[sections.size()]);
|
return sections.toArray(new Section[sections.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DyLib[] getDyLibs(int type) {
|
public DyLib[] getDyLibs(int type) {
|
||||||
ArrayList v = new ArrayList();
|
ArrayList<DyLib> v = new ArrayList<DyLib>();
|
||||||
for (int i = 0; i < loadcommands.length; i++) {
|
for (LoadCommand loadcommand : loadcommands) {
|
||||||
if (loadcommands[i].cmd == type) {
|
if (loadcommand.cmd == type) {
|
||||||
DyLibCommand dl = (DyLibCommand)loadcommands[i];
|
DyLibCommand dl = (DyLibCommand)loadcommand;
|
||||||
v.add(dl.dylib);
|
v.add(dl.dylib);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (DyLib[]) v.toArray(new DyLib[v.size()]);
|
return v.toArray(new DyLib[v.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return the address of the function that address is in */
|
/* return the address of the function that address is in */
|
||||||
|
@ -1663,10 +1652,10 @@ public class MachO {
|
||||||
} catch (IOException e) { }
|
} catch (IOException e) { }
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < loadcommands.length; i++) {
|
for (LoadCommand loadcommand : loadcommands) {
|
||||||
if (loadcommands[i].cmd == LoadCommand.LC_SYMTAB)
|
if (loadcommand.cmd == LoadCommand.LC_SYMTAB)
|
||||||
{
|
{
|
||||||
symtab = (SymtabCommand)loadcommands[i];
|
symtab = (SymtabCommand)loadcommand;
|
||||||
try {
|
try {
|
||||||
int symSize = symtab.nsyms * 12;
|
int symSize = symtab.nsyms * 12;
|
||||||
byte[] data = new byte[symSize];
|
byte[] data = new byte[symSize];
|
||||||
|
|
|
@ -15,6 +15,10 @@ package org.eclipse.cdt.utils.macho;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.utils.macho.MachO.DyLib;
|
||||||
|
import org.eclipse.cdt.utils.macho.MachO.Section;
|
||||||
|
import org.eclipse.cdt.utils.macho.MachO.Symbol;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>MachOHelper</code> is a wrapper class for the <code>MachO</code> class
|
* <code>MachOHelper</code> is a wrapper class for the <code>MachO</code> class
|
||||||
* to provide higher level API for sorting/searching the MachO data.
|
* to provide higher level API for sorting/searching the MachO data.
|
||||||
|
@ -108,12 +112,11 @@ public class MachOHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public MachO.Symbol[] getExternalFunctions() throws IOException {
|
public MachO.Symbol[] getExternalFunctions() throws IOException {
|
||||||
Vector v = new Vector();
|
Vector<Symbol> v = new Vector<Symbol>();
|
||||||
|
|
||||||
loadBinary();
|
loadBinary();
|
||||||
|
|
||||||
for (int i = 0; i < dynsyms.length; i++) {
|
for (Symbol sym : dynsyms) {
|
||||||
MachO.Symbol sym = dynsyms[i];
|
|
||||||
if ((sym.n_type_mask(MachO.Symbol.N_PEXT)
|
if ((sym.n_type_mask(MachO.Symbol.N_PEXT)
|
||||||
|| sym.n_type_mask(MachO.Symbol.N_EXT))
|
|| sym.n_type_mask(MachO.Symbol.N_EXT))
|
||||||
&& sym.n_desc(MachO.Symbol.REFERENCE_FLAG_UNDEFINED_LAZY)) {
|
&& sym.n_desc(MachO.Symbol.REFERENCE_FLAG_UNDEFINED_LAZY)) {
|
||||||
|
@ -123,17 +126,16 @@ public class MachOHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MachO.Symbol[] ret = (MachO.Symbol[]) v.toArray(new MachO.Symbol[0]);
|
MachO.Symbol[] ret = v.toArray(new MachO.Symbol[0]);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MachO.Symbol[] getExternalObjects() throws IOException {
|
public MachO.Symbol[] getExternalObjects() throws IOException {
|
||||||
Vector v = new Vector();
|
Vector<Symbol> v = new Vector<Symbol>();
|
||||||
|
|
||||||
loadBinary();
|
loadBinary();
|
||||||
|
|
||||||
for (int i = 0; i < dynsyms.length; i++) {
|
for (Symbol sym : dynsyms) {
|
||||||
MachO.Symbol sym = dynsyms[i];
|
|
||||||
if ((sym.n_type_mask(MachO.Symbol.N_PEXT)
|
if ((sym.n_type_mask(MachO.Symbol.N_PEXT)
|
||||||
|| sym.n_type_mask(MachO.Symbol.N_EXT))
|
|| sym.n_type_mask(MachO.Symbol.N_EXT))
|
||||||
&& sym.n_desc(MachO.Symbol.REFERENCE_FLAG_UNDEFINED_NON_LAZY)) {
|
&& sym.n_desc(MachO.Symbol.REFERENCE_FLAG_UNDEFINED_NON_LAZY)) {
|
||||||
|
@ -143,21 +145,21 @@ public class MachOHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MachO.Symbol[] ret = (MachO.Symbol[]) v.toArray(new MachO.Symbol[0]);
|
MachO.Symbol[] ret = v.toArray(new MachO.Symbol[0]);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MachO.Symbol[] getUndefined() throws IOException {
|
public MachO.Symbol[] getUndefined() throws IOException {
|
||||||
Vector v = new Vector();
|
Vector<Symbol> v = new Vector<Symbol>();
|
||||||
|
|
||||||
loadBinary();
|
loadBinary();
|
||||||
|
|
||||||
for (int i = 0; i < dynsyms.length; i++) {
|
for (Symbol dynsym : dynsyms) {
|
||||||
if (dynsyms[i].n_type(MachO.Symbol.N_UNDF))
|
if (dynsym.n_type(MachO.Symbol.N_UNDF))
|
||||||
v.add(dynsyms[i]);
|
v.add(dynsym);
|
||||||
}
|
}
|
||||||
|
|
||||||
MachO.Symbol[] ret = (MachO.Symbol[]) v.toArray(new MachO.Symbol[0]);
|
MachO.Symbol[] ret = v.toArray(new MachO.Symbol[0]);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,12 +167,11 @@ public class MachOHelper {
|
||||||
* TODO: I'm not sure if this are correct. Need to check
|
* TODO: I'm not sure if this are correct. Need to check
|
||||||
*/
|
*/
|
||||||
public MachO.Symbol[] getLocalFunctions() throws IOException {
|
public MachO.Symbol[] getLocalFunctions() throws IOException {
|
||||||
Vector v = new Vector();
|
Vector<Symbol> v = new Vector<Symbol>();
|
||||||
|
|
||||||
loadBinary();
|
loadBinary();
|
||||||
|
|
||||||
for (int i = 0; i < dynsyms.length; i++) {
|
for (Symbol sym : dynsyms) {
|
||||||
MachO.Symbol sym = dynsyms[i];
|
|
||||||
if ((!sym.n_type_mask(MachO.Symbol.N_PEXT)
|
if ((!sym.n_type_mask(MachO.Symbol.N_PEXT)
|
||||||
&& !sym.n_type_mask(MachO.Symbol.N_EXT))
|
&& !sym.n_type_mask(MachO.Symbol.N_EXT))
|
||||||
&& sym.n_desc(MachO.Symbol.REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY)) {
|
&& sym.n_desc(MachO.Symbol.REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY)) {
|
||||||
|
@ -180,7 +181,7 @@ public class MachOHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MachO.Symbol[] ret = (MachO.Symbol[]) v.toArray(new MachO.Symbol[0]);
|
MachO.Symbol[] ret = v.toArray(new MachO.Symbol[0]);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,12 +189,11 @@ public class MachOHelper {
|
||||||
* TODO: I'm not sure if this are correct. Need to check
|
* TODO: I'm not sure if this are correct. Need to check
|
||||||
*/
|
*/
|
||||||
public MachO.Symbol[] getLocalObjects() throws IOException {
|
public MachO.Symbol[] getLocalObjects() throws IOException {
|
||||||
Vector v = new Vector();
|
Vector<Symbol> v = new Vector<Symbol>();
|
||||||
|
|
||||||
loadBinary();
|
loadBinary();
|
||||||
|
|
||||||
for (int i = 0; i < dynsyms.length; i++) {
|
for (Symbol sym : dynsyms) {
|
||||||
MachO.Symbol sym = dynsyms[i];
|
|
||||||
if ((!sym.n_type_mask(MachO.Symbol.N_PEXT)
|
if ((!sym.n_type_mask(MachO.Symbol.N_PEXT)
|
||||||
&& !sym.n_type_mask(MachO.Symbol.N_EXT))
|
&& !sym.n_type_mask(MachO.Symbol.N_EXT))
|
||||||
&& sym.n_desc(MachO.Symbol.REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY)) {
|
&& sym.n_desc(MachO.Symbol.REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY)) {
|
||||||
|
@ -203,12 +203,12 @@ public class MachOHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MachO.Symbol[] ret = (MachO.Symbol[]) v.toArray(new MachO.Symbol[0]);
|
MachO.Symbol[] ret = v.toArray(new MachO.Symbol[0]);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MachO.Symbol[] getCommonObjects() throws IOException {
|
public MachO.Symbol[] getCommonObjects() throws IOException {
|
||||||
Vector v = new Vector();
|
Vector<Symbol> v = new Vector<Symbol>();
|
||||||
|
|
||||||
loadBinary();
|
loadBinary();
|
||||||
|
|
||||||
|
@ -221,19 +221,19 @@ public class MachOHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MachO.Symbol[] ret = (MachO.Symbol[]) v.toArray(new MachO.Symbol[0]);
|
MachO.Symbol[] ret = v.toArray(new MachO.Symbol[0]);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getNeeded() throws IOException {
|
public String[] getNeeded() throws IOException {
|
||||||
Vector v = new Vector();
|
Vector<String> v = new Vector<String>();
|
||||||
|
|
||||||
loadBinary();
|
loadBinary();
|
||||||
|
|
||||||
for (int i = 0; i < needed.length; i++) {
|
for (DyLib element : needed) {
|
||||||
v.add(needed[i].toString());
|
v.add(element.toString());
|
||||||
}
|
}
|
||||||
return (String[]) v.toArray(new String[0]);
|
return v.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSoname() throws IOException {
|
public String getSoname() throws IOException {
|
||||||
|
@ -241,47 +241,47 @@ public class MachOHelper {
|
||||||
|
|
||||||
loadBinary();
|
loadBinary();
|
||||||
|
|
||||||
for (int i = 0; i < sonames.length; i++) {
|
for (DyLib soname2 : sonames) {
|
||||||
soname = sonames[i].toString();
|
soname = soname2.toString();
|
||||||
}
|
}
|
||||||
return soname;
|
return soname;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSubUsage(String full, String name) {
|
// private String getSubUsage(String full, String name) {
|
||||||
int start, end;
|
// int start, end;
|
||||||
//boolean has_names = false;
|
// //boolean has_names = false;
|
||||||
//boolean has_languages = false;
|
// //boolean has_languages = false;
|
||||||
start = 0;
|
// start = 0;
|
||||||
end = 0;
|
// end = 0;
|
||||||
|
//
|
||||||
for (int i = 0; i < full.length(); i++) {
|
// for (int i = 0; i < full.length(); i++) {
|
||||||
if (full.charAt(i) == '%') {
|
// if (full.charAt(i) == '%') {
|
||||||
if (full.charAt(i + 1) == '-') {
|
// if (full.charAt(i + 1) == '-') {
|
||||||
if (start == 0) {
|
// if (start == 0) {
|
||||||
int eol = full.indexOf('\n', i + 2);
|
// int eol = full.indexOf('\n', i + 2);
|
||||||
String temp = full.substring(i + 2, eol);
|
// String temp = full.substring(i + 2, eol);
|
||||||
if (temp.compareTo(name) == 0)
|
// if (temp.compareTo(name) == 0)
|
||||||
start = eol;
|
// start = eol;
|
||||||
|
//
|
||||||
//has_names = true;
|
// //has_names = true;
|
||||||
} else if (end == 0) {
|
// } else if (end == 0) {
|
||||||
end = i - 1;
|
// end = i - 1;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//if( full.charAt( i+1 ) == '=' )
|
// //if( full.charAt( i+1 ) == '=' )
|
||||||
//has_languages = true;
|
// //has_languages = true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (end == 0)
|
// if (end == 0)
|
||||||
end = full.length();
|
// end = full.length();
|
||||||
|
//
|
||||||
if (start == 0)
|
// if (start == 0)
|
||||||
return full;
|
// return full;
|
||||||
|
//
|
||||||
return full.substring(start, end);
|
// return full.substring(start, end);
|
||||||
}
|
// }
|
||||||
|
|
||||||
public String getQnxUsage() throws IOException {
|
public String getQnxUsage() throws IOException {
|
||||||
return new String(""); //$NON-NLS-1$
|
return new String(""); //$NON-NLS-1$
|
||||||
|
@ -298,17 +298,17 @@ public class MachOHelper {
|
||||||
// TODO we only need to load the sections, not the whole shebang
|
// TODO we only need to load the sections, not the whole shebang
|
||||||
loadBinary();
|
loadBinary();
|
||||||
|
|
||||||
for (int i = 0; i < sections.length; i++) {
|
for (Section section : sections) {
|
||||||
MachO.SegmentCommand seg = sections[i].segment;
|
MachO.SegmentCommand seg = section.segment;
|
||||||
if (sections[i].flags(MachO.Section.SECTION_TYP) != MachO.Section.S_ZEROFILL) {
|
if (section.flags(MachO.Section.SECTION_TYP) != MachO.Section.S_ZEROFILL) {
|
||||||
if (seg.prot(MachO.SegmentCommand.VM_PROT_EXECUTE)) {
|
if (seg.prot(MachO.SegmentCommand.VM_PROT_EXECUTE)) {
|
||||||
text += sections[i].size;
|
text += section.size;
|
||||||
} else if (!seg.prot(MachO.SegmentCommand.VM_PROT_WRITE)) {
|
} else if (!seg.prot(MachO.SegmentCommand.VM_PROT_WRITE)) {
|
||||||
data += sections[i].size;
|
data += section.size;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (seg.prot(MachO.SegmentCommand.VM_PROT_WRITE)) {
|
if (seg.prot(MachO.SegmentCommand.VM_PROT_WRITE)) {
|
||||||
bss += sections[i].size;
|
bss += section.size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,7 +248,7 @@ public class MachOBinaryObject extends BinaryObjectAdapter {
|
||||||
protected ISymbol[] loadSymbols(MachOHelper helper) throws IOException {
|
protected ISymbol[] loadSymbols(MachOHelper helper) throws IOException {
|
||||||
CPPFilt cppfilt = null;
|
CPPFilt cppfilt = null;
|
||||||
try {
|
try {
|
||||||
ArrayList list = new ArrayList();
|
ArrayList<Symbol> list = new ArrayList<Symbol>();
|
||||||
// Hack should be remove when Elf is clean
|
// Hack should be remove when Elf is clean
|
||||||
helper.getMachO().setCppFilter(false);
|
helper.getMachO().setCppFilter(false);
|
||||||
cppfilt = getCPPFilt();
|
cppfilt = getCPPFilt();
|
||||||
|
@ -257,7 +257,7 @@ public class MachOBinaryObject extends BinaryObjectAdapter {
|
||||||
addSymbols(helper.getLocalFunctions(), ISymbol.FUNCTION, cppfilt, list);
|
addSymbols(helper.getLocalFunctions(), ISymbol.FUNCTION, cppfilt, list);
|
||||||
addSymbols(helper.getExternalObjects(), ISymbol.VARIABLE, cppfilt, list);
|
addSymbols(helper.getExternalObjects(), ISymbol.VARIABLE, cppfilt, list);
|
||||||
addSymbols(helper.getLocalObjects(), ISymbol.VARIABLE, cppfilt, list);
|
addSymbols(helper.getLocalObjects(), ISymbol.VARIABLE, cppfilt, list);
|
||||||
return (ISymbol[]) list.toArray(new ISymbol[list.size()]);
|
return list.toArray(new ISymbol[list.size()]);
|
||||||
} finally {
|
} finally {
|
||||||
if (cppfilt != null) {
|
if (cppfilt != null) {
|
||||||
cppfilt.dispose();
|
cppfilt.dispose();
|
||||||
|
@ -270,9 +270,9 @@ public class MachOBinaryObject extends BinaryObjectAdapter {
|
||||||
return parser.getCPPFilt();
|
return parser.getCPPFilt();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSymbols(MachO.Symbol[] array, int type, CPPFilt cppfilt, List list) {
|
private void addSymbols(MachO.Symbol[] array, int type, CPPFilt cppfilt, List<Symbol> list) {
|
||||||
for (int i = 0; i < array.length; i++) {
|
for (org.eclipse.cdt.utils.macho.MachO.Symbol element : array) {
|
||||||
String name = array[i].toString();
|
String name = element.toString();
|
||||||
if (cppfilt != null) {
|
if (cppfilt != null) {
|
||||||
try {
|
try {
|
||||||
name = cppfilt.getFunction(name);
|
name = cppfilt.getFunction(name);
|
||||||
|
@ -280,11 +280,11 @@ public class MachOBinaryObject extends BinaryObjectAdapter {
|
||||||
cppfilt = null;
|
cppfilt = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
long addr = array[i].n_value;
|
long addr = element.n_value;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
String filename = array[i].getFilename();
|
String filename = element.getFilename();
|
||||||
IPath filePath = (filename != null) ? new Path(filename) : null; //$NON-NLS-1$
|
IPath filePath = (filename != null) ? new Path(filename) : null;
|
||||||
list.add(new Symbol(this, name, type, new Addr32(array[i].n_value), size, filePath, array[i].getLineNumber(addr), array[i].getLineNumber(addr + size - 1)));
|
list.add(new Symbol(this, name, type, new Addr32(element.n_value), size, filePath, element.getLineNumber(addr), element.getLineNumber(addr + size - 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,6 +395,7 @@ public class MachOBinaryObject extends BinaryObjectAdapter {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
|
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public Object getAdapter(Class adapter) {
|
public Object getAdapter(Class adapter) {
|
||||||
if (adapter.equals(MachO.class)) {
|
if (adapter.equals(MachO.class)) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class AR {
|
||||||
|
|
||||||
private long fstmoff = 0;
|
private long fstmoff = 0;
|
||||||
private long lstmoff = 0;
|
private long lstmoff = 0;
|
||||||
private long memoff = 0;
|
// private long memoff = 0;
|
||||||
|
|
||||||
public ARHeader() throws IOException {
|
public ARHeader() throws IOException {
|
||||||
try {
|
try {
|
||||||
|
@ -67,7 +67,7 @@ public class AR {
|
||||||
file.read(fl_freeoff);
|
file.read(fl_freeoff);
|
||||||
fstmoff = Long.parseLong(removeBlanks(new String(fl_fstmoff)));
|
fstmoff = Long.parseLong(removeBlanks(new String(fl_fstmoff)));
|
||||||
lstmoff = Long.parseLong(removeBlanks(new String(fl_lstmoff)));
|
lstmoff = Long.parseLong(removeBlanks(new String(fl_lstmoff)));
|
||||||
memoff = Long.parseLong(removeBlanks(new String(fl_memoff)));
|
// memoff = Long.parseLong(removeBlanks(new String(fl_memoff)));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -272,7 +272,7 @@ public class AR {
|
||||||
if (memberHeaders != null)
|
if (memberHeaders != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Vector v = new Vector();
|
Vector<MemberHeader> v = new Vector<MemberHeader>();
|
||||||
try {
|
try {
|
||||||
//
|
//
|
||||||
// Check for EOF condition
|
// Check for EOF condition
|
||||||
|
@ -281,7 +281,6 @@ public class AR {
|
||||||
for (long pos = header.fstmoff; pos < file.length(); pos = aHeader.nxtmem) {
|
for (long pos = header.fstmoff; pos < file.length(); pos = aHeader.nxtmem) {
|
||||||
file.seek(pos);
|
file.seek(pos);
|
||||||
aHeader = new MemberHeader();
|
aHeader = new MemberHeader();
|
||||||
String name = aHeader.getObjectName();
|
|
||||||
v.add(aHeader);
|
v.add(aHeader);
|
||||||
if (pos == 0 || pos == header.lstmoff) { // end of double linked list
|
if (pos == 0 || pos == header.lstmoff) { // end of double linked list
|
||||||
break;
|
break;
|
||||||
|
@ -289,7 +288,7 @@ public class AR {
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
memberHeaders = (MemberHeader[]) v.toArray(new MemberHeader[0]);
|
memberHeaders = v.toArray(new MemberHeader[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,22 +305,22 @@ public class AR {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] extractFiles(String outdir, String[] names) throws IOException {
|
public String[] extractFiles(String outdir, String[] names) throws IOException {
|
||||||
Vector names_used = new Vector();
|
Vector<String> names_used = new Vector<String>();
|
||||||
String object_name;
|
String object_name;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
loadHeaders();
|
loadHeaders();
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for (int i = 0; i < memberHeaders.length; i++) {
|
for (MemberHeader memberHeader : memberHeaders) {
|
||||||
object_name = memberHeaders[i].getObjectName();
|
object_name = memberHeader.getObjectName();
|
||||||
if (names != null && !stringInStrings(object_name, names))
|
if (names != null && !stringInStrings(object_name, names))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
object_name = "" + count + "_" + object_name; //$NON-NLS-1$ //$NON-NLS-2$
|
object_name = "" + count + "_" + object_name; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
byte[] data = memberHeaders[i].getObjectData();
|
byte[] data = memberHeader.getObjectData();
|
||||||
File output = new File(outdir, object_name);
|
File output = new File(outdir, object_name);
|
||||||
names_used.add(object_name);
|
names_used.add(object_name);
|
||||||
|
|
||||||
|
@ -330,12 +329,12 @@ public class AR {
|
||||||
rfile.close();
|
rfile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (String[]) names_used.toArray(new String[0]);
|
return names_used.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean stringInStrings(String str, String[] set) {
|
private boolean stringInStrings(String str, String[] set) {
|
||||||
for (int i = 0; i < set.length; i++)
|
for (String element : set)
|
||||||
if (str.compareTo(set[i]) == 0)
|
if (str.compareTo(element) == 0)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,8 @@ import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
|
|
||||||
public class XCOFFBinaryExecutable extends XCOFFBinaryObject implements IBinaryFile {
|
public class XCOFFBinaryExecutable extends XCOFFBinaryObject {
|
||||||
|
|
||||||
/**
|
|
||||||
* @param parser
|
|
||||||
* @param path
|
|
||||||
* @param type
|
|
||||||
*/
|
|
||||||
public XCOFFBinaryExecutable(IBinaryParser parser, IPath path) {
|
public XCOFFBinaryExecutable(IBinaryParser parser, IPath path) {
|
||||||
super(parser, path, IBinaryFile.EXECUTABLE);
|
super(parser, path, IBinaryFile.EXECUTABLE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.cdt.utils.IGnuToolFactory;
|
||||||
import org.eclipse.cdt.utils.Objdump;
|
import org.eclipse.cdt.utils.Objdump;
|
||||||
import org.eclipse.cdt.utils.xcoff.AR;
|
import org.eclipse.cdt.utils.xcoff.AR;
|
||||||
import org.eclipse.cdt.utils.xcoff.XCoff32;
|
import org.eclipse.cdt.utils.xcoff.XCoff32;
|
||||||
|
import org.eclipse.cdt.utils.xcoff.XCoff32.Symbol;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
|
@ -113,7 +114,7 @@ public class XCOFFBinaryObject extends BinaryObjectAdapter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getContents()
|
* @see org.eclipse.cdt.core.IBinaryParser.IBinaryFile#getContents()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public InputStream getContents() throws IOException {
|
public InputStream getContents() throws IOException {
|
||||||
|
@ -173,28 +174,28 @@ public class XCOFFBinaryObject extends BinaryObjectAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void loadSymbols(XCoff32 xcoff) throws IOException {
|
protected void loadSymbols(XCoff32 xcoff) throws IOException {
|
||||||
ArrayList list = new ArrayList();
|
ArrayList<XCoffSymbol> list = new ArrayList<XCoffSymbol>();
|
||||||
|
|
||||||
XCoff32.Symbol[] peSyms = xcoff.getSymbols();
|
XCoff32.Symbol[] peSyms = xcoff.getSymbols();
|
||||||
byte[] table = xcoff.getStringTable();
|
byte[] table = xcoff.getStringTable();
|
||||||
addSymbols(peSyms, table, list);
|
addSymbols(peSyms, table, list);
|
||||||
|
|
||||||
symbols = (ISymbol[]) list.toArray(NO_SYMBOLS);
|
symbols = list.toArray(NO_SYMBOLS);
|
||||||
Arrays.sort(symbols);
|
Arrays.sort(symbols);
|
||||||
list.clear();
|
list.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addSymbols(XCoff32.Symbol[] peSyms, byte[] table, List list) {
|
protected void addSymbols(XCoff32.Symbol[] peSyms, byte[] table, List<XCoffSymbol> list) {
|
||||||
CPPFilt cppfilt = getCPPFilt();
|
CPPFilt cppfilt = getCPPFilt();
|
||||||
Addr2line addr2line = getAddr2line(false);
|
Addr2line addr2line = getAddr2line(false);
|
||||||
for (int i = 0; i < peSyms.length; i++) {
|
for (Symbol peSym : peSyms) {
|
||||||
if (peSyms[i].isFunction() || peSyms[i].isVariable() ) {
|
if (peSym.isFunction() || peSym.isVariable() ) {
|
||||||
String name = peSyms[i].getName(table);
|
String name = peSym.getName(table);
|
||||||
if (name == null || name.trim().length() == 0 || !Character.isJavaIdentifierStart(name.charAt(0))) {
|
if (name == null || name.trim().length() == 0 || !Character.isJavaIdentifierStart(name.charAt(0))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int type = peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE;
|
int type = peSym.isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE;
|
||||||
IAddress addr = new Addr32(peSyms[i].n_value);
|
IAddress addr = new Addr32(peSym.n_value);
|
||||||
int size = 4;
|
int size = 4;
|
||||||
if (cppfilt != null) {
|
if (cppfilt != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -240,7 +241,6 @@ public class XCOFFBinaryObject extends BinaryObjectAdapter {
|
||||||
return getAddr2line();
|
return getAddr2line();
|
||||||
}
|
}
|
||||||
if (addr2line == null) {
|
if (addr2line == null) {
|
||||||
XCOFF32Parser parser = (XCOFF32Parser) getBinaryParser();
|
|
||||||
addr2line = getAddr2line();
|
addr2line = getAddr2line();
|
||||||
if (addr2line != null) {
|
if (addr2line != null) {
|
||||||
starttime = System.currentTimeMillis();
|
starttime = System.currentTimeMillis();
|
||||||
|
@ -306,6 +306,7 @@ public class XCOFFBinaryObject extends BinaryObjectAdapter {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
|
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public Object getAdapter(Class adapter) {
|
public Object getAdapter(Class adapter) {
|
||||||
if (adapter == Addr2line.class) {
|
if (adapter == Addr2line.class) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue