diff --git a/build/org.eclipse.cdt.autotools.core/ChangeLog b/build/org.eclipse.cdt.autotools.core/ChangeLog index b6294012348..c2a32f29534 100644 --- a/build/org.eclipse.cdt.autotools.core/ChangeLog +++ b/build/org.eclipse.cdt.autotools.core/ChangeLog @@ -1,3 +1,9 @@ +2012-08-29 Jeff Johnston + + Resolves: bug #381291 + * plugin.xml: Add other types of binary parsers for Autotools target since it can apply to + non-ELF OSes. + 2012-08-29 Jeff Johnston Resolves: bug #388354 diff --git a/build/org.eclipse.cdt.autotools.core/plugin.xml b/build/org.eclipse.cdt.autotools.core/plugin.xml index 030b63f3ad3..005a8e8cb93 100644 --- a/build/org.eclipse.cdt.autotools.core/plugin.xml +++ b/build/org.eclipse.cdt.autotools.core/plugin.xml @@ -379,7 +379,7 @@ diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/ConfigureMessages.properties b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/ConfigureMessages.properties index 9da9505b256..520658d0afc 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/ConfigureMessages.properties +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/ConfigureMessages.properties @@ -1,13 +1,13 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Red Hat, Inc. - * 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: - * Red Hat Incorporated - initial API and implementation - *******************************************************************************/ +################################################################################ +# Copyright (c) 2009, 2011, 2012 Red Hat, Inc. +# 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: +# Red Hat Incorporated - initial API and implementation +################################################################################ Option.configure.configure=configure Option.configure.general=General Option.configure.builddir=Build directory diff --git a/build/org.eclipse.cdt.autotools.docs/toc.xml b/build/org.eclipse.cdt.autotools.docs/toc.xml index def611ff098..be592ba16f6 100644 --- a/build/org.eclipse.cdt.autotools.docs/toc.xml +++ b/build/org.eclipse.cdt.autotools.docs/toc.xml @@ -1,4 +1,5 @@ + diff --git a/build/org.eclipse.cdt.autotools.ui/plugin.properties b/build/org.eclipse.cdt.autotools.ui/plugin.properties index 73ddb900711..cf503096419 100644 --- a/build/org.eclipse.cdt.autotools.ui/plugin.properties +++ b/build/org.eclipse.cdt.autotools.ui/plugin.properties @@ -1,5 +1,5 @@ ################################################################################# -# Copyright (c) 2006, 2008, 2009 Red Hat, Inc. +# Copyright (c) 2006, 2008, 2009, 2012 Red Hat, Inc. # 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 @@ -60,85 +60,6 @@ ShowTooltip.description=Shows the tooltip description for the element at the cur ACeditor.scope.name=Autoconf Editor ACeditor.scope.description=Editor for Autoconf Configuration Source Files -Tool.configure=configure - -OptionCategory.configure.general=General -Option.configure.name=Name -Option.configure.builddir=Build directory -Option.configure.builddir.tip=Subdirectory off of project where build will occur -Option.configure.configdir=Configure tool directory -Option.configure.configdir.tip=Subdirectory off of project containing configure scripts -Option.configure.cache_file=Name of configuration cache file (--cache-file) -Option.configure.cache_file.tip=Specify the name of the configuration cache file [config.cache] -Option.configure.no_create=Turn off file creation (--no-create) -Option.configure.no_create.tip=This tells configuration not to generate the output files as part of configuration -Option.configure.quiet=Turn off checking messages (--quiet) -Option.configure.quiet.tip=This turns off "checking ..." style messages from the configuration console output -Option.configure.help=Display help contents of top-level configuration (--help) -Option.configure.help.tip=Ask configuration file to display its help documentation -Option.configure.version=Display version of autotools used to create configuration (--version) -Option.configure.version.tip=This outputs the version of the Autotools used to create the configuration files - -OptionCategory.configure.platform=Platform Specifiers -Option.configure.host=Host platform (--host) -Option.configure.host.tip=Platform that project will run on -Option.configure.target=Target platform (--target) -Option.configure.target.tip=Platform that project will target output for -Option.configure.build=Build platform (--build) -Option.configure.build.tip=Platform where project is being built - -OptionCategory.configure.directories=Directory specifiers -Option.configure.prefix=Arch-independent install directory (--prefix) -Option.configure.prefix.tip=Place where architecture-independent files are installed [/usr/local] -Option.configure.exec_prefix=Arch-dependent install directory (--exec-prefix) -Option.configure.exec_prefix.tip=Place where architecture-dependent files are installed [PREFIX] -Option.configure.libdir=Object code library directory (--libdir) -Option.configure.libdir.tip=Place where object code libraries are installed [EPREFIX/lib] -Option.configure.bindir=User executable directory (--bindir) -Option.configure.bindir.tip=Place where binary executables are installed [EPREFIX/bin] -Option.configure.sbindir=System admin executable directory (--sbindir) -Option.configure.sbindir.tip=Place where system admin executables are installed [EPREFIX/sbin] -Option.configure.includedir=C Header file directory (--includdir) -Option.configure.includedir.tip=Place where header files will be installed [PREFIX/include] -Option.configure.datadir=Read-only architecture-independent data (--datadir) -Option.configure.datadir.tip=Place where read-only architecture-independent data is installed [PREFIX/share] -Option.configure.sysconfdir=Read-only single-machine data directory (--syconfdir) -Option.configure.sysconfdir.tip=Place where read-only single-machine data is stored [PREFIX/etc] -Option.configure.infodir=Info file documentation directory (--infodir) -Option.configure.infodir.tip=Place where info files are installed [PREFIX/info] -Option.configure.mandir=Man file documentation directory (--mandir) -Option.configure.mandir.tip=Place where man file documentation is installed [PREFIX/man] -Option.configure.srcdir=Sources directory (--srcdir) -Option.configure.srcdir.tip=Place where configure can find sources [configure directory or ..] -Option.configure.localstatedir=Modifiable single-machine data directory (--localstatedir) -Option.configure.localstatedir.tip=Place where modifiable single-machine data is installed [PREFIX/var] -Option.configure.sharedstatedir=Modifiable architecture-independent data directory (--sharedstatedir) -Option.configure.sharedstatedir.tip=Place where modifiable architecture-independent data is installed [PREFIX/com] -Option.configure.libexecdir=Program executable directory (--libexecdir) -Option.configure.libexecdir=Place where program executables will be installed [EPREFIX/libexec] -Option.configure.oldincludedir=Non-gcc C header file directory (--oldincludedir) -Option.configure.oldincludedir.tip=Place where non-gcc C header files are installed [/usr/include] - -OptionCategory.configure.filenames=File-name transformations -Option.configure.program_prefix=Installed program prefix (--program-prefix) -Option.configure.program_prefix.tip=Prepend PREFIX to the beginning of installed program names -Option.configure.program_suffix=Installed program suffix (--program-suffix) -Option.configure.program_suffix.tip=Append SUFFIX to the end of installed program names -Option.configure.program_transform_name=Installed program name transform (--program-transform-name) -Option.configure.program_transform_name.tip=A sed string used to transform installed program names - -OptionCategory.configure.features=Features and packages -Option.configure.enable_maintainer_mode=Enable maintainer mode (--enable-maintainer-mode) -Option.configure.enable_maintainer_mode.tip=Specify this to have Makefiles generated with checks for Autotool configuration file changes -Option.configure.user=User-specified configuration options -Option.configure.user.tip=Specify one or more configuration options (e.g. --enable-FEATURE, --disable-FEATURE, or --with-PACKAGE) - -Tool.autogen = autogen.sh - -OptionCategory.autogen.general=Options -Option.autogen.user=Command line options -Option.autogen.user.tip=Specify options to pass to the top-level autogen.sh script - RedHatVendor.name = Red Hat Bundle-Name.0 = Autotools UI Plug-in provider=Eclipse CDT diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java index b86005f0d7a..cf628dbf052 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java @@ -74,17 +74,18 @@ public abstract class AbstractIndexerTask extends PDOMWriter { public static enum UnusedHeaderStrategy { skip, useC, useCPP, useDefaultLanguage, useBoth } private static final int MAX_ERRORS = 500; + // Order of constants is important. Stronger update types have to precede the weaker ones. private static enum UpdateKind { REQUIRED_SOURCE, REQUIRED_HEADER, ONE_LINKAGE_HEADER, OTHER_HEADER } private static class LinkageTask { final int fLinkageID; private final Map fLocationTasks; - + LinkageTask(int linkageID) { fLinkageID= linkageID; fLocationTasks= new HashMap(); } - + boolean requestUpdate(IIndexFileLocation ifl, IIndexFragmentFile ifile, Object tu, UpdateKind kind, Map oneLinkageTasks) { LocationTask locTask= fLocationTasks.get(ifl); @@ -93,11 +94,11 @@ public abstract class AbstractIndexerTask extends PDOMWriter { fLocationTasks.put(ifl, locTask); } boolean result = locTask.requestUpdate(ifile, tu, kind); - + // Store one-linkage tasks. if (kind == UpdateKind.ONE_LINKAGE_HEADER && locTask.fVersionTasks.isEmpty()) oneLinkageTasks.put(ifl, locTask); - + return result; } @@ -119,9 +120,10 @@ public abstract class AbstractIndexerTask extends PDOMWriter { boolean requestUpdate(IIndexFragmentFile ifile, Object tu, UpdateKind kind) { if (tu != null) fTu= tu; - if (kind != null) + // Change fKind only if it becomes stronger as a result. + if (fKind == null || (kind != null && kind.compareTo(fKind) < 0)) fKind= kind; - + if (ifile == null) { assert fVersionTasks.isEmpty(); final boolean countRequest= !fCountedUnknownVersion; @@ -137,7 +139,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { */ private boolean addVersionTask(IIndexFragmentFile ifile) { FileVersionTask fc= findVersion(ifile); - if (fc != null) + if (fc != null) return false; fc= new FileVersionTask(ifile); @@ -163,7 +165,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } return countRequest; } - + void removeVersionTask(Iterator it) { if (fVersionTasks.size() == 1) { fVersionTasks= Collections.emptyList(); @@ -195,7 +197,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } if (fKind == UpdateKind.OTHER_HEADER) return true; - + return fStoredAVersion; } @@ -215,12 +217,12 @@ public abstract class AbstractIndexerTask extends PDOMWriter { fIndexFile= file; fOutdated= true; } - + void setUpdated() { fOutdated= false; } } - + public static class IndexFileContent { private Object[] fPreprocessingDirectives; private ICPPUsingDirective[] fDirectives; @@ -233,7 +235,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { public Object[] getPreprocessingDirectives() throws CoreException { return fPreprocessingDirectives; } - + public ICPPUsingDirective[] getUsingDirectives() throws CoreException { return fDirectives; } @@ -278,9 +280,9 @@ public abstract class AbstractIndexerTask extends PDOMWriter { return Integer.MAX_VALUE; } } - + protected enum MessageKind { parsingFileTask, errorWhileParsing, tooManyIndexProblems } - + private int fUpdateFlags= IIndexManager.UPDATE_ALL; private UnusedHeaderStrategy fIndexHeadersWithoutContext= UnusedHeaderStrategy.useDefaultLanguage; private boolean fIndexFilesWithoutConfiguration= true; @@ -288,12 +290,12 @@ public abstract class AbstractIndexerTask extends PDOMWriter { private Map fIndexContentCache= new LRUCache(500); private Map fIndexFilesCache= new LRUCache(5000); private Map fOneLinkageTasks= new HashMap(); - + private Object[] fFilesToUpdate; private List fFilesToRemove = new ArrayList(); private int fASTOptions; private int fForceNumberFiles= 0; - + protected IWritableIndex fIndex; private ITodoTaskUpdater fTodoTaskUpdater; private final boolean fIsFastIndexer; @@ -302,7 +304,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { private int fSwallowOutOfMemoryError= 5; /** * A queue of urgent indexing tasks that contribute additional files to this task. - * The files from the urgent tasks are indexed before all not yet processed files. + * The files from the urgent tasks are indexed before all not yet processed files. */ private final LinkedList fUrgentTasks; boolean fTaskCompleted; @@ -317,7 +319,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { incrementRequestedFilesCount(fFilesToUpdate.length + fFilesToRemove.size()); fUrgentTasks = new LinkedList(); } - + public final void setIndexHeadersWithoutContext(UnusedHeaderStrategy mode) { fIndexHeadersWithoutContext= mode; } @@ -353,7 +355,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { if (!(urgentTask instanceof AbstractIndexerTask)) { return false; } - AbstractIndexerTask task = (AbstractIndexerTask) urgentTask; + AbstractIndexerTask task = (AbstractIndexerTask) urgentTask; if (task.fIsFastIndexer != fIsFastIndexer || task.fIndexFilesWithoutConfiguration != fIndexFilesWithoutConfiguration || (fIndexFilesWithoutConfiguration && task.fIndexHeadersWithoutContext != fIndexHeadersWithoutContext) || @@ -369,7 +371,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { fUrgentTasks.add(task); return true; } - + private synchronized boolean hasUrgentTasks() { return !fUrgentTasks.isEmpty(); } @@ -389,7 +391,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { protected ITodoTaskUpdater createTodoTaskUpdater() { return null; } - + /** * @return array of linkage IDs that shall be parsed */ @@ -443,7 +445,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { fInfo.fCompletedHeaders += header; } } - + private final void reportFile(boolean wasCounted, UpdateKind kind) { if (wasCounted) { if (kind == UpdateKind.REQUIRED_SOURCE) { @@ -470,13 +472,13 @@ public abstract class AbstractIndexerTask extends PDOMWriter { if (!fIndexFilesWithoutConfiguration) { fIndexHeadersWithoutContext= UnusedHeaderStrategy.skip; } - + fIndex= createIndex(); if (fIndex == null) { return; } fTodoTaskUpdater= createTodoTaskUpdater(); - + fASTOptions= ILanguage.OPTION_NO_IMAGE_LOCATIONS | ILanguage.OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS; if (getSkipReferences() == SKIP_ALL_REFERENCES) { @@ -485,16 +487,16 @@ public abstract class AbstractIndexerTask extends PDOMWriter { fIndex.resetCacheCounters(); fIndex.acquireReadLock(); - + try { try { // Split into sources and headers, remove excluded sources. HashMap> files= new HashMap>(); final ArrayList indexFilesToRemove= new ArrayList(); extractFiles(files, indexFilesToRemove, monitor); - - setResume(true); - + + setResume(true); + // Remove files from index removeFilesInIndex(fFilesToRemove, indexFilesToRemove, monitor); @@ -540,7 +542,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } else { list.addAll(0, entry.getValue()); } - } + } } // Extract files from the urgent task. files = new HashMap>(); @@ -573,7 +575,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { private void setResume(boolean value) throws InterruptedException, CoreException { fIndex.acquireWriteLock(); try { - fIndex.getWritableFragment().setProperty(IIndexFragment.PROPERTY_RESUME_INDEXER, String.valueOf(value)); + fIndex.getWritableFragment().setProperty(IIndexFragment.PROPERTY_RESUME_INDEXER, String.valueOf(value)); } finally { fIndex.releaseWriteLock(); } @@ -597,7 +599,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { final IIndexFileLocation ifl= fResolver.resolveFile(tu); if (ifl == null) continue; - + final IIndexFragmentFile[] indexFiles= fIndex.getWritableFiles(ifl); final boolean isSourceUnit= fResolver.isSourceUnit(tu); linkages.clear(); @@ -605,7 +607,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { final boolean indexedUnconditionally = fResolver.isIndexedUnconditionally(ifl); if (regularContent || indexedUnconditionally) { // Headers or sources required with a specific linkage - final UpdateKind updateKind = isSourceUnit ? UpdateKind.REQUIRED_SOURCE + final UpdateKind updateKind = isSourceUnit ? UpdateKind.REQUIRED_SOURCE : regularContent && both ? UpdateKind.REQUIRED_HEADER : UpdateKind.ONE_LINKAGE_HEADER; if (regularContent || indexFiles.length == 0) { AbstractLanguage[] langs= fResolver.getLanguages(tu, fIndexHeadersWithoutContext); @@ -633,12 +635,12 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } } } - + // Handle other files present in index. for (IIndexFragmentFile ifile : indexFiles) { if (ifile != null) { IIndexInclude ctx= ifile.getParsedInContext(); - if (ctx == null && !indexedUnconditionally) { + if (ctx == null && !indexedUnconditionally && ifile.hasContent()) { iFilesToRemove.add(ifile); count++; } else { @@ -674,13 +676,13 @@ public abstract class AbstractIndexerTask extends PDOMWriter { private boolean isRequiredInIndex(Object tu, IIndexFileLocation ifl, boolean isSourceUnit) { // External files are never required - if (fResolver.isIndexedOnlyIfIncluded(tu)) + if (fResolver.isIndexedOnlyIfIncluded(tu)) return false; - + // User preference to require all if (fIndexHeadersWithoutContext != UnusedHeaderStrategy.skip) return true; - + // Source file if (isSourceUnit) { if (fIndexFilesWithoutConfiguration || fResolver.isFileBuildConfigured(tu)) @@ -692,7 +694,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { private boolean isModified(boolean checkTimestamps, boolean checkFileContentsHash, IIndexFileLocation ifl, Object tu, IIndexFragmentFile file) throws CoreException { if (checkTimestamps) { - if (fResolver.getLastModified(ifl) != file.getTimestamp() || + if (fResolver.getLastModified(ifl) != file.getTimestamp() || computeFileSizeAndEncodingHashcode(ifl) != file.getSizeAndEncodingHashcode()) { if (checkFileContentsHash && computeFileContentsHash(tu) == file.getContentsHash()) { return false; @@ -712,7 +714,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { LinkageTask fileMap= createRequestMap(linkageID); return fileMap.requestUpdate(ifl, ifile, tu, kind, fOneLinkageTasks); } - + private LinkageTask createRequestMap(int linkageID) { LinkageTask map= findRequestMap(linkageID); if (map == null) { @@ -729,7 +731,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } return null; } - + @Override protected void reportFileWrittenToIndex(FileInAST file, IIndexFragmentFile ifile) throws CoreException { final FileContentKey fck = file.fileContentKey; @@ -756,7 +758,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } fIndexContentCache.remove(ifile); fIndexFilesCache.remove(file.fileContentKey.getLocation()); - + LocationTask task= fOneLinkageTasks.remove(location); if (task != null && task != locTask) { if (task.fKind == UpdateKind.ONE_LINKAGE_HEADER && !task.isCompleted()) { @@ -805,13 +807,13 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } filesToRemove.clear(); } - + private void parseLinkage(int linkageID, List files, IProgressMonitor monitor) throws CoreException, InterruptedException { LinkageTask map = findRequestMap(linkageID); if (map == null || files == null || files.isEmpty()) return; - + // First parse the required sources for (Iterator it= files.iterator(); it.hasNext();) { IIndexFileLocation ifl= it.next(); @@ -826,7 +828,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { parseFile(tu, getLanguage(tu, linkageID), ifl, scannerInfo, null, monitor); } } - + // Files with context for (Iterator it= files.iterator(); it.hasNext();) { IIndexFileLocation ifl= it.next(); @@ -844,7 +846,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } } } - + // Files without context for (Iterator it= files.iterator(); it.hasNext();) { IIndexFileLocation ifl= it.next(); @@ -860,7 +862,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { parseFile(tu, getLanguage(tu, linkageID), ifl, scannerInfo, null, monitor); if (locTask.isCompleted()) it.remove(); - + } } } @@ -874,7 +876,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { if (!locTask.needsVersion()) { if (monitor.isCanceled() || hasUrgentTasks()) return; - Iterator it= locTask.fVersionTasks.iterator(); + Iterator it= locTask.fVersionTasks.iterator(); while (it.hasNext()) { FileVersionTask v = it.next(); if (v.fOutdated) { @@ -897,18 +899,18 @@ public abstract class AbstractIndexerTask extends PDOMWriter { final FileVersionTask versionTask, Object tu, LinkedHashSet safeGuard, IProgressMonitor monitor) throws CoreException, InterruptedException { final IIndexFragmentFile headerFile = versionTask.fIndexFile; - + final int safeguardSize= safeGuard.size(); - for(;;) { + while (true) { // Look for a context and parse the file IIndexFragmentFile ctxFile = findContextFile(linkageID, map, versionTask, safeGuard, monitor); - if (ctxFile == null || ctxFile == headerFile) + if (ctxFile == null || ctxFile == headerFile) return; - + Object contextTu= fResolver.getInputFile(ctxFile.getLocation()); - if (contextTu == null) + if (contextTu == null) return; - + final IScannerInfo scannerInfo= fResolver.getBuildConfiguration(linkageID, contextTu); final AbstractLanguage language = getLanguage(contextTu, linkageID); final FileContext ctx= new FileContext(ctxFile, headerFile); @@ -926,14 +928,14 @@ public abstract class AbstractIndexerTask extends PDOMWriter { if (parseFile(d.fTu, language, d.fIndexFile.getLocation(), scannerInfo, new FileContext(ctxFile, d.fIndexFile), monitor) == null) done= false; } - } - } - if (!ctx.fLostPragmaOnceSemantics) + } + } + if (!ctx.fLostPragmaOnceSemantics) return; // Try the next context restoreSet(safeGuard, safeguardSize); - } + } } private void restoreSet(LinkedHashSet set, int restoreSize) { @@ -943,7 +945,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { it.remove(); } else { restoreSize--; - } + } } } @@ -951,19 +953,19 @@ public abstract class AbstractIndexerTask extends PDOMWriter { final FileVersionTask versionTask, LinkedHashSet safeGuard, IProgressMonitor monitor) throws CoreException, InterruptedException { IIndexFragmentFile ctxFile= versionTask.fIndexFile; - for(;;) { + while (true) { IIndexInclude ctxInclude= ctxFile.getParsedInContext(); - if (ctxInclude == null) + if (ctxInclude == null) return ctxFile; IIndexFragmentFile nextCtx= (IIndexFragmentFile) ctxInclude.getIncludedBy(); - if (nextCtx == null) + if (nextCtx == null) return nextCtx; - // Found a recursion - if (!safeGuard.add(nextCtx)) + // Found a recursion. + if (!safeGuard.add(nextCtx)) return null; - + final IIndexFileLocation ctxIfl = nextCtx.getLocation(); LocationTask ctxTask= map.find(ctxIfl); if (ctxTask != null) { @@ -984,7 +986,6 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } } - private DependsOnOutdatedFileException parseFile(Object tu, AbstractLanguage lang, IIndexFileLocation ifl, IScannerInfo scanInfo, FileContext ctx, IProgressMonitor pm) throws CoreException, InterruptedException { @@ -1035,7 +1036,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } return null; } - + private IPath getLabel(IIndexFileLocation ifl) { String fullPath= ifl.getFullPath(); if (fullPath != null) { @@ -1061,7 +1062,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { if (CCorePlugin.PLUGIN_ID.equals(s.getPlugin())) throw (CoreException) e; } - + // mask errors in order to avoid dialog from platform Throwable exception = s.getException(); if (exception != null) { @@ -1070,7 +1071,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { e= masked; exception= null; } - } + } if (exception == null) { s= new Status(s.getSeverity(), s.getPlugin(), s.getCode(), s.getMessage(), e); } @@ -1102,7 +1103,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } if (fFileSizeLimit > 0 && fResolver.getFileSize(codeReader.getFileLocation()) > fFileSizeLimit) { if (fShowActivity) { - trace("Indexer: Skipping large file " + codeReader.getFileLocation()); //$NON-NLS-1$ + trace("Indexer: Skipping large file " + codeReader.getFileLocation()); //$NON-NLS-1$ } return null; } @@ -1124,7 +1125,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { ibfcp.setContextToHeaderGap(ctx2header); ibfcp.setLinkage(language.getLinkageID()); } - + IASTTranslationUnit ast= language.getASTTranslationUnit(codeReader, scanInfo, fCodeReaderFactory, fIndex, options, getLogService()); if (pm.isCanceled()) { @@ -1137,7 +1138,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { final IncludeFileContentProvider fileContentProvider = createReaderFactory(); if (fileContentProvider instanceof InternalFileContentProvider) return (InternalFileContentProvider) fileContentProvider; - + throw new IllegalArgumentException("Invalid file content provider"); //$NON-NLS-1$ } @@ -1145,7 +1146,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { FileContext ctx, IProgressMonitor pm) throws CoreException, InterruptedException { HashSet enteredFiles= new HashSet(); ArrayList orderedFileKeys= new ArrayList(); - + final IIndexFileLocation topIfl = fResolver.resolveASTPath(ast.getFilePath()); FileContentKey topKey = new FileContentKey(linkageID, topIfl, ast.getSignificantMacros()); enteredFiles.add(topKey); @@ -1154,7 +1155,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { for (IASTInclusionNode inclusion : inclusions) { collectOrderedFileKeys(linkageID, inclusion, enteredFiles, orderedFileKeys); } - + IIndexFragmentFile newFile= selectIndexFile(linkageID, topIfl, ast.getSignificantMacros()); if (ctx != null) { orderedFileKeys.add(new FileInAST(topKey, codeReader)); @@ -1163,7 +1164,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } else if (newFile == null) { orderedFileKeys.add(new FileInAST(topKey, codeReader)); } - + FileInAST[] fileKeys= orderedFileKeys.toArray(new FileInAST[orderedFileKeys.size()]); try { addSymbols(ast, fileKeys, fIndex, false, ctx, fTodoTaskUpdater, pm); @@ -1237,7 +1238,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } return fc; } - + IIndexFragmentFile selectIndexFile(int linkageID, IIndexFileLocation ifl, ISignificantMacros sigMacros) throws CoreException { LinkageTask map = findRequestMap(linkageID); if (map != null) { @@ -1249,7 +1250,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } } } - + IIndexFragmentFile[] files = getAvailableIndexFiles(linkageID, ifl); for (IIndexFragmentFile file : files) { if (sigMacros.equals(file.getSignificantMacros())) @@ -1273,7 +1274,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } } } - + IIndexFile[] files = getAvailableIndexFiles(linkageID, ifl); for (IIndexFile indexFile : files) { if (md.satisfies(indexFile.getSignificantMacros())) { @@ -1301,7 +1302,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { } else { files= new IIndexFragmentFile[j]; System.arraycopy(fragFiles, 0, files, 0, j); - } + } fIndexFilesCache.put(ifl, files); } return files; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMSetupJob.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMSetupJob.java index a1e97008979..115c594845f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMSetupJob.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMSetupJob.java @@ -38,7 +38,7 @@ public class PDOMSetupJob extends Job { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask("", IProgressMonitor.UNKNOWN); //$NON-NLS-1$ - while(true) { + while (true) { ICProject cproject= fManager.getNextProject(); if (cproject == null) return Status.OK_STATUS; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java index bcdc654fe9f..bba355b670d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java @@ -107,13 +107,13 @@ abstract public class PDOMWriter { return fileContentKey.toString(); } } - + public static class FileContext { final IIndexFragmentFile fContext; final IIndexFragmentFile fOldFile; IIndexFragmentFile fNewFile; public boolean fLostPragmaOnceSemantics; - + public FileContext(IIndexFragmentFile context, IIndexFragmentFile oldFile) { fContext= context; fOldFile= oldFile; @@ -132,7 +132,7 @@ abstract public class PDOMWriter { final ArrayList fMacros= new ArrayList(); final ArrayList fIncludes= new ArrayList(); } - + private static class Data { final IASTTranslationUnit fAST; final FileInAST[] fSelectedFiles; @@ -140,7 +140,7 @@ abstract public class PDOMWriter { final Map fSymbolMap = new HashMap(); final Set fContextIncludes = new HashSet(); final List fStati= new ArrayList(); - + public Data(IASTTranslationUnit ast, FileInAST[] selectedFiles, IWritableIndex index) { fAST= ast; fSelectedFiles= selectedFiles; @@ -202,8 +202,8 @@ abstract public class PDOMWriter { /** * Extracts symbols from the given AST and adds them to the index. - * - * When flushIndex is set to false, you must make sure to flush + * + * When flushIndex is set to false, you must make sure to flush * the index after your last write operation. */ final protected void addSymbols(IASTTranslationUnit ast, FileInAST[] selectedFiles, @@ -215,23 +215,22 @@ abstract public class PDOMWriter { fShowScannerProblems= true; fShowSyntaxProblems= true; } - + Data data= new Data(ast, selectedFiles, index); for (FileInAST file : selectedFiles) { data.fSymbolMap.put(file.includeStatement, new Symbols()); } - - // Extract symbols from AST + // Extract symbols from AST. extractSymbols(data); - // Name resolution + // Name resolution. resolveNames(data, pm); - // Index update + // Index update. storeSymbolsInIndex(data, ctx, flushIndex, pm); - // Tasks update + // Tasks update. if (taskUpdater != null) { Set locations= new HashSet(); for (FileInAST file : selectedFiles) { @@ -283,8 +282,8 @@ abstract public class PDOMWriter { if (!isReplacement || newFile == null) { ifile= storeFileInIndex(data, fileInAST, linkageID, lock); reportFileWrittenToIndex(fileInAST, ifile); - } - + } + if (isReplacement) { if (ifile == null) ifile= newFile; @@ -297,7 +296,7 @@ abstract public class PDOMWriter { data.fIndex.transferIncluders(ctx.fOldFile, ifile); } } - } + } } catch (RuntimeException e) { th= e; } catch (StackOverflowError e) { @@ -538,13 +537,13 @@ abstract public class PDOMWriter { // if another thread is waiting for a read lock. final FileContentKey fileKey = astFile.fileContentKey; final IASTPreprocessorIncludeStatement owner= astFile.includeStatement; - + IIndexFileLocation location = fileKey.getLocation(); ISignificantMacros significantMacros = fileKey.getSignificantMacros(); IIndexFragmentFile oldFile = index.getWritableFile(linkageID, location, significantMacros); file= index.addUncommittedFile(linkageID, location, significantMacros); try { - boolean pragmaOnce= owner != null ? owner.hasPragmaOnceSemantics() : data.fAST.hasPragmaOnceSemantics(); + boolean pragmaOnce= owner != null ? owner.hasPragmaOnceSemantics() : data.fAST.hasPragmaOnceSemantics(); file.setPragmaOnceSemantics(pragmaOnce); Symbols lists= data.fSymbolMap.get(owner); @@ -571,7 +570,7 @@ abstract public class PDOMWriter { includeInfos.add(new IncludeInformation(stmt, targetLoc, sig, false)); } } - final boolean isContext = stmt.isActive() && stmt.isResolved() && + final boolean isContext = stmt.isActive() && stmt.isResolved() && (data.fContextIncludes.contains(stmt) || isContextFor(oldFile, stmt)); includeInfos.add(new IncludeInformation(stmt, targetLoc, mainSig, isContext)); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java index 97de48f8931..d4dd71a7069 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java @@ -200,6 +200,7 @@ import org.eclipse.cdt.ui.text.folding.ICFoldingStructureProvider; import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable; import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences; +import org.eclipse.cdt.internal.corext.util.CModelUtil; import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil; import org.eclipse.cdt.internal.ui.CPluginImages; @@ -1286,11 +1287,11 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi try { IIndexManager indexManager = CCorePlugin.getIndexManager(); if (tuToReset != null) { - indexManager.update(new ICElement[] { tuToReset }, + indexManager.update(new ICElement[] { CModelUtil.toOriginal(tuToReset) }, IIndexManager.RESET_INDEX_INCLUSION | IIndexManager.UPDATE_CHECK_TIMESTAMPS); } if (tuToAdd != null) { - indexManager.update(new ICElement[] { tuToAdd }, + indexManager.update(new ICElement[] { CModelUtil.toOriginal(tuToAdd) }, IIndexManager.FORCE_INDEX_INCLUSION | IIndexManager.UPDATE_CHECK_TIMESTAMPS); } } catch (CoreException e) { diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolAction.java index 16a683cce03..47c68452f22 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolAction.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/ExternalToolAction.java @@ -12,7 +12,6 @@ package org.eclipse.cdt.debug.ui.breakpointactions; import java.io.ByteArrayOutputStream; import java.io.StringReader; -import com.ibm.icu.text.MessageFormat; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -31,22 +30,46 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.MultiStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.ui.progress.WorkbenchJob; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.InputSource; import org.xml.sax.helpers.DefaultHandler; +import com.ibm.icu.text.MessageFormat; + public class ExternalToolAction extends AbstractBreakpointAction { private String externalToolName = ""; //$NON-NLS-1$ - @Override - public IStatus execute(IBreakpoint breakpoint, IAdaptable context, IProgressMonitor monitor) { + @Override + public IStatus execute(final IBreakpoint breakpoint, final IAdaptable context, final IProgressMonitor monitor) { + Job uiJob = new WorkbenchJob("ExternalToolAction") { //$NON-NLS-1$ + { + setPriority(INTERACTIVE); + } + + @Override + public IStatus runInUIThread(IProgressMonitor monitor) { + return executeInUIThread(breakpoint, context, monitor); + } + }; + uiJob.schedule(); + try { + uiJob.join(); + } catch (InterruptedException e) { + return Status.CANCEL_STATUS; + } + return uiJob.getResult(); + } + + private IStatus executeInUIThread(IBreakpoint breakpoint, IAdaptable context, IProgressMonitor monitor) { IStatus errorStatus = null; ILaunchManager lcm = DebugPlugin.getDefault().getLaunchManager(); try { diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/AbstractBreakpointVMNode.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/AbstractBreakpointVMNode.java index 1629846ed50..2d8f2cbec60 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/AbstractBreakpointVMNode.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/AbstractBreakpointVMNode.java @@ -50,7 +50,7 @@ public abstract class AbstractBreakpointVMNode extends AbstractVMNode { /** * Class that creates the element object for the corresponding breakpoints. - * This element object will be populated in the breakpoitns view to represent + * This element object will be populated in the breakpoints view to represent * the given breakpoint. */ abstract protected Object createBreakpiontElement(IBreakpoint bp); diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/BreakpointVMNode.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/BreakpointVMNode.java index 67dda5908d7..5d495111d8d 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/BreakpointVMNode.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/BreakpointVMNode.java @@ -31,7 +31,7 @@ import org.eclipse.swt.graphics.RGB; import org.eclipse.ui.IMemento; /** - * Breakpiont VM Node which uses VM Contexts to populate breakpoint elements + * Breakpoint VM Node which uses VM Contexts to populate breakpoint elements * in the view. Any actions or other selection listeners which depend on the * breakpoint object will not work with these elements unless they use the * adapter mechanism to obtain the breakpoints. diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/BreakpointVMProvider.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/BreakpointVMProvider.java index 8dca8d2f91b..cf19236841c 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/BreakpointVMProvider.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/BreakpointVMProvider.java @@ -24,7 +24,6 @@ import org.eclipse.cdt.dsf.concurrent.RequestMonitor; import org.eclipse.cdt.dsf.datamodel.DMContexts; import org.eclipse.cdt.dsf.datamodel.IDMContext; import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext; -import org.eclipse.cdt.dsf.debug.ui.viewmodel.expression.IExpressionVMNode; import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin; import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMAdapter; import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMProvider; @@ -58,15 +57,8 @@ import org.eclipse.jface.viewers.TreePath; import org.eclipse.ui.IWorkbenchWindow; /** - * The expression provider is used to populate the contents of the expressions - * view. The node hierarchy in this view is a little different than in a typical - * provider: the expression manager node should be registered as the single child - * of the root node and no nodes should be registered as children of expression node. - * Instead the top level expression nodes should be registered with a call to - * {@link #setExpressionNodes(IExpressionVMNode[])}. And each expression node can - * have its own sub-hierarchy of elements as needed. However all nodes configured - * with this provider (with the exception of the root and the expression manager) - * should implement {@link IExpressionVMNode}. + * The breakpoint provider is used to populate the contents of the breakpoints + * view. * * @since 2.1 */ diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/DataCache.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/DataCache.java index 521de3616d3..69f397befd4 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/DataCache.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/DataCache.java @@ -98,7 +98,7 @@ abstract class DataCache { } /** - * Request data from the cache. The cache is valid, it will complete the + * Request data from the cache. If the cache is valid, it will complete the * request immediately, otherwise data will first be retrieved from the * source. * @param req diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/RawBreakpointVMNode.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/RawBreakpointVMNode.java index 1e5fd044303..cc4f83a3cd5 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/RawBreakpointVMNode.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/breakpoints/RawBreakpointVMNode.java @@ -13,7 +13,7 @@ package org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints; import org.eclipse.debug.core.model.IBreakpoint; /** - * Breakpoint node which uses raw breakpiont objects (without a wrapper) as + * Breakpoint node which uses raw breakpoint objects (without a wrapper) as * elements which are populated into the view. The breakpoint objects are * responsible for supplying their own label and memento providers, as well * as content provider for any children. diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IBreakpointsExtension.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IBreakpointsExtension.java index 56cfaec6f96..f484befb0e5 100644 --- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IBreakpointsExtension.java +++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IBreakpointsExtension.java @@ -34,7 +34,7 @@ public interface IBreakpointsExtension extends IBreakpoints { } /** - * If a given execution context was suspended due hitting a breakpoint, + * If a given execution context was suspended due to hitting a breakpoint, * this method should return the breakpoints which caused the thread or * container to suspend. *