mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +02:00
Bug 310914: Optimize retrieval of process names.
This commit is contained in:
parent
3c6b9abcc7
commit
d768a3ad38
1 changed files with 7 additions and 19 deletions
|
@ -403,12 +403,6 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
// be running at the time. Bug 303503
|
// be running at the time. Bug 303503
|
||||||
private Map<String, String> fDebuggedProcessesAndNames = new HashMap<String, String>();
|
private Map<String, String> fDebuggedProcessesAndNames = new HashMap<String, String>();
|
||||||
|
|
||||||
// Much like fDebuggedProcessesAndNames, but this list contains all
|
|
||||||
// processes running as reported by CCorePlugin#getProcessList(). We resort
|
|
||||||
// to using that cdt-core call when '-list-thread-groups --available' is
|
|
||||||
// not truly supported by gdb. Currently, e.g., MinGw 7.0 doesn't.
|
|
||||||
private Map<String, String> fRunningProcessesAndNames = new HashMap<String, String>();
|
|
||||||
|
|
||||||
private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$
|
private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$
|
||||||
|
|
||||||
public GDBProcesses_7_0(DsfSession session) {
|
public GDBProcesses_7_0(DsfSession session) {
|
||||||
|
@ -578,9 +572,6 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
id = null;
|
id = null;
|
||||||
} else {
|
} else {
|
||||||
name = fDebuggedProcessesAndNames.get(id);
|
name = fDebuggedProcessesAndNames.get(id);
|
||||||
if (name == null) {
|
|
||||||
name = fRunningProcessesAndNames.get(id);
|
|
||||||
}
|
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
// We don't have the name in our map. Should not happen.
|
// We don't have the name in our map. Should not happen.
|
||||||
name = "Unknown name"; //$NON-NLS-1$
|
name = "Unknown name"; //$NON-NLS-1$
|
||||||
|
@ -843,13 +834,8 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
rm.setData(new IProcessDMContext[0]);
|
rm.setData(new IProcessDMContext[0]);
|
||||||
} else {
|
} else {
|
||||||
fRunningProcessesAndNames.clear();
|
|
||||||
IProcessInfo[] procInfos = list.getProcessList();
|
IProcessInfo[] procInfos = list.getProcessList();
|
||||||
for (IProcessInfo procInfo : procInfos) {
|
rm.setData(makeProcessDMCAndData(controlDmc, procInfos));
|
||||||
fRunningProcessesAndNames.put(Integer.toString(procInfo.getPid()), procInfo.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
rm.setData(makeProcessDMCs(controlDmc, procInfos));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rm.done();
|
rm.done();
|
||||||
|
@ -862,11 +848,13 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Stole this from GDBProcesses. Used when we resort to getting the process list natively */
|
private MIProcessDMCAndData[] makeProcessDMCAndData(ICommandControlDMContext controlDmc, IProcessInfo[] processes) {
|
||||||
private IProcessDMContext[] makeProcessDMCs(ICommandControlDMContext controlDmc, IProcessInfo[] processes) {
|
MIProcessDMCAndData[] procDmcs = new MIProcessDMCAndData[processes.length];
|
||||||
IProcessDMContext[] procDmcs = new IMIProcessDMContext[processes.length];
|
|
||||||
for (int i=0; i<procDmcs.length; i++) {
|
for (int i=0; i<procDmcs.length; i++) {
|
||||||
procDmcs[i] = createProcessContext(controlDmc, Integer.toString(processes[i].getPid()));
|
procDmcs[i] = new MIProcessDMCAndData(controlDmc.getSessionId(),
|
||||||
|
controlDmc,
|
||||||
|
Integer.toString(processes[i].getPid()),
|
||||||
|
processes[i].getName());
|
||||||
}
|
}
|
||||||
return procDmcs;
|
return procDmcs;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue