超牛的debug# Programming - 葵花宝典
c*n
1 楼
又一个衰人写的程序, 要拿来用,
出segfault
我就拼命查,
gdb where 出来看居然事malloc() 自己segfault
library 怎么会出错那???
幸好有另外一个地方出绰,一个文件名最后的一个子母
编成乱码了,
怎么会这样呢? 就在程序里加了一个全程变量,
进入,stop,
set my_new_var=changed_char_of_filename
然后watch my_new_var
结果是那个malloc() 开到了filename 上了,
再一看,这个衰人给filename 最开始malloc() 的地方缺\000
ft to death
then afterwards, got another strange segfault with malloc()
this time I have not idea who was writing into unallocated space,
so I had to use valgrind,
it was pretty cool, turns out it was the same stupid err
出segfault
我就拼命查,
gdb where 出来看居然事malloc() 自己segfault
library 怎么会出错那???
幸好有另外一个地方出绰,一个文件名最后的一个子母
编成乱码了,
怎么会这样呢? 就在程序里加了一个全程变量,
进入,stop,
set my_new_var=changed_char_of_filename
然后watch my_new_var
结果是那个malloc() 开到了filename 上了,
再一看,这个衰人给filename 最开始malloc() 的地方缺\000
ft to death
then afterwards, got another strange segfault with malloc()
this time I have not idea who was writing into unallocated space,
so I had to use valgrind,
it was pretty cool, turns out it was the same stupid err