Skip to content

Commit

Permalink
backtrace: use CURRENT_REGS when in interrupt context
Browse files Browse the repository at this point in the history
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
  • Loading branch information
zhangyuan21 authored and davids5 committed Jan 29, 2023
1 parent ade9d39 commit e6d2f06
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions arch/arm/src/common/arm_backtrace_fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ int up_backtrace(struct tcb_s *tcb,
{
ret += backtrace(rtcb->stack_base_ptr,
rtcb->stack_base_ptr + rtcb->adj_stack_size,
(void *)rtcb->xcp.regs[REG_FP],
(void *)rtcb->xcp.regs[REG_PC],
(void *)CURRENT_REGS[REG_FP],
(void *)CURRENT_REGS[REG_PC],
&buffer[ret], size - ret, &skip);
}
}
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/common/arm_backtrace_sp.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ int up_backtrace(struct tcb_s *tcb,
ret += backtrace_branch((unsigned long)
rtcb->stack_base_ptr +
rtcb->adj_stack_size,
rtcb->xcp.regs[REG_SP],
CURRENT_REGS[REG_SP],
&buffer[ret],
size - ret, &skip);
}
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/src/common/arm_backtrace_unwind.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,9 @@ int up_backtrace(struct tcb_s *tcb,
ret = backtrace_unwind(&frame, buffer, size, &skip);
if (ret < size)
{
frame.fp = rtcb->xcp.regs[REG_FP];
frame.sp = rtcb->xcp.regs[REG_SP];
frame.pc = rtcb->xcp.regs[REG_PC];
frame.fp = CURRENT_REGS[REG_FP];
frame.sp = CURRENT_REGS[REG_SP];
frame.pc = CURRENT_REGS[REG_PC];
frame.lr = 0;
frame.stack_top = (unsigned long)rtcb->stack_base_ptr +
rtcb->adj_stack_size;
Expand Down
4 changes: 2 additions & 2 deletions arch/risc-v/src/common/riscv_backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip)
{
ret += backtrace(rtcb->stack_base_ptr,
rtcb->stack_base_ptr + rtcb->adj_stack_size,
(void *)rtcb->xcp.regs[REG_FP],
(void *)rtcb->xcp.regs[REG_EPC],
(void *)CURRENT_REGS[REG_FP],
(void *)CURRENT_REGS[REG_EPC],
&buffer[ret], size - ret, &skip);
}
}
Expand Down
4 changes: 2 additions & 2 deletions arch/xtensa/src/common/xtensa_backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip)
#endif
ret += backtrace_stack(rtcb->stack_base_ptr,
rtcb->stack_base_ptr + rtcb->adj_stack_size,
(void *)rtcb->xcp.regs[REG_A1],
(void *)rtcb->xcp.regs[REG_A0],
(void *)CURRENT_REGS[REG_A1],
(void *)CURRENT_REGS[REG_A0],
&buffer[ret], size - ret, &skip);
}
else
Expand Down

0 comments on commit e6d2f06

Please sign in to comment.