Skip to content

Commit

Permalink
fix aarch 64
Browse files Browse the repository at this point in the history
  • Loading branch information
peadar committed Aug 26, 2023
1 parent bb5a39e commit 2d286b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -948,12 +948,12 @@ ThreadStack::unwind(Process &p, Elf::CoreRegisters &regs, unsigned maxFrames)
Dwarf::ProcessLocation badip = { p, IP(prev.regs) };
if (!badip.valid() || (badip.codeloc->phdr_->p_flags & PF_X) == 0) {

auto newRegs = prev.regs; // start with a copy of prev frames regs.
#if defined(__amd64__) || defined(__i386__)
// get stack pointer in the current frame, and read content of TOS
auto sp = SP(prev.regs);
Elf::Addr ip;
auto in = p.io->read(sp, sizeof ip, (char *)&ip);
auto newRegs = prev.regs; // start with a copy of prev frames regs.
if (in == sizeof ip) {
SP(newRegs) = sp + sizeof ip;
IP(newRegs) = ip; // .. insn pointer.
Expand All @@ -980,7 +980,7 @@ ThreadStack::unwind(Process &p, Elf::CoreRegisters &regs, unsigned maxFrames)
ucontext_t uc;
};
auto sigframe = p.io->readObj<rt_sigframe>(prev.regs.sp);
Elf::CoreRegs newRegs;
Elf::CoreRegisters newRegs;
for (int i = 0; i < 31; ++i)
newRegs.regs[i] = sigframe.uc.uc_mcontext.regs[i];
newRegs.sp = sigframe.uc.uc_mcontext.sp;
Expand Down
2 changes: 1 addition & 1 deletion tests/badfp.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int
main(int argc, char *argv[])
{
int c;
void *addr;
void *addr = 0;
while ((c = getopt(argc, argv, "dh")) != -1) {
switch (c) {
case 'h': // handle the fault with a signal handler.
Expand Down

0 comments on commit 2d286b3

Please sign in to comment.