mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Bug 487144 - do not attach process if it is already targetted.
Change-Id: I76f1ad04cb9e7ce2e3dd16cb9f2a694af15e40ce Signed-off-by: Teodor Madan <teodor.madan@nxp.com>
This commit is contained in:
parent
5edf224704
commit
11eefb48b1
3 changed files with 46 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010, 2015 TUBITAK BILGEM-ITI and others.
|
||||
* Copyright (c) 2010, 2016 TUBITAK BILGEM-ITI 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
|
||||
|
@ -60,6 +60,8 @@ import org.eclipse.core.runtime.IStatus;
|
|||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* Adding support for multi-process with GDB 7.2
|
||||
*
|
||||
|
@ -253,18 +255,52 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
|
|||
@Override
|
||||
public void attachDebuggerToProcess(final IProcessDMContext procCtx, final String binaryPath, final DataRequestMonitor<IDMContext> dataRm) {
|
||||
if (procCtx instanceof IMIProcessDMContext) {
|
||||
if (!doIsDebuggerAttachSupported()) {
|
||||
dataRm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Attach not supported.", null)); //$NON-NLS-1$
|
||||
dataRm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!doIsDebuggerAttachSupported()) {
|
||||
dataRm.setStatus(
|
||||
new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Attach not supported.", null)); //$NON-NLS-1$
|
||||
dataRm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
// Use a sequence for better control of each step
|
||||
ImmediateExecutor.getInstance().execute(new Sequence(getExecutor(), dataRm) {
|
||||
private IMIContainerDMContext fContainerDmc;
|
||||
|
||||
private Step[] steps = new Step[] {
|
||||
// If this is not the very first inferior, we first need create the new inferior
|
||||
// first check if requested process is already targetted
|
||||
new Step() {
|
||||
@Override
|
||||
public void execute(final RequestMonitor rm) {
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// If this is not the very first inferior, we first need create the new inferior
|
||||
new Step() {
|
||||
@Override
|
||||
public void execute(final RequestMonitor rm) {
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.osgi.util.NLS;
|
|||
* @since 4.1
|
||||
*/
|
||||
class Messages extends NLS {
|
||||
public static String Already_connected_process_err;
|
||||
public static String Tracing_not_supported_error;
|
||||
public static String Invalid_post_mortem_type_error;
|
||||
public static String Cannot_get_post_mortem_file_path_error;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
# Alvaro Sanchez-Leon (Ericsson) - Support Register Groups (Bug 235747)
|
||||
###############################################################################
|
||||
|
||||
Already_connected_process_err=Already connected to process {0}
|
||||
Tracing_not_supported_error=Tracing not supported
|
||||
Invalid_post_mortem_type_error=Invalid post-mortem type
|
||||
Cannot_get_post_mortem_file_path_error=Cannot get post mortem file path
|
||||
|
|
Loading…
Add table
Reference in a new issue