查看上下文
程序运行过程中,可以发送 47 号信号查看进程或线程上下文内容。SylixOS 的 47 号信号为 SIGSTKSHOW,线程捕获到这个信号后,会将对应线程任务堆栈中的程序信息打印到串口终端。
47 号信号发送格式:
kill -n 47 [pid | tid]
该方式可用于程序处于非正常运行逻辑时的状态判断。
# kill -n 47 3
[16] 0x4913a0d4 (kernel@0x0+0x4913a0d4 API_BacktraceShow+52)
[15] 0x4928b7b4 (kernel@0x0+0x4928b7b4 __siglongjmpSetup+2172)
[14] 0x4928bdb8 (kernel@0x0+0x4928bdb8 _sigPendGet+856)
[13] 0x4928bd10 (kernel@0x0+0x4928bd10 _sigPendGet+688)
[12] 0x4911bcbc (kernel@0x0+0x4911bcbc _Schedule+164)
[11] 0x4911afcc (kernel@0x0+0x4911afcc __kernelExitIrq+116)
[10] 0x49137358 (kernel@0x0+0x49137358 API_TimeSleepEx+240)
[09] 0x49137a30 (kernel@0x0+0x49137a30 sleep+72)
[08] 0x80020a0c (/apps/appdemo/appdemo@0x80020000+0xa0c main+36)
[07] 0x80055e70 (/lib/libvpmpdm.so@0x80040000+0x15e70 _start+464)
[06] 0x49167958 (kernel@0x0+0x49167958 vprocRun+632)
[05] 0x49167dd8 (kernel@0x0+0x49167dd8 API_ModuleRunEx+112)
[04] 0x49164e40 (kernel@0x0+0x49164e40 __ldGetFilePath+616)
[03] 0x492306d0 (kernel@0x0+0x492306d0 __tshellExec+1552)
[02] 0x492308a0 (kernel@0x0+0x492308a0 __tshellExec+2016)
[01] 0x4911ef74 (kernel@0x0+0x4911ef74 _ThreadShell+76)
PSTATE = nzCvDAIF
PC = 0x000000004911bcbc
SP = 0x00000000800110b0
LR(X30) = 0x000000004911bcbc
X0 = 0x0000000000000340 X1 = 0x0000000049b74200
X2 = 0x000000004c9a76a8 X3 = 0x0000000049ccc7c0
X4 = 0x0000000000000000 X5 = 0x000000000000000a
X6 = 0x0000000000000000 X7 = 0x7f7f7f7f7f7f7f7f
X8 = 0x0101010101010101 X9 = 0x7f7f7fff7f7f7f7f
X10 = 0x0000000000000000 X11 = 0x0101010101010101
X12 = 0x0000000000000008 X13 = 0xffffffffffffffff
X14 = 0xffffffffffffff00 X15 = 0xffffffffffffffff
X16 = 0x000000008006a518 X17 = 0x000000004914a750
X18 = 0x0000000000000012 X19 = 0x0000000049ccc7c0
X20 = 0x0000000049ccc7c0 X21 = 0x00000000000238f0
X22 = 0x0000000049ccc7c0 X23 = 0x0000000000000001
X24 = 0x0000000049aa3000 X25 = 0x0000000049ccc000
X26 = 0x0000000049b74620 X27 = 0x0000000049a8a500
X28 = 0x0000000049b74200 X29 = 0x00000000800110b0