zhuyanlinzyl opened a new pull request #4810:
URL: https://github.com/apache/incubator-nuttx/pull/4810


   ## Summary
   Patch 1: add tcb strcut for task-aware debug information
   Patch 2: add tcbinfo struct in procfs
   Patch 3: add plugin in JLinkGDBServer for nuttx thread aware
   ## Impact
   
   No. Enhance nuttx debug feature.
   
   ## Testing
   
   When nuttx config with `CONFIG_DEBUG_TCBINFO`.
   We can debug nuttx with nuttx thread aware.
   
   ```
   make -f Makefile.host jlink-nuttx.so
   JLinkGDBServer -if SWD -device Cortex-M55 -rtos 
/home/zyl/miwear/nuttx/tools/jlink-nuttx
   
   
   1  show nuttx threads
   
   ```
     Id   Target Id                                           Frame 
   * 2    Thread 1 ([PID:000]Idle Task:0003[PRI:000])         nx_start () at 
init/nx_start.c:797
     3    Thread 2 ([PID:001]hpwork:0005[PRI:224])            arm_switchcontext 
(saveregs=0x3c00927c, restoreregs=0x3c00c5ac) at 
/home/zyl/code/m1ap/nuttx/include/arch/armv8-m/syscall.h:121
     4    Thread 19 ([PID:018]rpmsg-uorb-sens:0005[PRI:100])  arm_switchcontext 
(saveregs=0x3c015fbc, restoreregs=0x3c00efdc) at 
/home/zyl/code/m1ap/nuttx/include/arch/armv8-m/syscall.h:121
     5    Thread 4 ([PID:003]bes_main:0005[PRI:101])          arm_switchcontext 
(saveregs=0x3c00ae1c, restoreregs=0x3c00a2ec) at 
/home/zyl/code/m1ap/nuttx/include/arch/armv8-m/syscall.h:121
     6    Thread 5 ([PID:004]rptun:0005[PRI:224])             arm_switchcontext 
(saveregs=0x3c00c5ac, restoreregs=0x3c010fac) at 
/home/zyl/code/m1ap/nuttx/include/arch/armv8-m/syscall.h:121
     7    Thread 6 ([PID:005]rptun:0005[PRI:224])             arm_switchcontext 
(saveregs=0x3c00d43c, restoreregs=0x3c012acc) at 
/home/zyl/code/m1ap/nuttx/include/arch/armv8-m/syscall.h:121
     8    Thread 7 ([PID:006]rptun:0005[PRI:224])             arm_switchcontext 
(saveregs=0x3c00e29c, restoreregs=0x2000972c <g_idletcb+140>) at 
/home/zyl/code/m1ap/nuttx/include/arch/armv8-m/syscall.h:121
     9    Thread 8 ([PID:007]init:0005[PRI:100])              arm_switchcontext 
(saveregs=0x3c00efdc, restoreregs=0x2000972c <g_idletcb+140>) at 
/home/zyl/code/m1ap/nuttx/include/arch/armv8-m/syscall.h:121
     10   Thread 11 ([PID:010]thread-10:0005[PRI:101])        arm_switchcontext 
(saveregs=0x3c00a2ec, restoreregs=0x3c00efdc) at 
/home/zyl/code/m1ap/nuttx/include/arch/armv8-m/syscall.h:121
     11   Thread 13 ([PID:012]kvdbd:0005[PRI:100])            arm_switchcontext 
(saveregs=0x3c011cfc, restoreregs=0x3c013cdc) at 
/home/zyl/code/m1ap/nuttx/include/arch/armv8-m/syscall.h:121
     12   Thread 14 ([PID:013]rpmsg-gpio:0005[PRI:224])       arm_switchcontext 
(saveregs=0x3c012acc, restoreregs=0x3c00efdc) at 
/home/zyl/code/m1ap/nuttx/include/arch/armv8-m/syscall.h:121
     13   Thread 15 ([PID:014]rpmsg-uorb-audio:0005[PRI:100]) arm_switchcontext 
(saveregs=0x3c013cdc, restoreregs=0x3c014e2c) at 
/home/zyl/code/m1ap/nuttx/include/arch/armv8-m/syscall.h:121
     14   Thread 16 ([PID:015]rpmsg-uorb-cp:0005[PRI:100])    arm_switchcontext 
(saveregs=0x3c014e2c, restoreregs=0x3c015fbc) at 
/home/zyl/code/m1ap/nuttx/include/arch/armv8-m/syscall.h:121
   
   2 change nuttx thread 
   
   ```
   (gdb) thread 4
   [Switching to thread 4 (Thread 19)]
   #0  arm_switchcontext (saveregs=0x3c015fbc, restoreregs=0x3c00efdc) at 
/home/zyl/code/m1ap/nuttx/include/arch/armv8-m/syscall.h:121
   121          return reg0;
   
   
   3 show  task backtrace 
   
   ```
   (gdb) bt
   #0  arm_switchcontext (saveregs=0x3c015fbc, restoreregs=0x3c00efdc) at 
/home/zyl/code/m1ap/nuttx/include/arch/armv8-m/syscall.h:121
   #1  0x2c016ab6 in up_block_task (tcb=tcb@entry=0x3c015f30, 
task_state=task_state@entry=TSTATE_WAIT_SEM) at armv8-m/arm_blocktask.c:139
   #2  0x2c008338 in nxsem_wait (sem=sem@entry=0x3c016b44) at 
semaphore/sem_wait.c:153
   #3  0x2c03d054 in poll_semtake (sem=0x3c016b44) at vfs/fs_poll.c:59
   #4  nx_poll (fds=fds@entry=0x3c015ca8, nfds=32, timeout=1006721824) at 
vfs/fs_poll.c:439
   #5  0x2c03d0c0 in poll (fds=fds@entry=0x3c015ca8, nfds=<optimized out>, 
timeout=<optimized out>) at vfs/fs_poll.c:500
   #6  0x2c00927c in ppoll (fds=fds@entry=0x3c015ca8, nfds=738386121, 
nfds@entry=32, timeout_ts=timeout_ts@entry=0x0, 
sigmask=sigmask@entry=0x3c016c00) at signal/sig_ppoll.c:122
   #7  0x2c02e0c8 in uorb_rpmsg_task (argc=<optimized out>, argv=<optimized 
out>) at uORB/uORBRpmsg.cpp:404
   #8  0x2c00fa42 in nxtask_startup (entrypt=entrypt@entry=0x2c02dfd5 
<uorb_rpmsg_task(int, char**)>, argc=<optimized out>, argv=<optimized out>) at 
sched/task_startup.c:151
   #9  0x2c00971a in nxtask_start () at task/task_start.c:130
   #10 0x00000000 in ?? ()
   Backtrace stopped: previous frame identical to this frame (corrupt stack?)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to