1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Bug 580259: Not all remote session have a connected process

Contributed by STMicroelectronics

Change-Id: Idec88f4bf0cbc8326bf19b9f081af9f9f9d437e2
Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
This commit is contained in:
Torbjörn Svensson 2022-06-30 10:30:12 +02:00
parent 2481f398e0
commit 96839a029d
2 changed files with 62 additions and 62 deletions

View file

@ -660,14 +660,19 @@ public class FinalLaunchSequence extends ReflectionSequence {
@Execute @Execute
public void stepAttachRemoteToDebugger(final RequestMonitor requestMonitor) { public void stepAttachRemoteToDebugger(final RequestMonitor requestMonitor) {
if (fGDBBackend.getIsAttachSession() && fGDBBackend.getSessionType() == SessionType.REMOTE) { if (fGDBBackend.getIsAttachSession() && fGDBBackend.getSessionType() == SessionType.REMOTE) {
DataRequestMonitor<Boolean> rm = new DataRequestMonitor<>(getExecutor(), null);
fProcService.canDetachDebuggerFromProcess(null, rm);
if (rm.getData()) {
IProcessDMContext processContext = fProcService.createProcessContext(fCommandControl.getContext(), IProcessDMContext processContext = fProcService.createProcessContext(fCommandControl.getContext(),
MIProcesses.UNKNOWN_PROCESS_ID); MIProcesses.UNKNOWN_PROCESS_ID);
fProcService.attachDebuggerToProcess(processContext, fProcService.attachDebuggerToProcess(processContext,
new DataRequestMonitor<IDMContext>(getExecutor(), requestMonitor)); new DataRequestMonitor<IDMContext>(getExecutor(), requestMonitor));
} else { return;
requestMonitor.done();
} }
} }
requestMonitor.done();
}
/** /**
* Indicate that the Data Model has been filled. This will trigger the Debug view to expand. * Indicate that the Data Model has been filled. This will trigger the Debug view to expand.

View file

@ -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, // NOTE: when we support multi-process in all-stop mode,
// we will need to interrupt the target to when doing the attach. // we will need to interrupt the target to when doing the attach.
int numConnected = getNumConnected(); 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: if (numConnected == 1 && sessionType == SessionType.REMOTE) {
break; // Bug 528145: Special case for remote sessions with an existing connection.
return true;
} }
return false; return numConnected == 0;
} }
return true; return true;
@ -333,11 +327,13 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
public void execute(final RequestMonitor rm) { public void execute(final RequestMonitor rm) {
// The remote session is already connected to the process // The remote session is already connected to the process
// Bug 528145 // Bug 528145
if (fBackend.getSessionType() == SessionType.REMOTE) { if (fBackend.getSessionType() == SessionType.REMOTE
&& doCanDetachDebuggerFromProcess()) {
rm.done(); rm.done();
} else { return;
getProcessesBeingDebugged(procCtx, }
new ImmediateDataRequestMonitor<IDMContext[]>(rm) {
getProcessesBeingDebugged(procCtx, new ImmediateDataRequestMonitor<IDMContext[]>(rm) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
assert getData() != null; assert getData() != null;
@ -352,10 +348,9 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
} }
if (found) { if (found) {
// abort the sequence // abort the sequence
Status failedStatus = new Status(IStatus.ERROR, Status failedStatus = new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
GdbPlugin.PLUGIN_ID, REQUEST_FAILED, REQUEST_FAILED,
MessageFormat.format( MessageFormat.format(Messages.Already_connected_process_err,
Messages.Already_connected_process_err,
((IMIProcessDMContext) procCtx).getProcId()), ((IMIProcessDMContext) procCtx).getProcId()),
null); null);
rm.done(failedStatus); rm.done(failedStatus);
@ -365,7 +360,6 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
} }
}); });
} }
}
}, },
// If this is not the very first inferior, we first need create the new inferior // If this is not the very first inferior, we first need create the new inferior
@ -477,9 +471,12 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
public void execute(RequestMonitor rm) { public void execute(RequestMonitor rm) {
// This call end the current attach to the gdbserver in remote session // This call end the current attach to the gdbserver in remote session
// Bug 528145 // Bug 528145
if (fBackend.getSessionType() == SessionType.REMOTE) { if (fBackend.getSessionType() == SessionType.REMOTE
&& doCanDetachDebuggerFromProcess()) {
rm.done(); rm.done();
} else { return;
}
// For non-stop mode, we do a non-interrupting attach // For non-stop mode, we do a non-interrupting attach
// Bug 333284 // Bug 333284
boolean shouldInterrupt = true; boolean shouldInterrupt = true;
@ -489,13 +486,11 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 implements IMultiTerminat
} }
boolean extraNewline = targetAttachRequiresTrailingNewline(); boolean extraNewline = targetAttachRequiresTrailingNewline();
ICommand<MIInfo> miTargetAttach = fCommandFactory.createMITargetAttach( ICommand<MIInfo> miTargetAttach = fCommandFactory.createMITargetAttach(fContainerDmc,
fContainerDmc, ((IMIProcessDMContext) procCtx).getProcId(), shouldInterrupt, ((IMIProcessDMContext) procCtx).getProcId(), shouldInterrupt, extraNewline);
extraNewline);
fCommandControl.queueCommand(miTargetAttach, fCommandControl.queueCommand(miTargetAttach,
new ImmediateDataRequestMonitor<MIInfo>(rm)); new ImmediateDataRequestMonitor<MIInfo>(rm));
} }
}
}, },
// Initialize memory data for this process. // Initialize memory data for this process.