程序的功能很简单,FPGA每20ms产生一个中断,ARM端内核收到中断后,会向程序发出一个信号,程序的信号处理函数就会将一段mmap后的内存中的数据通过网口发出去,每次的数据量大概有30K。收发数据是新的线程,主线程保持阻塞在accept处。
目前的问题是,程序在运行一段时间后,会死机,但是进程还在,表现为网口的收发功能异常。下面的??就是gdb直接显示的字符。
--------------------------------------------------------------------------------------
正常运行时,用gdb看到的信息为:
(gdb) info thread
Id Target Id Frame
* 1 Thread 1319.1319 "zynq_cosw." 0xb6ebda2c in accept () from target:/lib/libpthread.so.0
2 Thread 1319.1320 "zynq_cosw." 0xb6eb9a2c in pthread_cond_wait () from target:/lib/libpthread.so.0
3 Thread 1319.1321 "zynq_cosw." 0xb6eb9a2c in pthread_cond_wait () from target:/lib/libpthread.so.0
4 Thread 1319.1322 "zynq_cosw." 0xb6eb9a2c in pthread_cond_wait () from target:/lib/libpthread.so.0
5 Thread 1319.1323 "zynq_cosw." 0xb6eb9a2c in pthread_cond_wait () from target:/lib/libpthread.so.0
6 Thread 1319.1324 "zynq_cosw." 0xb6eb9a2c in pthread_cond_wait () from target:/lib/libpthread.so.0
7 Thread 1319.1325 "zynq_cosw." 0xb6eb9a2c in pthread_cond_wait () from target:/lib/libpthread.so.0
8 Thread 1319.1326 "zynq_cosw." 0xb6ebdbac in recv () from target:/lib/libpthread.so.0
9 Thread 1319.1327 "zynq_cosw." 0xb6eb9a2c in pthread_cond_wait () from target:/lib/libpthread.so.0
(gdb) thread 1
[Switching to thread 1 (Thread 1319.1319)]
#0 0xb6ebda2c in accept () from target:/lib/libpthread.so.0
(gdb) bt
#0 0xb6ebda2c in accept () from target:/lib/libpthread.so.0
#1 0x0001165c in launchSocketServer () at ../src/mts_socket.c:177
#2 0x00015854 in main () at ../src/zynq_cosw.c:134
(gdb)
------------------------------------------------------------------------------------
但是出错时,gdb捕获的信息为:
(gdb) info thread
Id Target Id Frame
* 1 Thread 1255.1255 "zynq_cosw." 0xb6da2b80 in ?? () from target:/lib/libc.so.6
2 Thread 1255.1256 "zynq_cosw." 0xb6ebea2c in pthread_cond_wait () from target:/lib/libpthread.so.0
3 Thread 1255.1257 "zynq_cosw." 0xb6ebea2c in pthread_cond_wait () from target:/lib/libpthread.so.0
4 Thread 1255.1258 "zynq_cosw." 0xb6ebea2c in pthread_cond_wait () from target:/lib/libpthread.so.0
5 Thread 1255.1259 "zynq_cosw." 0xb6ebea2c in pthread_cond_wait () from target:/lib/libpthread.so.0
6 Thread 1255.1260 "zynq_cosw." 0xb6ebea2c in pthread_cond_wait () from target:/lib/libpthread.so.0
7 Thread 1255.1261 "zynq_cosw." 0xb6ebea2c in pthread_cond_wait () from target:/lib/libpthread.so.0
8 Thread 1255.1262 "zynq_cosw." 0xb6ec2bac in recv () from target:/lib/libpthread.so.0
9 Thread 1255.1263 "zynq_cosw." 0xb6ebea2c in pthread_cond_wait () from target:/lib/libpthread.so.0
(gdb) thread 1
[Switching to thread 1 (Thread 1255.1255)]
#0 0xb6da2b80 in ?? () from target:/lib/libc.so.6
(gdb) bt
#0 0xb6da2b80 in ?? () from target:/lib/libc.so.6
#1 0x00000002 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) print $pc
$1 = (void (*)()) 0xb6da2b80
(gdb) disassemble 0xb6da2b70,0xb6da2b90
Dump of assembler code from 0xb6da2b70 to 0xb6da2b90:
0xb6da2b70: popeq {r7, pc}
0xb6da2b74: mov r2, #2
0xb6da2b78: mov r3, #0
0xb6da2b7c: mov r7, #240 ; 0xf0
=> 0xb6da2b80: svc 0x00000000
0xb6da2b84: b 0xb6da2b50
0xb6da2b88: mrc 15, 0, r1, cr13, cr0, {3}
0xb6da2b8c: ldr r0, [r1, #-1084] ; 0xfffffbc4
--------------------------------------------------------------------------------
主线程为什么会执行到svc去呢?没有新的网络连接,和信号有关系吗?
出现的概率也不稳定,有时候运行一天都不出现,有时候运行2个小时就会出现。
麻烦各位帮忙指导看下是什么原因?或者有没有解决的思路呢?程序中的malloc/free函数全部替换为静态的存储了,还是会这样。。。谢啦。
--
FROM 111.183.49.*