程序在linux下core dump掉,gdb调试core文件
Python Exception <class 'IndexError'> list index out of range
整个程序并没有用python开发
定位到的错误是在respRoomInit
函数调用SnakesBroadMessage
函数过程中变量SFSessionIDList SIDL
在传递函数引用参数的过程中出现的,下图是两个函数的内容
分别定位到两个函数输出SFSessionIDList
的值,在调用SnakesBroadMessage
之前list里面是有一个值的,而进入该函数之后list就为空了,所以估计根本问题不在这里,再别的地方,请问该怎么找?
(gdb) f 9
#9 0x00000000004a186d in SnakeScene::respRoomInit (this=0x7f735800ee90, nSID=...)
at /home/jjq/svn/Snake/SnakesGame/GmScene/GmSceneType/SnakeScene.cpp:983
983 /home/jjq/svn/Snake/SnakesGame/GmScene/GmSceneType/SnakeScene.cpp: No such file or directory.
(gdb) p nSID
$12 = {mSocketId = 16, mSeqId = 18}
(gdb) f 8
Python Exception <class 'IndexError'> list index out of range:
#8 0x00000000004cde44 in SnakesBroadMessage (sids=std::list, cmdId=3, msg=0x7f7379ffaa30, uid=0)
at /home/jjq/svn/Snake/SnakesGame/SnakesActionChain.cpp:47
47 /home/jjq/svn/Snake/SnakesGame/SnakesActionChain.cpp: No such file or directory.
(gdb) p sids
Python Exception <class 'IndexError'> list index out of range:
$13 = std::list
用
gdb
给你的那个变量打一个watch
,看看进入前后有什么线程访问修改了它