mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 02:13:56 +09:00
LibCoreDump: Use "eip - 1" when creating backtrace entries
We need to do this because the return address from a function frame is the instruction that comes after the 'call' instruction.
This commit is contained in:
parent
d26f4f9e8c
commit
a45ce0c6eb
Notes:
sideshowbarker
2024-07-18 12:01:32 +09:00
Author: https://github.com/itamar8910
Commit: a45ce0c6eb
Pull-request: https://github.com/SerenityOS/serenity/pull/8149
Reviewed-by: https://github.com/gunnarbeutner
1 changed files with 4 additions and 1 deletions
|
@ -54,7 +54,10 @@ Backtrace::Backtrace(const Reader& coredump, const ELF::Core::ThreadInfo& thread
|
|||
uint32_t* ebp = (uint32_t*)m_thread_info.regs.ebp;
|
||||
uint32_t* eip = (uint32_t*)m_thread_info.regs.eip;
|
||||
while (ebp && eip) {
|
||||
add_entry(coredump, (FlatPtr)eip);
|
||||
// We use eip - 1 because the return address from a function frame
|
||||
// is the instruction that comes after the 'call' instruction.
|
||||
VERIFY((FlatPtr)eip > 0);
|
||||
add_entry(coredump, (FlatPtr)eip - 1);
|
||||
auto next_eip = coredump.peek_memory((FlatPtr)(ebp + 1));
|
||||
auto next_ebp = coredump.peek_memory((FlatPtr)(ebp));
|
||||
if (!next_eip.has_value() || !next_ebp.has_value())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue