Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsBuildConfiguration.java4
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/META-INF/MANIFEST.MF2
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/regressions/Bug_580441Test.java70
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF2
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu2/GnuMakefileGenerator.java7
-rw-r--r--build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/MesonBuildConfiguration.java8
-rw-r--r--cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java15
-rwxr-xr-xcore/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/pty.dllbin1039023 -> 1039023 bytes
-rwxr-xr-xcore/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dllbin335938 -> 335938 bytes
-rwxr-xr-xcore/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/starter.exebin403406 -> 403406 bytes
-rw-r--r--core/org.eclipse.cdt.core/META-INF/MANIFEST.MF2
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java150
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java17
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java107
-rwxr-xr-xnative/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dllbin379016 -> 379016 bytes
-rw-r--r--qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java24
-rw-r--r--releng/org.eclipse.cdt.target/cdt.target4
18 files changed, 213 insertions, 205 deletions
diff --git a/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsBuildConfiguration.java b/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsBuildConfiguration.java
index f6497540771..4dc47efb12f 100644
--- a/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsBuildConfiguration.java
+++ b/build/org.eclipse.cdt.core.autotools.core/src/org/eclipse/cdt/core/autotools/core/AutotoolsBuildConfiguration.java
@@ -106,7 +106,7 @@ public class AutotoolsBuildConfiguration extends CBuildConfiguration {
try {
// TODO Error parsers
Process process = builder.start();
- watchProcess(process, console);
+ watchProcess(console, monitor);
} catch (IOException e) {
throw new CoreException(Activator.errorStatus("Error executing: " + String.join(" ", command), e)); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -153,7 +153,7 @@ public class AutotoolsBuildConfiguration extends CBuildConfiguration {
Activator.errorStatus("Error executing: " + String.join(" ", command), null)); //$NON-NLS-1$ //$NON-NLS-2$
}
- watchProcess(p, new IConsoleParser[] { epm });
+ watchProcess(new IConsoleParser[] { epm }, monitor);
}
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.managedbuilder.core.tests/META-INF/MANIFEST.MF
index 9d06cc089b6..ccd8ad9d5b8 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/META-INF/MANIFEST.MF
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core.tests; singleton:=true
-Bundle-Version: 8.2.200.qualifier
+Bundle-Version: 8.2.300.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.testplugin.CTestPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/regressions/Bug_580441Test.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/regressions/Bug_580441Test.java
new file mode 100644
index 00000000000..c5dbe8f8852
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/regressions/Bug_580441Test.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2022 Broadcom Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Broadcom Corporation - Bug 303953 test
+ * John Dallaway - Initial implementation (derived from bug 303953 test)
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.core.regressions;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.io.ByteArrayInputStream;
+
+import org.eclipse.cdt.managedbuilder.testplugin.AbstractBuilderTest;
+import org.eclipse.core.resources.IBuildConfiguration;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Test that removal of a directory containing source file(s) is
+ * processed correctly by the default GnuMakefileGenerator.
+ */
+public class Bug_580441Test extends AbstractBuilderTest {
+
+ @Test
+ public void testBuildAfterPopulatedSourceFolderDelete() throws CoreException {
+ setWorkspace("regressions");
+ final IProject app = loadProject("helloworldC");
+
+ // Create additional source file at src/test/test.c
+ final IFolder testFolder = app.getFolder("src/test");
+ testFolder.create(false, false, null);
+ testFolder.getFile("test.c").create(new ByteArrayInputStream("int test;".getBytes()), false, null);
+
+ // Build debug configuration
+ setActiveConfigurationByName(app, "Debug");
+ buildConfig(app.getActiveBuildConfig());
+ assertTrue(app.getFile("Debug/src/test/test.o").exists(), "test.o not created");
+
+ // Delete folder containing test.c and build again
+ testFolder.delete(false, null);
+ buildConfig(app.getActiveBuildConfig());
+ assertFalse(app.getFolder("Debug/src/test").exists(), "test folder not deleted");
+ }
+
+ private void buildConfig(IBuildConfiguration config) throws CoreException {
+ ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ ResourcesPlugin.getWorkspace().build(new IBuildConfiguration[] { config },
+ IncrementalProjectBuilder.INCREMENTAL_BUILD, true, monitor);
+ }
+ }, null);
+ }
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF
index bb7707b45a0..e83988ef44e 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF
+++ b/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core; singleton:=true
-Bundle-Version: 9.4.0.qualifier
+Bundle-Version: 9.4.100.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu2/GnuMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu2/GnuMakefileGenerator.java
index c1e3d3e71d3..327551719ca 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu2/GnuMakefileGenerator.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu2/GnuMakefileGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2016 IBM Corporation and others.
+ * Copyright (c) 2003, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -17,6 +17,7 @@
* Marc-Andre Laperle
* Liviu Ionescu - [322168]
* Dorothea Pilz-Roeder (Advantest Europe GmbH) - [180451]
+ * John Dallaway - [580441] fix processing on source folder deletion
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.makegen.gnu2;
@@ -192,7 +193,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// This is a source file so just add its container
if (fo == null || fo.buildsFileType(ext)) {
generator.appendDeletedFile(resource);
- generator.appendModifiedSubdirectory(resource);
+ if (resource.getParent().exists()) {
+ generator.appendModifiedSubdirectory(resource);
+ }
}
}
break;
diff --git a/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/MesonBuildConfiguration.java b/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/MesonBuildConfiguration.java
index dc33eb56228..0be025a4838 100644
--- a/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/MesonBuildConfiguration.java
+++ b/build/org.eclipse.cdt.meson.core/src/org/eclipse/cdt/internal/meson/core/MesonBuildConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015, 2018 QNX Software Systems and others.
+ * Copyright (c) 2015, 2022 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -183,7 +183,7 @@ public class MesonBuildConfiguration extends CBuildConfiguration {
return null;
}
- watchProcess(p, console);
+ watchProcess(console, monitor);
}
if (!Files.exists(buildDir.resolve("build.ninja"))) { //$NON-NLS-1$
@@ -238,7 +238,7 @@ public class MesonBuildConfiguration extends CBuildConfiguration {
return null;
}
- watchProcess(p, new IConsoleParser[] { epm });
+ watchProcess(new IConsoleParser[] { epm }, monitor);
}
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
@@ -298,7 +298,7 @@ public class MesonBuildConfiguration extends CBuildConfiguration {
return;
}
- watchProcess(p, console);
+ watchProcess(console, monitor);
}
outStream.write(String.format(Messages.MesonBuildConfiguration_BuildingComplete, buildDir.toString()));
diff --git a/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java b/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
index 4b39dc5a911..0827caca307 100644
--- a/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
+++ b/cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015, 2016 QNX Software Systems and others.
+ * Copyright (c) 2015, 2022 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -175,9 +175,6 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
ParsingConsoleOutputStream errStream = new ParsingConsoleOutputStream(console.getErrorStream(),
errorParser);
IConsole errConsole = new CMakeConsoleWrapper(console, errStream);
- // TODO startBuildProcess() calls java.lang.ProcessBuilder.
- // Use org.eclipse.cdt.core.ICommandLauncher
- // in order to run builds in a container.
Process p = startBuildProcess(command.getArguments(), new IEnvironmentVariable[0], workingDir,
errConsole, monitor);
String arg0 = command.getArguments().get(0);
@@ -190,7 +187,7 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
}
// check cmake exit status
- final int exitValue = watchProcess(p, errConsole);
+ final int exitValue = watchProcess(errConsole, monitor);
if (exitValue != 0) {
// cmake had errors...
String msg = String.format(Messages.CMakeBuildConfiguration_ExitFailure, arg0, exitValue);
@@ -230,8 +227,6 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
org.eclipse.core.runtime.Path workingDir = new org.eclipse.core.runtime.Path(
getBuildDirectory().toString());
- // TODO startBuildProcess() calls java.lang.ProcessBuilder. Use org.eclipse.cdt.core.ICommandLauncher
- // in order to run builds in a container.
// TODO pass envvars from CommandDescriptor once we use ICommandLauncher
Process p = startBuildProcess(command, envVars.toArray(new IEnvironmentVariable[0]), workingDir,
console, monitor);
@@ -241,7 +236,7 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
}
// check exit status
- final int exitValue = watchProcess(p, new IConsoleParser[] { epm });
+ final int exitValue = watchProcess(new IConsoleParser[] { epm }, monitor);
if (exitValue != 0) {
// had errors...
String msg2 = String.format(Messages.CMakeBuildConfiguration_ExitFailure, command.get(0),
@@ -286,8 +281,6 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
org.eclipse.core.runtime.Path workingDir = new org.eclipse.core.runtime.Path(
getBuildDirectory().toString());
- // TODO startBuildProcess() calls java.lang.ProcessBuilder. Use org.eclipse.cdt.core.ICommandLauncher
- // in order to run builds in a container.
Process p = startBuildProcess(command.getArguments(), new IEnvironmentVariable[0], workingDir, console,
monitor);
if (p == null) {
@@ -299,7 +292,7 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
}
// check exit status
- final int exitValue = watchProcess(p, console);
+ final int exitValue = watchProcess(console, monitor);
if (exitValue != 0) {
// had errors...
String msg = String.format(Messages.CMakeBuildConfiguration_ExitFailure, command.getArguments().get(0),
diff --git a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/pty.dll b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/pty.dll
index 71f3f1e8a77..db374f73310 100755
--- a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/pty.dll
+++ b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/pty.dll
Binary files differ
diff --git a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dll b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dll
index 4a0984f5e0d..00b9a5c003d 100755
--- a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dll
+++ b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/spawner.dll
Binary files differ
diff --git a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/starter.exe b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/starter.exe
index 1da0d377ee1..f66b4210461 100755
--- a/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/starter.exe
+++ b/core/org.eclipse.cdt.core.win32.x86_64/os/win32/x86_64/starter.exe
Binary files differ
diff --git a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
index 6224785337c..bc52049ddfe 100644
--- a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true
-Bundle-Version: 7.4.200.qualifier
+Bundle-Version: 7.5.0.qualifier
Bundle-Activator: org.eclipse.cdt.core.CCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
index 68e5c472eea..039e1a4518b 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
@@ -10,15 +10,10 @@
*******************************************************************************/
package org.eclipse.cdt.core.build;
-import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.PrintStream;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.InvalidPathException;
@@ -33,9 +28,11 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
+import java.util.stream.Collectors;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CommandLauncherManager;
+import org.eclipse.cdt.core.ICommandLauncher;
import org.eclipse.cdt.core.IConsoleParser;
import org.eclipse.cdt.core.IConsoleParser2;
import org.eclipse.cdt.core.IMarkerGenerator;
@@ -60,6 +57,8 @@ import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
import org.eclipse.cdt.core.resources.IConsole;
+import org.eclipse.cdt.internal.core.BuildRunnerHelper;
+import org.eclipse.cdt.internal.core.ConsoleOutputSniffer;
import org.eclipse.cdt.internal.core.build.Messages;
import org.eclipse.cdt.internal.core.model.BinaryRunner;
import org.eclipse.cdt.internal.core.model.CModelManager;
@@ -116,6 +115,8 @@ public abstract class CBuildConfiguration extends PlatformObject implements ICBu
private final Map<IResource, List<IScannerInfoChangeListener>> scannerInfoListeners = new HashMap<>();
private ScannerInfoCache scannerInfoCache;
+ private ICommandLauncher launcher;
+
protected CBuildConfiguration(IBuildConfiguration config, String name) throws CoreException {
this.config = config;
this.name = name;
@@ -488,7 +489,8 @@ public abstract class CBuildConfiguration extends PlatformObject implements ICBu
.write(String.format(Messages.CBuildConfiguration_CommandNotFound, commands.get(0)));
return null;
}
- commands.set(0, commandPath.toString());
+ IPath cmd = new org.eclipse.core.runtime.Path(commandPath.toString());
+ List<String> args = commands.subList(1, commands.size());
// check if includes have been removed/refreshed and scanner info refresh is needed
boolean needRefresh = CommandLauncherManager.getInstance().checkIfIncludesChanged(this);
@@ -497,18 +499,28 @@ public abstract class CBuildConfiguration extends PlatformObject implements ICBu
t.setProperty(NEED_REFRESH, Boolean.valueOf(needRefresh).toString());
}
- ProcessBuilder processBuilder = new ProcessBuilder(commands).directory(buildDirectory.toFile());
- // Override environment variables
- Map<String, String> environment = processBuilder.environment();
+ // Generate environment block before launching process
+ launcher = CommandLauncherManager.getInstance().getCommandLauncher(this);
+ Properties envProps = launcher.getEnvironment();
+ HashMap<String, String> environment = envProps.entrySet().stream()
+ .collect(Collectors.toMap(e -> String.valueOf(e.getKey()), e -> String.valueOf(e.getValue()),
+ (prev, next) -> next, HashMap::new));
for (IEnvironmentVariable envVar : envVars) {
environment.put(envVar.getName(), envVar.getValue());
}
setBuildEnvironment(environment);
- process = processBuilder.start();
+ launcher.setProject(getProject());
+ process = launcher.execute(cmd, args.toArray(new String[0]), BuildRunnerHelper.envMapToEnvp(environment),
+ buildDirectory, monitor);
}
return process;
}
+ /**
+ * @return The exit code of the build process.
+ *
+ * @deprecated use {@link #watchProcess(IConsole, IProgressMonitor)} or {@link #watchProcess(IConsoleParser[], IProgressMonitor)} instead
+ */
@Deprecated
protected int watchProcess(Process process, IConsoleParser[] consoleParsers, IConsole console)
throws CoreException {
@@ -520,110 +532,42 @@ public abstract class CBuildConfiguration extends PlatformObject implements ICBu
}
/**
+ * @return The exit code of the build process.
* @since 6.4
+ *
+ * @deprecated use {@link #watchProcess(IConsole, IProgressMonitor)} instead and pass in a monitor
*/
+ @Deprecated
protected int watchProcess(Process process, IConsole console) throws CoreException {
- Thread t1 = new ReaderThread(process.getInputStream(), console.getOutputStream());
- t1.start();
- Thread t2 = new ReaderThread(process.getErrorStream(), console.getErrorStream());
- t2.start();
- try {
- int rc = process.waitFor();
- // Allow reader threads the chance to process all output to console
- while (t1.isAlive()) {
- Thread.sleep(100);
- }
- while (t2.isAlive()) {
- Thread.sleep(100);
- }
- return rc;
- } catch (InterruptedException e) {
- CCorePlugin.log(e);
- return -1;
- }
+ return watchProcess(console, new NullProgressMonitor());
}
/**
+ * @return The exit code of the build process.
+ * @since 7.5
+ */
+ protected int watchProcess(IConsole console, IProgressMonitor monitor) throws CoreException {
+ return launcher.waitAndRead(console.getInfoStream(), console.getErrorStream(), monitor);
+ }
+
+ /**
+ * @return The exit code of the build process.
* @since 6.4
+ *
+ * @deprecated use {@link #watchProcess(IConsoleParser[], IProgressMonitor)} instead and pass in a monitor
*/
+ @Deprecated
protected int watchProcess(Process process, IConsoleParser[] consoleParsers) throws CoreException {
- Thread t1 = new ReaderThread(this, process.getInputStream(), consoleParsers);
- t1.start();
- Thread t2 = new ReaderThread(this, process.getErrorStream(), consoleParsers);
- t2.start();
- try {
- int rc = process.waitFor();
- // Allow reader threads the chance to process all output to console
- while (t1.isAlive()) {
- Thread.sleep(100);
- }
- while (t2.isAlive()) {
- Thread.sleep(100);
- }
- return rc;
- } catch (InterruptedException e) {
- CCorePlugin.log(e);
- return -1;
- }
+ return watchProcess(consoleParsers, new NullProgressMonitor());
}
- private static class ReaderThread extends Thread {
- CBuildConfiguration config;
- private final BufferedReader in;
- private final IConsoleParser[] consoleParsers;
- private final PrintStream out;
-
- public ReaderThread(CBuildConfiguration config, InputStream in, IConsoleParser[] consoleParsers) {
- this.config = config;
- this.in = new BufferedReader(new InputStreamReader(in));
- this.out = null;
- this.consoleParsers = consoleParsers;
- }
-
- public ReaderThread(InputStream in, OutputStream out) {
- this.in = new BufferedReader(new InputStreamReader(in));
- this.out = new PrintStream(out);
- this.consoleParsers = null;
- this.config = null;
- }
-
- @Override
- public void run() {
- List<Job> jobList = new ArrayList<>();
- try {
- for (String line = in.readLine(); line != null; line = in.readLine()) {
- if (consoleParsers != null) {
- for (IConsoleParser consoleParser : consoleParsers) {
- // Synchronize to avoid interleaving of lines
- synchronized (consoleParser) {
- // if we have an IConsoleParser2, use the processLine method that
- // takes a job list (Container Build support)
- if (consoleParser instanceof IConsoleParser2) {
- ((IConsoleParser2) consoleParser).processLine(line, jobList);
- } else {
- consoleParser.processLine(line);
- }
- }
- }
- }
- if (out != null) {
- out.println(line);
- }
- }
- for (Job j : jobList) {
- try {
- j.join();
- } catch (InterruptedException e) {
- // ignore
- }
- }
- if (config != null) {
- config.shutdown();
- }
- } catch (IOException e) {
- CCorePlugin.log(e);
- }
- }
+ /**
+ * @return The exit code of the build process.
+ * @since 7.5
+ */
+ protected int watchProcess(IConsoleParser[] consoleParsers, IProgressMonitor monitor) throws CoreException {
+ ConsoleOutputSniffer sniffer = new ConsoleOutputSniffer(consoleParsers);
+ return launcher.waitAndRead(sniffer.getOutputStream(), sniffer.getErrorStream(), monitor);
}
private File getScannerInfoCacheFile() {
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java
index d10351cb41a..9f0d72803c0 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/StandardBuildConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016 QNX Software Systems and others.
+ * Copyright (c) 2016, 2022 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -267,7 +267,7 @@ public class StandardBuildConfiguration extends CBuildConfiguration {
}
IConsoleParser[] consoleParsers = new IConsoleParser[] { epm, this };
- watchProcess(p, consoleParsers);
+ watchProcess(consoleParsers, monitor);
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
@@ -326,7 +326,7 @@ public class StandardBuildConfiguration extends CBuildConfiguration {
return;
}
- watchProcess(p, console);
+ watchProcess(console, monitor);
outStream.write(Messages.CBuildConfiguration_BuildComplete);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java
index c491ff4f6c3..cf07edf79bd 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java
@@ -660,13 +660,18 @@ public class FinalLaunchSequence extends ReflectionSequence {
@Execute
public void stepAttachRemoteToDebugger(final RequestMonitor requestMonitor) {
if (fGDBBackend.getIsAttachSession() && fGDBBackend.getSessionType() == SessionType.REMOTE) {
- IProcessDMContext processContext = fProcService.createProcessContext(fCommandControl.getContext(),
- MIProcesses.UNKNOWN_PROCESS_ID);
- fProcService.attachDebuggerToProcess(processContext,
- new DataRequestMonitor<IDMContext>(getExecutor(), requestMonitor));
- } else {
- requestMonitor.done();
+ DataRequestMonitor<Boolean> rm = new DataRequestMonitor<>(getExecutor(), null);
+ fProcService.canDetachDebuggerFromProcess(null, rm);
+
+ if (rm.getData()) {
+ IProcessDMContext processContext = fProcService.createProcessContext(fCommandControl.getContext(),
+ MIProcesses.UNKNOWN_PROCESS_ID);
+ fProcService.attachDebuggerToProcess(processContext,
+ new DataRequestMonitor<IDMContext>(getExecutor(), requestMonitor));
+ return;
+ }
}
+ requestMonitor.done();
}
/**
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java
index b3c471c04c4..136116a6ed5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java
@@ -285,19 +285,13 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
// NOTE: when we support multi-process in all-stop mode,
// we will need to interrupt the target to when doing the attach.
int numConnected = getNumConnected();
- switch (sessionType) {
- case REMOTE:
- // In remote session already one process is connected
- // Bug 528145
- return numConnected == 1;
- case LOCAL:
- return numConnected == 0;
-
- default:
- break;
+
+ if (numConnected == 1 && sessionType == SessionType.REMOTE) {
+ // Bug 528145: Special case for remote sessions with an existing connection.
+ return true;
}
- return false;
+ return numConnected == 0;
}
return true;
@@ -333,38 +327,38 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
public void execute(final RequestMonitor rm) {
// The remote session is already connected to the process
// Bug 528145
- if (fBackend.getSessionType() == SessionType.REMOTE) {
+ if (fBackend.getSessionType() == SessionType.REMOTE
+ && doCanDetachDebuggerFromProcess()) {
rm.done();
- } else {
- getProcessesBeingDebugged(procCtx,
- new ImmediateDataRequestMonitor<IDMContext[]>(rm) {
- @Override
- protected void handleSuccess() {
- assert getData() != null;
-
- boolean found = false;
- for (IDMContext dmc : getData()) {
- IProcessDMContext procDmc = DMContexts.getAncestorOfType(dmc,
- IProcessDMContext.class);
- if (procCtx.equals(procDmc)) {
- found = true;
- }
- }
- if (found) {
- // abort the sequence
- Status failedStatus = new Status(IStatus.ERROR,
- GdbPlugin.PLUGIN_ID, REQUEST_FAILED,
- MessageFormat.format(
- Messages.Already_connected_process_err,
- ((IMIProcessDMContext) procCtx).getProcId()),
- null);
- rm.done(failedStatus);
- return;
- }
- super.handleSuccess();
- }
- });
+ return;
}
+
+ getProcessesBeingDebugged(procCtx, new ImmediateDataRequestMonitor<IDMContext[]>(rm) {
+ @Override
+ protected void handleSuccess() {
+ assert getData() != null;
+
+ boolean found = false;
+ for (IDMContext dmc : getData()) {
+ IProcessDMContext procDmc = DMContexts.getAncestorOfType(dmc,
+ IProcessDMContext.class);
+ if (procCtx.equals(procDmc)) {
+ found = true;
+ }
+ }
+ if (found) {
+ // abort the sequence
+ Status failedStatus = new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+ REQUEST_FAILED,
+ MessageFormat.format(Messages.Already_connected_process_err,
+ ((IMIProcessDMContext) procCtx).getProcId()),
+ null);
+ rm.done(failedStatus);
+ return;
+ }
+ super.handleSuccess();
+ }
+ });
}
},
@@ -477,24 +471,25 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
public void execute(RequestMonitor rm) {
// This call end the current attach to the gdbserver in remote session
// Bug 528145
- if (fBackend.getSessionType() == SessionType.REMOTE) {
+ if (fBackend.getSessionType() == SessionType.REMOTE
+ && doCanDetachDebuggerFromProcess()) {
rm.done();
- } else {
- // For non-stop mode, we do a non-interrupting attach
- // Bug 333284
- boolean shouldInterrupt = true;
- IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
- if (runControl != null && runControl.getRunMode() == MIRunMode.NON_STOP) {
- shouldInterrupt = false;
- }
+ return;
+ }
- boolean extraNewline = targetAttachRequiresTrailingNewline();
- ICommand<MIInfo> miTargetAttach = fCommandFactory.createMITargetAttach(
- fContainerDmc, ((IMIProcessDMContext) procCtx).getProcId(), shouldInterrupt,
- extraNewline);
- fCommandControl.queueCommand(miTargetAttach,
- new ImmediateDataRequestMonitor<MIInfo>(rm));
+ // For non-stop mode, we do a non-interrupting attach
+ // Bug 333284
+ boolean shouldInterrupt = true;
+ IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
+ if (runControl != null && runControl.getRunMode() == MIRunMode.NON_STOP) {
+ shouldInterrupt = false;
}
+
+ boolean extraNewline = targetAttachRequiresTrailingNewline();
+ ICommand<MIInfo> miTargetAttach = fCommandFactory.createMITargetAttach(fContainerDmc,
+ ((IMIProcessDMContext) procCtx).getProcId(), shouldInterrupt, extraNewline);
+ fCommandControl.queueCommand(miTargetAttach,
+ new ImmediateDataRequestMonitor<MIInfo>(rm));
}
},
diff --git a/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll b/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll
index d33f6fdccd1..94b335c339a 100755
--- a/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll
+++ b/native/org.eclipse.cdt.native.serial/os/win32/x86_64/serial.dll
Binary files differ
diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java
index 8e05b7aef14..189ed99053d 100644
--- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java
+++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/build/QtBuildConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015, 2016 QNX Software Systems and others.
+ * Copyright (c) 2015, 2022 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -379,9 +379,8 @@ public class QtBuildConfiguration extends CBuildConfiguration implements IQtBuil
IFile projectFile = project.getFile(project.getName() + ".pro"); //$NON-NLS-1$
command.add(projectFile.getLocation().toOSString());
- ProcessBuilder processBuilder = new ProcessBuilder(command).directory(getBuildDirectory().toFile());
- setBuildEnvironment(processBuilder.environment());
- Process process = processBuilder.start();
+ startBuildProcess(command, new IEnvironmentVariable[0],
+ new org.eclipse.core.runtime.Path(buildDir.toString()), console, monitor);
StringBuffer msg = new StringBuffer();
for (String arg : command) {
@@ -391,7 +390,7 @@ public class QtBuildConfiguration extends CBuildConfiguration implements IQtBuil
outStream.write(msg.toString());
// TODO qmake error parser
- watchProcess(process, console);
+ watchProcess(console, monitor);
doFullBuild = false;
}
@@ -401,11 +400,11 @@ public class QtBuildConfiguration extends CBuildConfiguration implements IQtBuil
// run make
List<String> command = new ArrayList<>(Arrays.asList(makeCommand));
command.add("all"); //$NON-NLS-1$
- ProcessBuilder processBuilder = new ProcessBuilder(command).directory(buildDir.toFile());
- setBuildEnvironment(processBuilder.environment());
- Process process = processBuilder.start();
+
+ startBuildProcess(command, new IEnvironmentVariable[0],
+ new org.eclipse.core.runtime.Path(buildDir.toString()), console, monitor);
outStream.write(String.join(" ", command) + '\n'); //$NON-NLS-1$
- watchProcess(process, new IConsoleParser[] { epm });
+ watchProcess(new IConsoleParser[] { epm }, monitor);
}
getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor);
@@ -438,11 +437,10 @@ public class QtBuildConfiguration extends CBuildConfiguration implements IQtBuil
// run make
List<String> command = new ArrayList<>(Arrays.asList(makeCommand));
command.add("clean"); //$NON-NLS-1$
- ProcessBuilder processBuilder = new ProcessBuilder(command).directory(buildDir.toFile());
- setBuildEnvironment(processBuilder.environment());
- Process process = processBuilder.start();
+ startBuildProcess(command, new IEnvironmentVariable[0],
+ new org.eclipse.core.runtime.Path(buildDir.toString()), console, monitor);
outStream.write(String.join(" ", command) + '\n'); //$NON-NLS-1$
- watchProcess(process, new IConsoleParser[] { epm });
+ watchProcess(new IConsoleParser[] { epm }, monitor);
}
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
diff --git a/releng/org.eclipse.cdt.target/cdt.target b/releng/org.eclipse.cdt.target/cdt.target
index 1bdddf29813..f5a0b9e8874 100644
--- a/releng/org.eclipse.cdt.target/cdt.target
+++ b/releng/org.eclipse.cdt.target/cdt.target
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
-<target name="cdt" sequenceNumber="121">
+<target name="cdt" sequenceNumber="122">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/cbi/updates/license/"/>
@@ -46,7 +46,7 @@
<unit id="org.eclipse.cdt.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
- <repository location="https://download.eclipse.org/wildwebdeveloper/releases/latest/"/>
+ <repository location="https://download.eclipse.org/wildwebdeveloper/releases/0.13.5/"/>
<unit id="org.eclipse.wildwebdeveloper.embedder.node.feature.feature.group" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">

Back to the top