apache / nuttx

Apache NuttX is a mature, real-time embedded operating system (RTOS)
https://nuttx.apache.org/
Apache License 2.0
2.81k stars 1.16k forks source link

[BUG] kernel mode gets stuck at the system call layer during backtrace to user mode #14467

Open gneworld opened 1 week ago

gneworld commented 1 week ago

Description / Steps to reproduce the issue

build system in protect mode or kernel mode

  1. make a breakpoint at function uart_read
  2. type any character in the nsh shell

As you can see, the back trace process is stuck at dispatch_syscall function

image

However, xtensa can handle this case correctly by disguising a system call as a regular function call.

image

In my opinion, the unwind sections about .ARM.extab and.ARM.exidx which are completely different sets of sections in kernel mode file and user mode file. So is it impossible to make backtrace in this case theoretically or is there any way to solve this problem?

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

ubuntu 18.04 x64

NuttX Version

master

Issue Architecture

[Arch: arm]

Issue Area

[Area: Debugging]

Verification

acassis commented 1 week ago

@anchao @xiaoxiang781216 any idea?

xiaoxiang781216 commented 1 week ago

xtensa has the special code which adjust the stack layout to make gdb pass through syscall boundary, @tmedicci does extensa trick apply to arm arch too?