Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

及其简单修改源代码后出错!

zilaiye
2010-03-28
2012-10-08
  • zilaiye
    zilaiye
    2010-03-28

    古老师;您好!
    我在一台电脑上搭建了sector2.1版本(revision 394),运行正常。
    然后我在client.h中加了一个int变量,在构造函数的初始划列表中初始其为0,调试通过后执行sysinfo,出现
    malloc(): memory
    corruption错误,gdb跟踪发现最终程序执行到client::init()中的SectorError::init()的
    s_mErrorMsg = "unknown error.";百思不得其解,望老师能指点下。。。谢谢


    glibc detected ./sysinfo: malloc(): memory corruption: 0x085fe8e0 ***
    ======= Backtrace: =========
    /lib/tls/i686/cmov/libc.so.6
    /lib/tls/i686/cmov/libc.so.6
    /lib/tls/i686/cmov/libc.so.6(libc_malloc+0x58)
    /usr/lib/libstdc++.so.6(_Znwj+0x27)
    /home/superman/sector/sector-sphere/lib/libcommon.so(_ZN9
    gnu_cxx13new_alloca
    torISt13_Rb_tree_nodeISt4pairIKiSsEEE8allocateEjPKv+0x48)
    /home/superman/sector/sector-sphere/lib/libcommon.so(ZNSt8_Rb_treeIiSt4pairIK
    iSsESt10_Select1stIS2_ESt4lessIiESaIS2_EE11_M_get_nodeEv+0x2d)
    /home/superman/sector/sector-sphere/lib/libcommon.so(_ZNSt8_Rb_treeIiSt4pairIK
    iSsESt10_Select1stIS2_ESt4lessIiESaIS2_EE14_M_create_nodeERKS2
    +0x1f)
    /home/superman/sector/sector-sphere/lib/libcommon.so(ZNSt8_Rb_treeIiSt4pairIK
    iSsESt10_Select1stIS2_ESt4lessIiESaIS2_EE10_M_insert_EPKSt18_Rb_tree_node_base
    SB_RKS2
    +0x84)
    /home/superman/sector/sector-sphere/lib/libcommon.so(ZNSt8_Rb_treeIiSt4pairIK
    iSsESt10_Select1stIS2_ESt4lessIiESaIS2_EE16_M_insert_uniqueERKS2
    +0x10e)
    /home/superman/sector/sector-sphere/lib/libcommon.so(ZNSt8_Rb_treeIiSt4pairIK
    iSsESt10_Select1stIS2_ESt4lessIiESaIS2_EE17_M_insert_unique_ESt23_Rb_tree_cons
    t_iteratorIS2_ERKS2
    +0xe1)
    /home/superman/sector/sector-sphere/lib/libcommon.so(ZNSt3mapIiSsSt4lessIiESa
    ISt4pairIKiSsEEE6insertESt17_Rb_tree_iteratorIS4_ERKS4
    +0x45)
    /home/superman/sector/sector-
    sphere/lib/libcommon.so(ZNSt3mapIiSsSt4lessIiESaISt4pairIKiSsEEEixERS3+0xef)
    /home/superman/sector/sector-
    sphere/lib/libcommon.so(_ZN11SectorError4initEv+0x3c)
    /home/superman/sector/sector-
    sphere/lib/libclient.so(_ZN6Client4initERKSsRKi+0x64)
    /home/superman/sector/sector-
    sphere/lib/libclient.so(_ZN6Sector4initERKSsRKi+0x48)
    ./sysinfo
    /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)
    ./sysinfo

     
  • Yunhong Gu
    Yunhong Gu
    2010-03-28

    可能你需要make clean; make

     
  • zilaiye
    zilaiye
    2010-03-29

    谢谢~,原来是要先clean掉已有的.o文件。
    我纯属尝试性的为sector写了个shell,这样在shell下敲命令不用加 “./“ ,并加了个cd 命令,这样就不用老是写长长的绝对路径了。
    古老师要是有兴趣看看,我可以将代码发给您,呵呵。

     
  • zilaiye
    zilaiye
    2010-03-29

    还有个疑问,系统若是有多个master在运行,关了第一个运行的master后,系统是否还能正常运行?

     
  • tao jiang
    tao jiang
    2010-04-03

    好色仙人,你犯了个错哈:是谷老师!