Expose the stack pointer and frame pointer via CPUState.

This commit is contained in:
Rene Gollent 2011-12-11 22:25:32 -05:00
parent 7bdc07318d
commit 12b1aa817a
3 changed files with 23 additions and 0 deletions

View File

@ -1,5 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef CPU_STATE_H
@ -21,6 +22,8 @@ public:
virtual ~CpuState();
virtual target_addr_t InstructionPointer() const = 0;
virtual target_addr_t StackFramePointer() const = 0;
virtual target_addr_t StackPointer() const = 0;
virtual bool GetRegisterValue(const Register* reg,
BVariant& _value) const = 0;
virtual bool SetRegisterValue(const Register* reg,

View File

@ -1,5 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
@ -54,6 +55,22 @@ CpuStateX86::InstructionPointer() const
}
target_addr_t
CpuStateX86::StackFramePointer() const
{
return IsRegisterSet(X86_REGISTER_EBP)
? IntRegisterValue(X86_REGISTER_EBP) : 0;
}
target_addr_t
CpuStateX86::StackPointer() const
{
return IsRegisterSet(X86_REGISTER_ESP)
? IntRegisterValue(X86_REGISTER_ESP) : 0;
}
bool
CpuStateX86::GetRegisterValue(const Register* reg, BVariant& _value) const
{

View File

@ -1,5 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef CPU_STATE_X86_H
@ -47,6 +48,8 @@ public:
virtual ~CpuStateX86();
virtual target_addr_t InstructionPointer() const;
virtual target_addr_t StackFramePointer() const;
virtual target_addr_t StackPointer() const;
virtual bool GetRegisterValue(const Register* reg,
BVariant& _value) const;
virtual bool SetRegisterValue(const Register* reg,