mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 01:05:38 +02:00
Bug 423731, Bug 421541 - Accept failures of GDB commands when setting
memory info. Change-Id: I28d332365c5b2e01f7df9d269a1f805a586a1563 Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com> Reviewed-on: https://git.eclipse.org/r/19639 Tested-by: Hudson CI Reviewed-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com> IP-Clean: Mikhail Khodjaiants <mikhailkhod@googlemail.com> Tested-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com> Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> IP-Clean: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
This commit is contained in:
parent
475d44a366
commit
3649ffac46
1 changed files with 69 additions and 16 deletions
|
@ -18,7 +18,6 @@ import java.util.Hashtable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.IAddress;
|
import org.eclipse.cdt.core.IAddress;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
|
||||||
|
@ -110,7 +109,6 @@ public class GDBMemory extends MIMemory implements IGDBMemory {
|
||||||
count,
|
count,
|
||||||
new DataRequestMonitor<MemoryByte[]>(ImmediateExecutor.getInstance(), drm) {
|
new DataRequestMonitor<MemoryByte[]>(ImmediateExecutor.getInstance(), drm) {
|
||||||
@Override
|
@Override
|
||||||
@ConfinedToDsfExecutor("fExecutor")
|
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
IMemoryDMContext memDmc = DMContexts.getAncestorOfType(dmc, IMemoryDMContext.class);
|
IMemoryDMContext memDmc = DMContexts.getAncestorOfType(dmc, IMemoryDMContext.class);
|
||||||
if (memDmc != null) {
|
if (memDmc != null) {
|
||||||
|
@ -132,6 +130,7 @@ public class GDBMemory extends MIMemory implements IGDBMemory {
|
||||||
ImmediateExecutor.getInstance().execute(new Sequence(getExecutor(), rm) {
|
ImmediateExecutor.getInstance().execute(new Sequence(getExecutor(), rm) {
|
||||||
|
|
||||||
private String originalLanguage = MIGDBShowLanguageInfo.AUTO;
|
private String originalLanguage = MIGDBShowLanguageInfo.AUTO;
|
||||||
|
private boolean abortLanguageSteps = false;
|
||||||
|
|
||||||
// Need a global here as getSteps() can be called more than once.
|
// Need a global here as getSteps() can be called more than once.
|
||||||
private Step[] steps = null;
|
private Step[] steps = null;
|
||||||
|
@ -150,9 +149,12 @@ public class GDBMemory extends MIMemory implements IGDBMemory {
|
||||||
fCommandControl.getCommandFactory().createMIGDBShowLanguage(memContext),
|
fCommandControl.getCommandFactory().createMIGDBShowLanguage(memContext),
|
||||||
new ImmediateDataRequestMonitor<MIGDBShowLanguageInfo>(requestMonitor) {
|
new ImmediateDataRequestMonitor<MIGDBShowLanguageInfo>(requestMonitor) {
|
||||||
@Override
|
@Override
|
||||||
@ConfinedToDsfExecutor("fExecutor")
|
protected void handleCompleted() {
|
||||||
protected void handleSuccess() {
|
if (isSuccess()) {
|
||||||
originalLanguage = getData().getLanguage();
|
originalLanguage = getData().getLanguage();
|
||||||
|
} else {
|
||||||
|
abortLanguageSteps = true;
|
||||||
|
}
|
||||||
requestMonitor.done();
|
requestMonitor.done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -163,9 +165,23 @@ public class GDBMemory extends MIMemory implements IGDBMemory {
|
||||||
// switch to c language
|
// switch to c language
|
||||||
@Override
|
@Override
|
||||||
public void execute(final RequestMonitor requestMonitor) {
|
public void execute(final RequestMonitor requestMonitor) {
|
||||||
|
if (abortLanguageSteps) {
|
||||||
|
requestMonitor.done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fCommandControl.queueCommand(
|
fCommandControl.queueCommand(
|
||||||
fCommandControl.getCommandFactory().createMIGDBSetLanguage(memContext, MIGDBShowLanguageInfo.C),
|
fCommandControl.getCommandFactory().createMIGDBSetLanguage(memContext, MIGDBShowLanguageInfo.C),
|
||||||
new ImmediateDataRequestMonitor<MIInfo>(requestMonitor));
|
new ImmediateDataRequestMonitor<MIInfo>(requestMonitor) {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
if (!isSuccess()) {
|
||||||
|
abortLanguageSteps = true;
|
||||||
|
}
|
||||||
|
// Accept failure
|
||||||
|
requestMonitor.done();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -174,13 +190,16 @@ public class GDBMemory extends MIMemory implements IGDBMemory {
|
||||||
// read address size
|
// read address size
|
||||||
@Override
|
@Override
|
||||||
public void execute(final RequestMonitor requestMonitor) {
|
public void execute(final RequestMonitor requestMonitor) {
|
||||||
|
// Run this step even if the language commands where aborted, but accept failures.
|
||||||
readAddressSize(
|
readAddressSize(
|
||||||
memContext,
|
memContext,
|
||||||
new ImmediateDataRequestMonitor<Integer>(requestMonitor) {
|
new ImmediateDataRequestMonitor<Integer>(requestMonitor) {
|
||||||
@Override
|
@Override
|
||||||
@ConfinedToDsfExecutor("fExecutor")
|
protected void handleCompleted() {
|
||||||
protected void handleSuccess() {
|
if (isSuccess()) {
|
||||||
fAddressSizes.put(memContext, getData());
|
fAddressSizes.put(memContext, getData());
|
||||||
|
}
|
||||||
|
// Accept failure
|
||||||
requestMonitor.done();
|
requestMonitor.done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -192,9 +211,43 @@ public class GDBMemory extends MIMemory implements IGDBMemory {
|
||||||
// restore original language
|
// restore original language
|
||||||
@Override
|
@Override
|
||||||
public void execute(final RequestMonitor requestMonitor) {
|
public void execute(final RequestMonitor requestMonitor) {
|
||||||
|
if (abortLanguageSteps) {
|
||||||
|
requestMonitor.done();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fCommandControl.queueCommand(
|
fCommandControl.queueCommand(
|
||||||
fCommandControl.getCommandFactory().createMIGDBSetLanguage(memContext, originalLanguage),
|
fCommandControl.getCommandFactory().createMIGDBSetLanguage(memContext, originalLanguage),
|
||||||
new ImmediateDataRequestMonitor<MIInfo>(requestMonitor));
|
new ImmediateDataRequestMonitor<MIInfo>(requestMonitor) {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
if (!isSuccess()) {
|
||||||
|
// If we are unable to set the original language back things could be bad.
|
||||||
|
// Let's try setting it to "auto" as a fall back. Log the situation as info.
|
||||||
|
GdbPlugin.log(getStatus());
|
||||||
|
|
||||||
|
fCommandControl.queueCommand(
|
||||||
|
fCommandControl.getCommandFactory().createMIGDBSetLanguage(memContext, MIGDBShowLanguageInfo.AUTO),
|
||||||
|
new ImmediateDataRequestMonitor<MIInfo>(requestMonitor) {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
if (!isSuccess()) {
|
||||||
|
// This error could be bad because we've changed the language to C
|
||||||
|
// but are unable to switch it back. Log the error.
|
||||||
|
// If the language happens to be C anyway, everything will
|
||||||
|
// continue to work, which is why we don't abort the sequence
|
||||||
|
// (which would cause the entire session to fail).
|
||||||
|
GdbPlugin.log(getStatus());
|
||||||
|
}
|
||||||
|
// Accept failure
|
||||||
|
requestMonitor.done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
requestMonitor.done();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -210,9 +263,11 @@ public class GDBMemory extends MIMemory implements IGDBMemory {
|
||||||
memContext,
|
memContext,
|
||||||
new ImmediateDataRequestMonitor<Boolean>(requestMonitor) {
|
new ImmediateDataRequestMonitor<Boolean>(requestMonitor) {
|
||||||
@Override
|
@Override
|
||||||
@ConfinedToDsfExecutor("fExecutor")
|
protected void handleCompleted() {
|
||||||
protected void handleSuccess() {
|
if (isSuccess()) {
|
||||||
fIsBigEndian = getData();
|
fIsBigEndian = getData();
|
||||||
|
}
|
||||||
|
// Accept failure
|
||||||
requestMonitor.done();
|
requestMonitor.done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -268,7 +323,6 @@ public class GDBMemory extends MIMemory implements IGDBMemory {
|
||||||
commandFactory.createMIDataEvaluateExpression(exprContext),
|
commandFactory.createMIDataEvaluateExpression(exprContext),
|
||||||
new DataRequestMonitor<MIDataEvaluateExpressionInfo>(ImmediateExecutor.getInstance(), drm) {
|
new DataRequestMonitor<MIDataEvaluateExpressionInfo>(ImmediateExecutor.getInstance(), drm) {
|
||||||
@Override
|
@Override
|
||||||
@ConfinedToDsfExecutor("fExecutor")
|
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
try {
|
try {
|
||||||
drm.setData(Integer.decode(getData().getValue()));
|
drm.setData(Integer.decode(getData().getValue()));
|
||||||
|
@ -287,7 +341,6 @@ public class GDBMemory extends MIMemory implements IGDBMemory {
|
||||||
commandFactory.createCLIShowEndian(memContext),
|
commandFactory.createCLIShowEndian(memContext),
|
||||||
new DataRequestMonitor<CLIShowEndianInfo>(ImmediateExecutor.getInstance(), drm) {
|
new DataRequestMonitor<CLIShowEndianInfo>(ImmediateExecutor.getInstance(), drm) {
|
||||||
@Override
|
@Override
|
||||||
@ConfinedToDsfExecutor("fExecutor")
|
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
drm.setData(Boolean.valueOf(getData().isBigEndian()));
|
drm.setData(Boolean.valueOf(getData().isBigEndian()));
|
||||||
drm.done();
|
drm.done();
|
||||||
|
|
Loading…
Add table
Reference in a new issue