-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug 580259: Not all remote session have a connected process #49
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -285,19 +285,13 @@ protected boolean doIsDebuggerAttachSupported() { | |
// 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 void attachDebuggerToProcess(final IProcessDMContext procCtx, final Strin | |
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()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am unable to understand the reason for this condition.. I am running multi-gdbserver and attaching to second process using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @umairsair can you raise a new issue for this please so we can get it tested and resolved. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jonahgraham I'll try to work on it in detail and will submit a patch if there is really an issue on CDT side and not something in my local setup.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have created #336 |
||
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 @@ protected void handleCompleted() { | |
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)); | ||
} | ||
|
||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of this change, connect option is always available in context menu of debug session even for all-stop mode but debug new executable is grayed out.. I am using "C/C++ Attach to Application" with "gdbserver" as debugger..
I'll further look into https://git.eclipse.org/r/c/cdt/org.eclipse.cdt/+/188851