linux数组越界,如何找到数组越界错误?

(gdb) bt

#0 0x000000368d275fd5 in malloc_consolidate () from /lib64/libc.so.6

#1 0x000000368d279c28 in _int_malloc () from /lib64/libc.so.6

#2 0x000000368d27ab1c in malloc () from /lib64/libc.so.6

#3 0x000000368debd09d in operator new(unsigned long) () from /usr/lib64/libstdc++.so.6

#4 0x000000000040fbcd in __gnu_cxx::new_allocator::allocate (this=0x7ffc7e0136d8, __n=4096)

at /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/new_allocator.h:89

#5 0x000000000040f575 in std::_Vector_base >::_M_allocate (this=0x7ffc7e0136d8, __n=4096)

at /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_vector.h:140

#6 0x000000000040f186 in std::vector >::_M_allocate_and_copy (this=0x7ffc7e0136d8,

__n=4096, __first=0x0, __last=0x0) at /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_vector.h:963

#7 0x000000000040e7c7 in std::vector >::reserve (this=0x7ffc7e0136d8, __n=4096)

at /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/vector.tcc:74

#8 0x00000000004cc616 in ByteBuffer::ByteBuffer (this=0x7ffc7e0136c0) at ../../../../src/shared/./util/ByteBuffer.h:19

#9 0x00000000004cb947 in ReplayMgr::SaveToDB (this=0x23a40d0, pBase=0x57a1160) at ./Replay/ReplayMgr.cpp:95

百度了下可能是某个地方数组越界把不该写的内存写坏了

请问有没有什么好的办法检查数组越界的地方具体在哪里?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值