FpDebug: improve TX86AsmDecoder.UnwindFrame

This commit is contained in:
Martin 2024-09-25 15:25:43 +02:00
parent 6f26574f55
commit 8e2532bdfc

View File

@ -5495,8 +5495,29 @@ var
{$POP}
else
if (Oper.Value = '%s') and (not(ofMemory in Oper.Flags))
then
then begin
AVal := TDBGPtr(OpVal) // constant
end
else
if (ofMemory in Oper.Flags) then begin
FullName := FullRegisterName(Oper.Value);
AVal := 0;
if (LowerCase(FullName)+'%s' = LowerCase(Oper.Value)) then begin
r := ARegisterValueList.FindRegisterByName(FullName);
if r = nil then
exit(False);
AVal := r.NumValue;
{$PUSH}{$R-}{$Q-}
if (AVal >= NewStack) and (AVal < NewStack + 8192) then // only trust data from the stack
AVal := AVal + OpVal
else
AVal := 0;
{$POP}
end;
if AVal = 0 then
exit(False);
end
else
exit(False);
end
@ -5691,8 +5712,9 @@ begin
not(ofMemory in Instr.X86Instruction.Operand[1].Flags)
then begin
if not ValueFromOperand(instr.X86Instruction.Operand[2], Tmp) then
exit;
NewFrame := Tmp;
NewFrame := 0
else
NewFrame := Tmp;
end
else begin
FullName := LowerCase(FullRegisterName(instr.X86Instruction.Operand[1].Value));
@ -5728,6 +5750,10 @@ begin
{$PUSH}{$R-}{$Q-}
NewFrame := NewFrame + Val;
{$POP}
end
else
if ValueFromOperand(instr.X86Instruction.Operand[2], Tmp, True) then begin
NewFrame := Tmp;
end;
end
else
@ -5751,6 +5777,10 @@ begin
NewStack := NewFrame + Val;
{$POP}
end
else
if ValueFromOperand(instr.X86Instruction.Operand[2], Tmp, True) then begin
NewStack := Tmp;
end
else
exit;
end
@ -5797,6 +5827,32 @@ begin
{$POP}
end;
end;
OPsub:
begin
if instr.X86Instruction.OperCnt <> 2 then
exit;
ClearRecValList := False;
ClearRegister(instr.X86Instruction.Operand[1].Value);
if IsRegister(instr.X86Instruction.Operand[1].Value, 'sp') and
not(ofMemory in Instr.X86Instruction.Operand[1].Flags)
then begin
if not ValueFromOperand(instr.X86Instruction.Operand[2], Tmp) then
exit;
{$PUSH}{$R-}{$Q-}
NewStack := NewStack - int64(Tmp);
{$POP}
end;
if IsRegister(instr.X86Instruction.Operand[1].Value, 'bp') and
not(ofMemory in Instr.X86Instruction.Operand[1].Flags)
then begin
if not ValueFromOperand(instr.X86Instruction.Operand[2], Tmp) then
exit;
{$PUSH}{$R-}{$Q-}
NewFrame := NewFrame - int64(Tmp);
{$POP}
end;
end;
OPj__:
if (not AQuick) and
(instr.X86Instruction.OperCnt = 1) and