mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 22:05:44 +02:00
Bug 510833 - [lldb] IllegalStateException in LLDBProcesses$LLDBMIThreadDMData starting session
Re-arrange the code to prevent done() from being called twice. Change-Id: I25737e9b6a7c188db62381695562046e326cacd0 Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>
This commit is contained in:
parent
b803d1030c
commit
55245c4252
1 changed files with 31 additions and 24 deletions
|
@ -103,34 +103,41 @@ public class LLDBProcesses extends GDBProcesses_7_4 {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getExecutionData(IThreadDMContext dmc, DataRequestMonitor<IThreadDMData> rm) {
|
public void getExecutionData(IThreadDMContext dmc, DataRequestMonitor<IThreadDMData> rm) {
|
||||||
if (dmc instanceof IMIProcessDMContext) {
|
if (!(dmc instanceof IMIProcessDMContext)) {
|
||||||
|
super.getExecutionData(dmc, rm);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String pidStr = ((IMIProcessDMContext) dmc).getProcId();
|
String pidStr = ((IMIProcessDMContext) dmc).getProcId();
|
||||||
int pid = -1;
|
int pid = -1;
|
||||||
try {
|
try {
|
||||||
pid = Integer.parseInt(pidStr);
|
pid = Integer.parseInt(pidStr);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
}
|
}
|
||||||
|
int pid2 = pid;
|
||||||
|
|
||||||
// It's possible that we get here without getRunningProcesses called
|
// It's possible that we get here without getRunningProcesses called
|
||||||
// yet so the process names map will be empty. This can happen when
|
// yet so the process names map will be empty. This can happen when
|
||||||
// doing local debugging but not attach mode.
|
// doing local debugging but not attach mode.
|
||||||
if (fProcessNames.isEmpty()) {
|
if (fProcessNames.isEmpty()) {
|
||||||
// FIXME: This triggers a double done()!! (Bug 510833)
|
getRunningProcesses(dmc, new DataRequestMonitor<IProcessDMContext[]>(getExecutor(), rm) {
|
||||||
getRunningProcesses(dmc, new DataRequestMonitor<>(getExecutor(), rm));
|
@Override
|
||||||
|
protected void handleSuccess() {
|
||||||
|
rm.setData(new LLDBMIThreadDMData(getProcessName(pid2), pidStr));
|
||||||
|
super.handleSuccess();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
String name = fProcessNames.get(pid);
|
|
||||||
if (name == null) {
|
|
||||||
name = Messages.LLDBProcesses_unknown_process_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
rm.setData(new LLDBMIThreadDMData(name, pidStr));
|
|
||||||
rm.done();
|
|
||||||
} else {
|
} else {
|
||||||
super.getExecutionData(dmc, rm);
|
rm.setData(new LLDBMIThreadDMData(getProcessName(pid2), pidStr));
|
||||||
|
rm.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getProcessName(int pid) {
|
||||||
|
String name = fProcessNames.get(pid);
|
||||||
|
return name != null ? name : Messages.LLDBProcesses_unknown_process_name;
|
||||||
|
}
|
||||||
|
|
||||||
private static class LLDBMIThreadDMData implements IThreadDMData {
|
private static class LLDBMIThreadDMData implements IThreadDMData {
|
||||||
final String fName;
|
final String fName;
|
||||||
final String fId;
|
final String fId;
|
||||||
|
|
Loading…
Add table
Reference in a new issue