mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Bug 311965: Ignore bogus processes returned by -list-thread-groups of GDB 7.1 and 7.2
This commit is contained in:
parent
d50f45078b
commit
75abd66291
2 changed files with 22 additions and 7 deletions
|
@ -797,13 +797,24 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
|||
}
|
||||
// END OF WORKAROUND to be removed when GDB 7.2 is available
|
||||
|
||||
IMIContainerDMContext[] containerDmcs = new IMIContainerDMContext[groups.length];
|
||||
for (int i = 0; i < groups.length; i++) {
|
||||
String groupId = groups[i].getGroupId();
|
||||
// With GDB 7.1, we can receive a bogus process when we are not debugging anything
|
||||
// -list-thread-groups
|
||||
// ^done,groups=[{id="0",type="process",pid="0"}]
|
||||
// As for GDB 7.2, the pid field is missing altogether in this case
|
||||
// -list-thread-groups
|
||||
// ^done,groups=[{id="i1",type="process"}]
|
||||
// Just ignore that entry
|
||||
List<IMIContainerDMContext> containerDmcs = new ArrayList<IMIContainerDMContext>(groups.length);
|
||||
for (IThreadGroupInfo group : groups) {
|
||||
if (group.getPid() == null ||
|
||||
group.getPid().equals("") || group.getPid().equals("0")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
continue;
|
||||
}
|
||||
String groupId = group.getGroupId();
|
||||
IProcessDMContext procDmc = createProcessContext(controlDmc, groupId);
|
||||
containerDmcs[i] = createContainerContext(procDmc, groupId);
|
||||
containerDmcs.add(createContainerContext(procDmc, groupId));
|
||||
}
|
||||
return containerDmcs;
|
||||
return containerDmcs.toArray(new IMIContainerDMContext[containerDmcs.size()]);
|
||||
}
|
||||
|
||||
public void getRunningProcesses(final IDMContext dmc, final DataRequestMonitor<IProcessDMContext[]> rm) {
|
||||
|
|
|
@ -318,8 +318,12 @@ public class MIListThreadGroupsInfo extends MIInfo {
|
|||
}
|
||||
}
|
||||
}
|
||||
// In the case of -list-thread-groups --available, we can use the id as the pid
|
||||
if (pid.equals("")) { //$NON-NLS-1$
|
||||
// In the case of -list-thread-groups --available, the pid field is not present, but the
|
||||
// pid is used as the main id. To know we are in this case, we check that we have
|
||||
// a description, that only happens for -list-thread-groups --available
|
||||
// We must check this because with GDB 7.2, there will be no pid field as a result
|
||||
// of -list-thread-groups, if no process is actually running yet.
|
||||
if (pid.equals("") && !desc.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
pid = id;
|
||||
}
|
||||
fGroupList[i] = new ThreadGroupInfo(id, desc, type, pid, user, cores, exec);
|
||||
|
|
Loading…
Add table
Reference in a new issue