You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/07/30 04:47:28 UTC

[GitHub] [incubator-nuttx-apps] anchao opened a new pull request #817: system/dumpstack: add dump stack tool support

anchao opened a new pull request #817:
URL: https://github.com/apache/incubator-nuttx-apps/pull/817


   ## Summary
   
   system/dumpstack: add dump stack tool support 
   
   add support for printing the arbitrary thread stack in runtime to monitor the thread status
   ( only support cortex-m / cortex-a(thumb) )
   
   libs/libc: move the backtrace implement to sched
   arch/cortex-m: add arch backtrace support 
   sched/backtrace: add sched_backtrace support 
   
   ## Impact
   
   N/A, new feature
   
   ## Testing
   
   Running tasks:
   
   ```
   ap> ps
     PID GROUP PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED    CPU COMMAND
       0     0   0 FIFO     Kthread N-- Ready              00000000 003052 001044  34.2%   94.4% Idle Task
       1     1 253 RR       Kthread --- Waiting  Semaphore 00000000 003044 000344  11.3%    0.0% hpwork 0x2011dc34
       2     2 253 RR       Kthread --- Waiting  Semaphore 00000000 003044 000344  11.3%    0.0% hpwork 0x2011dc34
       3     3 253 RR       Kthread --- Waiting  Semaphore 00000000 003044 000344  11.3%    0.0% hpwork 0x2011dc34
       4     4 110 RR       Kthread --- Waiting  Semaphore 00000000 008164 000824  10.0%    1.6% lpwork 0x2011dc28
       5     5 110 RR       Kthread --- Waiting  Semaphore 00000000 008164 001592  19.5%    0.0% lpwork 0x2011dc28
       6     6 110 RR       Kthread --- Waiting  Semaphore 00000000 008164 001544  18.9%    0.5% lpwork 0x2011dc28
       8     8 101 RR       Kthread --- Waiting  Semaphore 00000000 004060 001896  46.6%    0.0% bes_main  0x34008650
       9     9 252 RR       Kthread --- Waiting  MQ empty  00000000 006108 000488   7.9%    0.0% app_thread  0x34007924
      10    10 253 RR       Kthread --- Waiting  Semaphore 00000000 008124 000504   6.2%    0.0% audio_flinger  0x20042968
      11    11 100 RR       Kthread --- Waiting  Signal    00000000 003028 000472  15.5%    0.0% apps_recover  0x34007944
      12    12 252 RR       Kthread --- Waiting  MQ empty  00000000 010180 000504   4.9%    0.0% net_wq  0x20044d60
      13    13 252 RR       Kthread --- Waiting  MQ empty  00000000 008132 000480   5.9%    0.0% net_tasklet  0x20044d28
      14    14 252 RR       Kthread --- Waiting  Semaphore 00000000 004036 000920  22.7%    0.0% cw1200_bh  0x20044e14
      15    15 224 RR       Kthread --- Waiting  Semaphore 00000000 004060 000636  15.6%    0.0% rptun audio 0x20147250
      16    16 100 RR       Task    --- Waiting  Semaphore 00000000 004060 000368   9.0%    0.0% rc_raw_event_thx 0x20148f70
      17    17 100 RR       Task    --- Running            00000000 004084 001824  44.6%    0.5% init
      18    18 100 RR       Task    --- Waiting  Semaphore 00000000 004084 002384  58.3%    0.0% kvdbd
      20    20 252 RR       Task    --- Waiting  Semaphore 00000000 004060 000536  13.2%    0.0% rpmsg-uorb-audio 0x20157650
      21    21 232 RR       Task    --- Waiting  Semaphore 00000000 006132 001808  29.4%    0.0% usrsock
      23    23 227 FIFO     Kthread --- Waiting  Semaphore 00000000 001984 000712  35.8%    0.0% BT TX  0x201575f0
      24    24 228 FIFO     Kthread --- Waiting  Semaphore 00000000 004032 000880  21.8%    0.5% BT RX  0x201575f0
      25    25 230 FIFO     Kthread --- Waiting  Semaphore 00000000 001984 000576  29.0%    0.0% BT ECC  0x201575f0
      26    26 228 FIFO     Kthread --- Waiting  Semaphore 00000000 004032 000944  23.4%    2.7% BT Driver  0x201575f0
      27    27 101 RR       Kthread --- Waiting  MQ empty  00000000 004060 000608  14.9%    0.0% wifi_event  0x34008524
      28    28 252 RR       Kthread --- Waiting  MQ empty  00000000 004052 000568  14.0%    0.0% bes_netdev_wq
      29    29 100 RR       Kthread --- Waiting  Signal    00000000 004052 000520  12.8%    0.0% trans_stat_task  0x34008504
      30    30 100 RR       Kthread --- Ready              00000000 003036 000552  18.1%    0.0% temp_main  0x34008630
   
   ```
   
   show task 1 hpwork:
   
   ```
   ap> dumpstack 1
   [06:14:18] [32] [BackTrace| 1|0]:   0xc0e635c   0x2111b6   0x2111d6  0xc0d7b06   0x2128a8
   ```
   
   check the backtrace:
   ```
   arm-none-eabi-addr2line -e nuttx 0xc0e635c   0x2111b6   0x2111d6  0xc0d7b06   0x2128a8
   /home/archer/code/m3/nuttx/arch/arm/src/armv8-m/arm_switchcontext.S:79
   /home/archer/code/m3/nuttx/sched/semaphore/sem_wait.c:153 (discriminator 2)
   /home/archer/code/m3/nuttx/sched/semaphore/sem_wait.c:222 (discriminator 1)
   /home/archer/code/m3/nuttx/sched/wqueue/kwork_thread.c:132
   /home/archer/code/m3/nuttx/sched/task/task_start.c:139
   ```
   
   dump stack in range 0 - 30:
   
   ```
   ap> dumpstack 0 30
   [06:14:27] [33] [BackTrace| 0|0]:    0x240420   0x240184 0x2400460b
   [06:14:27] [33] [BackTrace| 1|0]:   0xc0e635c   0x2111b6   0x2111d6  0xc0d7b06   0x2128a8
   [06:14:27] [33] [BackTrace| 2|0]:   0xc0e635c   0x2111b6   0x2111d6  0xc0d7b06   0x2128a8
   [06:14:27] [33] [BackTrace| 3|0]:   0xc0e635c   0x2111b6   0x2111d6  0xc0d7b06   0x2128a8
   [06:14:27] [33] [BackTrace| 4|0]:   0xc0e635c   0x2111b6   0x2111d6  0xc0d7b06   0x2128a8
   [06:14:27] [33] [BackTrace| 5|0]:   0xc0e635c   0x2111b6   0x2111d6  0xc0d7b06   0x2128a8
   [06:14:27] [33] [BackTrace| 6|0]:   0xc0e635c   0x2111b6   0x2111d6  0xc0d7b06   0x2128a8
   [06:14:27] [33] [BackTrace| 8|0]:   0xc0e635c   0x2111b6   0x2111d6   0x2103a4   0x210170   0x222556  0xc1ddad0   0x2128a8
   [06:14:27] [33] [BackTrace| 9|0]:   0xc0e635c   0x20f8b6   0x20f68e   0x222b1e  0xc1b066a  0xc1b0696   0x2128a8
   [06:14:27] [33] [BackTrace|10|0]:   0xc0e635c   0x2111b6   0x2111d6   0x2103a4   0x210170   0x222556   0x20df16   0x2128a8
   [06:14:27] [33] [BackTrace|11|0]:   0xc0e635c   0x211b6a   0x2121a8   0x212268  0xc0e5080  0xc1f6724   0x2128a8
   [06:14:27] [33] [BackTrace|12|0]:   0xc0e635c   0x20f8b6   0x20f68e   0x222b1e   0x22d968   0x2128a8
   [06:14:27] [33] [BackTrace|13|0]:   0xc0e635c   0x20f8b6   0x20f68e   0x2229ac   0x22e702   0x2128a8
   [06:14:27] [33] [BackTrace|14|0]:   0xc0e635c   0x2111b6   0x2111e2   0x222732   0x23e90e   0x2128a8
   [06:14:27] [33] [BackTrace|15|0]:   0xc0e635c   0x2111b6   0x2113a0   0x2113da  0xc0daa9c   0x2128a8
   [06:14:27] [33] [BackTrace|16|0]:   0xc0e635c   0x2111b6  0xc0e7b62  0xc0e07e4   0x2128bc
   [06:14:27] [33] [BackTrace|17|0]:   0xc0e635c   0x211bac   0x210d38   0x210d8e  0xc0fd872  0xc0fa42a  0xc0fd4e4  0xc0fe43c
   [06:14:27] [33] [BackTrace|17|1]:   0xc0fe912  0xc0e07e4   0x2128bc
   [06:14:27] [33] [BackTrace|18|0]:   0xc0e635c   0x2111b6  0xc196746  0xc1967b6  0xc134324  0xc1345dc  0xc0e07e4   0x2128bc
   [06:14:27] [33] [BackTrace|20|0]:   0xc0e635c   0x2111b6  0xc196746  0xc1967b6   0x2122fa  0xc108db4  0xc0e07e4   0x2128bc
   [06:14:27] [33] [BackTrace|21|0]:   0xc0e635c   0x2111b6  0xc196746  0xc1967b6  0xc103e1c 0xdeadbeec
   [06:14:27] [33] [BackTrace|23|0]:   0xc0e635c   0x2111b6   0x2111e2  0xc16f02e  0xc16ecee  0xc154a90  0xc16f36a   0x2128a8
   [06:14:27] [33] [BackTrace|24|0]:   0xc0e635c   0x2111b6   0x2111e2  0xc16f02e  0xc16ecee  0xc16f2c2  0xc16f5f0  0xc15494c
   [06:14:27] [33] [BackTrace|24|1]:   0xc16f36a   0x2128a8
   [06:14:27] [33] [BackTrace|25|0]:   0xc0e635c   0x2111b6   0x2111e2  0xc16f02e  0xc15381c  0xc16f36a   0x2128a8
   [06:14:27] [33] [BackTrace|26|0]:   0xc0e635c   0x2111b6   0x2111d6  0xc0e8d9e  0xc0dd790  0xc0dd82c  0xc16fb80  0xc16fbbe
   [06:14:27] [33] [BackTrace|26|1]:   0xc16f36a   0x2128a8
   [06:14:27] [33] [BackTrace|27|0]:   0xc0e635c   0x20f8b6   0x20f68e   0x222b1e  0xc1d4b3c   0x2128a8
   [06:14:27] [33] [BackTrace|28|0]:   0xc0e635c   0x20f8b6   0x20f68e   0x223b04   0x2128a8
   [06:14:27] [33] [BackTrace|29|0]:   0xc0e635c   0x211b6a   0x2121a8   0x212268  0xc0e5080  0xc1d419a   0x2128a8
   [06:14:27] [33] [BackTrace|30|0]:   0xc0e635c   0x211b6a   0x2121a8   0x212268  0xc0e5080  0xc1dd748   0x2128a8
   ```
   
   
   


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx-apps] xiaoxiang781216 merged pull request #817: system/dumpstack: add dump stack tool support

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #817:
URL: https://github.com/apache/incubator-nuttx-apps/pull/817


   


-- 
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-unsubscribe@nuttx.apache.org

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