Skip to content

Commit

Permalink
Fix i386 unwinding when there's no CFI
Browse files Browse the repository at this point in the history
We should properly fall back to the frame-pointer based unwinding for
i386. Fix preprocessor directives to compile it in
  • Loading branch information
peadar committed Oct 14, 2024
1 parent 52c9313 commit 5a14bda
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,8 @@ ThreadStack::unwind(Process &p, Elf::CoreRegisters &regs)
stack.emplace_back(UnwindMechanism::TRAMPOLINE, newRegs);
continue;
}
#elif defined(__i386__)
#endif
#if defined(__i386__)
// Deal with signal trampolines for i386
Elf::Addr reloc;
const Elf::Phdr *segment;
Expand Down Expand Up @@ -993,7 +994,8 @@ ThreadStack::unwind(Process &p, Elf::CoreRegisters &regs)
continue;
}
}
#elif defined(__i386__) || defined(__amd64__)
#endif
#if defined(__i386__) || defined(__amd64__)
// frame-pointer unwinding.
// Use ebp/rbp to find return address and saved BP.
// Restore those, and the stack pointer itself.
Expand Down

0 comments on commit 5a14bda

Please sign in to comment.