mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 09:18:09 +00:00
fix incorrect impl of RDI_EvalOp_Swap
This commit is contained in:
@@ -1013,32 +1013,39 @@ e_interpret(String8 bytecode)
|
|||||||
result.code = E_InterpretationCode_BadOp;
|
result.code = E_InterpretationCode_BadOp;
|
||||||
goto done;
|
goto done;
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case RDI_EvalOp_PartialValue:
|
case RDI_EvalOp_PartialValue:
|
||||||
{
|
{
|
||||||
// DW_OP_piece marker: top-of-stack is a piece of a composite value.
|
// DW_OP_piece marker: top-of-stack is a piece of a composite value.
|
||||||
// we do not assemble composites; for single-piece expressions the
|
// we do not assemble composites; for single-piece expressions the
|
||||||
// value already on the stack is the result. for multi-piece, only
|
// value already on the stack is the result. for multi-piece, only
|
||||||
// the first piece is returned (stack[0] is the final result).
|
// the first piece is returned (stack[0] is the final result).
|
||||||
|
result.code = E_InterpretationCode_BadOp;
|
||||||
|
goto done;
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case RDI_EvalOp_PartialValueBit:
|
case RDI_EvalOp_PartialValueBit:
|
||||||
{
|
{
|
||||||
// DW_OP_bit_piece marker. same caveat as PartialValue.
|
// DW_OP_bit_piece marker. same caveat as PartialValue.
|
||||||
|
result.code = E_InterpretationCode_BadOp;
|
||||||
|
goto done;
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case RDI_EvalOp_Swap:
|
case RDI_EvalOp_Swap:
|
||||||
{
|
{
|
||||||
if(stack_count + 2 > stack_cap)
|
if(stack_count >= 2)
|
||||||
|
{
|
||||||
|
E_Value swap = stack[stack_count-2];
|
||||||
|
stack[stack_count-2] = stack[stack_count-1];
|
||||||
|
stack[stack_count-1] = swap;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
result.code = E_InterpretationCode_InsufficientStackSpace;
|
result.code = E_InterpretationCode_InsufficientStackSpace;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
stack[stack_count + 0] = svals[1];
|
|
||||||
stack[stack_count + 1] = svals[0];
|
|
||||||
stack_count += 2;
|
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case RDI_EvalOp_PushCfa:
|
case RDI_EvalOp_PushCfa:
|
||||||
{
|
{
|
||||||
nval.u64 = e_interpret_ctx->cfa;
|
nval.u64 = e_interpret_ctx->cfa;
|
||||||
|
|||||||
Reference in New Issue
Block a user