mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
RESOLVED - bug 268840: deadlock in SCMarkerGenerator.addMarker() when opening a project
https://bugs.eclipse.org/bugs/show_bug.cgi?id=268840
This commit is contained in:
parent
8f29cb5265
commit
eafaf7f05f
11 changed files with 158 additions and 30 deletions
|
@ -1,4 +1,4 @@
|
|||
#Fri Feb 01 08:50:32 CET 2008
|
||||
#Tue Mar 17 14:25:32 EDT 2009
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
|
@ -7,6 +7,68 @@ org.eclipse.jdt.core.compiler.compliance=1.5
|
|||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
|
|
|
@ -150,7 +150,7 @@ public class MakeBuilder extends ACBuilder {
|
|||
IPath workingDirectory = MakeBuilderUtil.getBuildDirectory(currProject, info);
|
||||
|
||||
String[] targets = getTargets(kind, info);
|
||||
if (targets.length != 0 && targets[targets.length - 1].equals(info.getCleanBuildTarget())) //$NON-NLS-1$
|
||||
if (targets.length != 0 && targets[targets.length - 1].equals(info.getCleanBuildTarget()))
|
||||
isClean = true;
|
||||
|
||||
String errMsg = null;
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.make.core.messages;
|
||||
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
public class Messages extends NLS {
|
||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.make.core.messages.messages"; //$NON-NLS-1$
|
||||
public static String SCMarkerGenerator_0;
|
||||
public static String SCMarkerGenerator_1;
|
||||
static {
|
||||
// initialize resource bundle
|
||||
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||
}
|
||||
|
||||
private Messages() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2009 IBM Corporation and others.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# IBM Corporation - initial API and implementation
|
||||
###############################################################################
|
||||
SCMarkerGenerator_0=Add markers to project
|
||||
SCMarkerGenerator_1=Error adding markers.
|
|
@ -51,7 +51,7 @@ public class ProjectTargets {
|
|||
private static final String TARGET_USE_DEFAULT_CMD = "useDefaultCommand"; //$NON-NLS-1$
|
||||
private static final String TARGET_ARGUMENTS = "buildArguments"; //$NON-NLS-1$
|
||||
private static final String TARGET_COMMAND = "buildCommand"; //$NON-NLS-1$
|
||||
private static final String TARGET_RUN_ALL_BUILDERS = "runAllBuilders";
|
||||
private static final String TARGET_RUN_ALL_BUILDERS = "runAllBuilders"; //$NON-NLS-1$
|
||||
private static final String BAD_TARGET = "buidlTarget"; //$NON-NLS-1$
|
||||
private static final String TARGET = "buildTarget"; //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -76,12 +76,12 @@ public class DiscoveredPathContainer implements IPathEntryContainer {
|
|||
Map syms = info.getSymbols();
|
||||
List entries = new ArrayList(includes.length + syms.size());
|
||||
for (int i = 0; i < includes.length; i++) {
|
||||
entries.add(CoreModel.newIncludeEntry(Path.EMPTY, Path.EMPTY, includes[i], true)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
entries.add(CoreModel.newIncludeEntry(Path.EMPTY, Path.EMPTY, includes[i], true));
|
||||
}
|
||||
Iterator iter = syms.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entry entry = (Entry)iter.next();
|
||||
entries.add(CoreModel.newMacroEntry(Path.EMPTY, (String)entry.getKey(), (String)entry.getValue())); //$NON-NLS-1$
|
||||
entries.add(CoreModel.newMacroEntry(Path.EMPTY, (String)entry.getKey(), (String)entry.getValue()));
|
||||
}
|
||||
return (IPathEntry[])entries.toArray(new IPathEntry[entries.size()]);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class PerFileDiscoveredPathContainer extends DiscoveredPathContainer
|
|||
Map syms = filePathInfo.getSymbols(path);
|
||||
for (Iterator iter = syms.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Entry entry = (Entry)iter.next();
|
||||
entries.add(CoreModel.newMacroEntry(path, (String)entry.getKey(), (String)entry.getValue())); //$NON-NLS-1$
|
||||
entries.add(CoreModel.newMacroEntry(path, (String)entry.getKey(), (String)entry.getValue()));
|
||||
}
|
||||
}
|
||||
// compare the resource with include and macros files
|
||||
|
|
|
@ -79,7 +79,7 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
|||
defineParts[2] = line.substring(i + 1);
|
||||
}
|
||||
} else {
|
||||
MakeCorePlugin.log(new Exception("GCCSpecsConsoleParser ERROR: Unmatched brackets: ["+ line+ "]"));
|
||||
MakeCorePlugin.log(new Exception("GCCSpecsConsoleParser ERROR: Unmatched brackets: ["+ line+ "]")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.eclipse.core.runtime.Path;
|
|||
public class SCDMakefileGenerator extends DefaultRunSIProvider {
|
||||
private static final String ENDL = System.getProperty("line.separator"); //$NON-NLS-1$
|
||||
private static final String DENDL = ENDL+ENDL;
|
||||
private String fMakeCommand = "-f ${project_name}_scd.mk ";
|
||||
private String fMakeCommand = "-f ${project_name}_scd.mk "; //$NON-NLS-1$
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#initialize()
|
||||
|
@ -44,7 +44,7 @@ public class SCDMakefileGenerator extends DefaultRunSIProvider {
|
|||
protected boolean initialize() {
|
||||
String args = buildInfo.getProviderRunArguments(providerId);
|
||||
if (null == args)
|
||||
args = " -E -P -v -dD ";
|
||||
args = " -E -P -v -dD "; //$NON-NLS-1$
|
||||
else {
|
||||
int nPos = args.indexOf('|');
|
||||
if(nPos > 0) {
|
||||
|
@ -106,7 +106,7 @@ public class SCDMakefileGenerator extends DefaultRunSIProvider {
|
|||
buffer.append(DENDL);
|
||||
}
|
||||
|
||||
File makefile = new File(fWorkingDirectory.toFile(), getMakeFileName(projectName)); //$NON-NLS-1$
|
||||
File makefile = new File(fWorkingDirectory.toFile(), getMakeFileName(projectName));
|
||||
try {
|
||||
PrintStream ps = new PrintStream(new FileOutputStream(makefile));
|
||||
ps.println(buffer.toString());
|
||||
|
@ -128,10 +128,10 @@ public class SCDMakefileGenerator extends DefaultRunSIProvider {
|
|||
for(String arg : makeArgs) {
|
||||
if(found)
|
||||
return arg;
|
||||
if(arg.equals("-f"))
|
||||
if(arg.equals("-f")) //$NON-NLS-1$
|
||||
found = true;
|
||||
}
|
||||
return projectName+"_scd.mk";
|
||||
return projectName+"_scd.mk"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
|
@ -143,18 +143,18 @@ public class SCDMakefileGenerator extends DefaultRunSIProvider {
|
|||
resource.getProject().getName());
|
||||
string = string.replaceAll("\\$\\{plugin_state_location\\}", //$NON-NLS-1$
|
||||
MakeCorePlugin.getWorkingDirectory().toString());
|
||||
string = string.replaceAll("\\$\\{specs_file\\}",
|
||||
GCCScannerConfigUtil.C_SPECS_FILE ); //$NON-NLS-1$
|
||||
string = string.replaceAll("\\$\\{specs_file\\}", //$NON-NLS-1$
|
||||
GCCScannerConfigUtil.C_SPECS_FILE );
|
||||
return string;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getCommandLineOptions() {
|
||||
return ScannerConfigUtil.tokenizeStringWithQuotes(fMakeCommand, "\"");
|
||||
return ScannerConfigUtil.tokenizeStringWithQuotes(fMakeCommand, "\""); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IPath getCommandToLaunch() {
|
||||
return new Path("make");
|
||||
return new Path("make"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,16 @@ import org.eclipse.cdt.core.CCorePlugin;
|
|||
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||
import org.eclipse.cdt.core.ProblemMarkerInfo;
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.core.messages.Messages;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
|
||||
/**
|
||||
* Scanner config discovery related marker generator
|
||||
|
@ -49,7 +55,7 @@ public class SCMarkerGenerator implements IMarkerGenerator {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.cdt.core.ProblemMarkerInfo)
|
||||
*/
|
||||
public void addMarker(ProblemMarkerInfo problemMarkerInfo) {
|
||||
public void addMarker(final ProblemMarkerInfo problemMarkerInfo) {
|
||||
try {
|
||||
IMarker[] cur = problemMarkerInfo.file.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ONE);
|
||||
/*
|
||||
|
@ -66,18 +72,40 @@ public class SCMarkerGenerator implements IMarkerGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
IMarker marker = problemMarkerInfo.file.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
|
||||
// we have to add the marker in the job or we can deadlock other
|
||||
// threads that are responding to a resource delta by doing something
|
||||
// that accesses the project description
|
||||
Job markerJob = new Job(Messages.SCMarkerGenerator_0) {
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
IMarker marker;
|
||||
try {
|
||||
marker = problemMarkerInfo.file.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
|
||||
marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
|
||||
marker.setAttribute(IMarker.SEVERITY, mapMarkerSeverity(problemMarkerInfo.severity));
|
||||
marker.setAttribute(IMarker.LINE_NUMBER, problemMarkerInfo.lineNumber);
|
||||
marker.setAttribute(IMarker.CHAR_START, -1);
|
||||
marker.setAttribute(IMarker.CHAR_END, -1);
|
||||
|
||||
if (problemMarkerInfo.variableName != null) {
|
||||
marker.setAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE, problemMarkerInfo.variableName);
|
||||
}
|
||||
if (problemMarkerInfo.externalPath != null) {
|
||||
marker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, problemMarkerInfo.externalPath.toOSString());
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), Messages.SCMarkerGenerator_1, e);
|
||||
}
|
||||
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
markerJob.setRule(problemMarkerInfo.file);
|
||||
markerJob.schedule();
|
||||
|
||||
}
|
||||
catch (CoreException e) {
|
||||
CCorePlugin.log(e.getStatus());
|
||||
|
|
|
@ -203,7 +203,7 @@ public class ScannerConfigProfile {
|
|||
if (providerKind.equals(RUN)) {
|
||||
this.action = new ScannerConfigProfile.Run(actions[0]);
|
||||
}
|
||||
else if (providerKind.equals(OPEN)) { //$NON-NLS-1$
|
||||
else if (providerKind.equals(OPEN)) {
|
||||
this.action = new ScannerConfigProfile.Open(actions[0]);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Reference in a new issue