mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-21 07:55:24 +02:00
[266607] If we don't have a process name, use -list-thread-groups --available to get it. Although not very efficient, this is all GDB offers right now.
This commit is contained in:
parent
8d489aa58e
commit
d7a85ffaca
1 changed files with 36 additions and 4 deletions
|
@ -491,11 +491,43 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
|
|
||||||
public void getExecutionData(IThreadDMContext dmc, final DataRequestMonitor<IThreadDMData> rm) {
|
public void getExecutionData(IThreadDMContext dmc, final DataRequestMonitor<IThreadDMData> rm) {
|
||||||
if (dmc instanceof IMIProcessDMContext) {
|
if (dmc instanceof IMIProcessDMContext) {
|
||||||
String id = ((IMIProcessDMContext)dmc).getProcId();
|
final String id = ((IMIProcessDMContext)dmc).getProcId();
|
||||||
String name = fProcessNames.get(id);
|
String name = fProcessNames.get(id);
|
||||||
if (name == null) name = "Unknown name"; //$NON-NLS-1$
|
if (name == null) {
|
||||||
rm.setData(new MIThreadDMData(name, id));
|
// We don't have the name yet. Maybe we didn't fetch names yet,
|
||||||
rm.done();
|
// or maybe this is a new process
|
||||||
|
// This is not very efficient, but GDB does not provide a way to get the name
|
||||||
|
// of a single process.
|
||||||
|
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
|
||||||
|
fCommandControl.queueCommand(
|
||||||
|
new MIListThreadGroups(controlDmc, true),
|
||||||
|
new DataRequestMonitor<MIListThreadGroupsInfo>(getExecutor(), rm) {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
String name = null;
|
||||||
|
if (isSuccess()) {
|
||||||
|
for (IThreadGroupInfo groupInfo : getData().getGroupList()) {
|
||||||
|
fProcessNames.put(groupInfo.getPid(), groupInfo.getName());
|
||||||
|
if (groupInfo.getPid().equals(id)) {
|
||||||
|
name = groupInfo.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == null) {
|
||||||
|
// We still don't have the name... weird.
|
||||||
|
// Don't go into an infinite loop by trying again, just give up
|
||||||
|
name = "Unknown name"; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
rm.setData(new MIThreadDMData(name, id));
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
rm.setData(new MIThreadDMData(name, id));
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
} else if (dmc instanceof MIThreadDMC) {
|
} else if (dmc instanceof MIThreadDMC) {
|
||||||
final MIThreadDMC threadDmc = (MIThreadDMC)dmc;
|
final MIThreadDMC threadDmc = (MIThreadDMC)dmc;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue