1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:07:45 +00:00

UserspaceEmulator: Use the base address of instructions in backtraces

Instead of using SoftCPU::eip() which points at the *next* instruction
most of the time, stash away a "base EIP" so we can use it when making
backtraces. This makes the correct line number show up! :^)
This commit is contained in:
Andreas Kling 2020-07-21 19:00:03 +02:00
parent 5c29f4e326
commit abebec0e04
2 changed files with 8 additions and 6 deletions

View file

@ -56,6 +56,9 @@ public:
explicit SoftCPU(Emulator&);
void dump() const;
u32 base_eip() const { return m_base_eip; }
void save_base_eip() { m_base_eip = m_eip; }
u32 eip() const { return m_eip; }
void set_eip(u32 eip)
{
@ -981,6 +984,7 @@ private:
bool m_flags_tainted { false };
u32 m_eip { 0 };
u32 m_base_eip { 0 };
const u8* m_cached_code_ptr { nullptr };
const u8* m_cached_code_end { nullptr };