GP-2586 Exceptions for injection error conditions

This commit is contained in:
caheckman 2022-09-28 17:19:55 -04:00
parent dc927fc7be
commit e996440c77
9 changed files with 240 additions and 206 deletions

View file

@ -1154,6 +1154,8 @@ void FlowInfo::doInjection(InjectPayload *payload,InjectContext &icontext,PcodeO
bool startbasic = op->isBlockStart();
++iter; // Now points to first op in the injection
if (iter == obank.endDead())
throw LowlevelError("Empty injection: " + payload->getName());
PcodeOp *firstop = *iter;
bool isfallthru = true;
PcodeOp *lastop = xrefControlFlow(iter,startbasic,isfallthru,fc);

View file

@ -51,13 +51,13 @@ void InjectPayloadGhidra::inject(InjectContext &con,PcodeEmit &emit) const
PackedDecode decoder(ghidra);
try {
if (!ghidra->getPcodeInject(name,type,con,decoder))
throw LowlevelError("Could not retrieve pcode snippet: "+name);
throw LowlevelError("Could not retrieve injection: "+name);
}
catch(JavaError &err) {
throw LowlevelError("Error getting pcode snippet: " + err.explain);
throw LowlevelError("Injection error: " + err.explain);
}
catch(DecoderError &err) {
throw LowlevelError("Error in pcode snippet xml: "+err.explain);
throw LowlevelError("Error decoding injection: "+err.explain);
}
uint4 elemId = decoder.openElement();
Address addr = Address::decode(decoder);