使用omnet ++

时间:2015-04-27 11:49:31

标签: c++ gdb std valgrind omnet++

我正在使用omnet ++&amp ;;进行网络模拟。静脉(v2.0-rc1),为此我试验了4个场景,两个场景重复20次。

我在第3和第3版的模拟过程中遇到了一些错误(我猜这是一个内存分配错误)。第4个场景,它们共享一个共同的功能(ack)。

对于有关的模拟,它正常启动并执行一些重复但在此之后失败(例如,它在第4个场景的第5次重复时失败),这是输出:

0: *** glibc detected *** ./veins: free(): invalid next size (fast): 0x00007fff74bff590 ***
0: ======= Backtrace: =========
0: /lib/x86_64-linux-gnu/libc.so.6(+0x76aa6)[0x2aeb29d1faa6]
0: /lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x2aeb29d2484c]
0: /nfs/homes/hc.arslan90/mixim/mixim/examples/veins/../../out/gcc-release/src/modules/libmiximmodules.so(_ZN9ProphetV220executeInitiatorRoleEsP7Prophetl+0x6f4)[0x2aeb287ce334]
0: /nfs/homes/hc.arslan90/mixim/mixim/examples/veins/../../out/gcc-release/src/modules/libmiximmodules.so(_ZN9ProphetV214handleLowerMsgEP8cMessage+0x4b6)[0x2aeb287d0996]
0: /home/dist/hc.arslan90/omnetpp-4.2/lib/liboppsim.so(_ZN11cSimulation10doOneEventEP13cSimpleModule+0xb0)[0x2aeb290135a0]
0: /home/dist/hc.arslan90/omnetpp-4.2/lib/liboppcmdenv.so(_ZN6Cmdenv8simulateEv+0x170)[0x2aeb28a6f620]
0: /home/dist/hc.arslan90/omnetpp-4.2/lib/liboppcmdenv.so(_ZN6Cmdenv3runEv+0x360)[0x2aeb28a6fba0]
0: /home/dist/hc.arslan90/omnetpp-4.2/lib/liboppenvir.so(_ZN9EnvirBase3runEiPPcP14cConfiguration+0x13c)[0x2aeb28ca763c]
0: /home/dist/hc.arslan90/omnetpp-4.2/lib/liboppenvir.so(_Z18setupUserInterfaceiPPc+0x55f)[0x2aeb28ca507f]
0: /home/dist/hc.arslan90/omnetpp-4.2/lib/liboppenvir.so(evMain+0x50)[0x2aeb28ca5d30]
0: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x2aeb29cc7eed]
0: ./veins[0x402f21]

为了调试错误,我使用了valgrind和这个命令:

valgrind --tool=memecheck ./veins (with veins is the current binary of my simulation)

但似乎所有返回的错误与我的代码无关(因为我对以前的代码执行相同的工作正常并且我得到相同的输出)

编辑这里是Valgrind的输出

==7454== Memcheck, a memory error detector
==7454== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==7454== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==7454== Command: ./veins
==7454==  OMNeT++ Discrete Event Simulation  (C) 1992-2011 Andras Varga, OpenSim Ltd. Version: 4.2, build: 111116-7631e2d, edition: Academic Public License -- NOT FOR COMMERCIAL USE See the license for distribution terms and warranty disclaimer Setting up Tkenv... Loading NED files from /media/DATA/DoctoratTlemcen/Git/mixim/mixim/src/base: 17 Loading NED files from /media/DATA/DoctoratTlemcen/Git/mixim/mixim/src/modules: 85 Loading NED files from /media/DATA/DoctoratTlemcen/Git/mixim/mixim/examples: 45
==7454== Invalid read of size 4
==7454==    at 0x4CFD4A2: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4CFFB09: FcConfigFilename (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D141EB: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D09065: FcInitLoadConfig (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D09188: FcInitLoadConfigAndFonts (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D0940C: FcInit (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4CFDCE4: FcConfigGetCurrent (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4CFF87F: FcConfigSubstituteWithPat (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4CFF8C6: FcConfigSubstitute (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x492DBD1: ??? (in /usr/lib/libtk8.5.so.0)
==7454==    by 0x492E0E1: ??? (in /usr/lib/libtk8.5.so.0)
==7454==    by 0x4877A40: Tk_AllocFontFromObj (in /usr/lib/libtk8.5.so.0)
==7454==  Address 0x500cbbc is 20 bytes inside a block of size 22 alloc'd
==7454==    at 0x402D5A9: malloc (vg_replace_malloc.c:296)
==7454==    by 0x4CFD407: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4CFFB09: FcConfigFilename (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D141EB: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D09065: FcInitLoadConfig (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D09188: FcInitLoadConfigAndFonts (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D0940C: FcInit (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4CFDCE4: FcConfigGetCurrent (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4CFF87F: FcConfigSubstituteWithPat (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4CFF8C6: FcConfigSubstitute (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x492DBD1: ??? (in /usr/lib/libtk8.5.so.0)
==7454==    by 0x492E0E1: ??? (in /usr/lib/libtk8.5.so.0)
==7454== 
==7454== Invalid read of size 4
==7454==    at 0x4CFD4B6: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4CFFB09: FcConfigFilename (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D141EB: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D14A63: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4F58D5A: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F59A81: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F568F0: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F58331: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F5B74A: XML_ParseBuffer (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4D14384: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D09065: FcInitLoadConfig (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D09188: FcInitLoadConfigAndFonts (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==  Address 0x5031690 is 16 bytes inside a block of size 18 alloc'd
==7454==    at 0x402D5A9: malloc (vg_replace_malloc.c:296)
==7454==    by 0x4CFD407: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4CFFB09: FcConfigFilename (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D141EB: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D14A63: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4F58D5A: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F59A81: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F568F0: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F58331: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F5B74A: XML_ParseBuffer (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4D14384: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D09065: FcInitLoadConfig (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454== 
==7454== Invalid read of size 4
==7454==    at 0x4CFD4B6: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D141EB: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D146A8: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D14A63: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4F58D5A: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F59A81: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F568F0: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F58331: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F5B74A: XML_ParseBuffer (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4D14384: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D09065: FcInitLoadConfig (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D09188: FcInitLoadConfigAndFonts (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==  Address 0x5007a40 is 40 bytes inside a block of size 42 alloc'd
==7454==    at 0x402D5A9: malloc (vg_replace_malloc.c:296)
==7454==    by 0x4CFD407: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D141EB: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D146A8: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D14A63: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4F58D5A: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F59A81: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F568F0: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F58331: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F5B74A: XML_ParseBuffer (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4D14384: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D09065: FcInitLoadConfig (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454== 
==7454== Invalid read of size 4
==7454==    at 0x4CFD4A2: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D141EB: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D146A8: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D14A63: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4F58D5A: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F59A81: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F568F0: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F58331: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F5B74A: XML_ParseBuffer (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4D14384: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D09065: FcInitLoadConfig (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D09188: FcInitLoadConfigAndFonts (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==  Address 0x4ff0314 is 36 bytes inside a block of size 39 alloc'd
==7454==    at 0x402D5A9: malloc (vg_replace_malloc.c:296)
==7454==    by 0x4CFD407: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D141EB: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D146A8: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D14A63: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4F58D5A: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F59A81: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F568F0: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F58331: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F5B74A: XML_ParseBuffer (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4D14384: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D09065: FcInitLoadConfig (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454== 
==7454== Invalid read of size 4
==7454==    at 0x4CFD4B6: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D141EB: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D14A63: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4F58D5A: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F59A81: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F568F0: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F58331: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F5B74A: XML_ParseBuffer (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4D14384: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D146A8: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D14A63: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4F58D5A: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==  Address 0x4fbe790 is 24 bytes inside a block of size 26 alloc'd
==7454==    at 0x402D5A9: malloc (vg_replace_malloc.c:296)
==7454==    by 0x4CFD407: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D141EB: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D14A63: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4F58D5A: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F59A81: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F568F0: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F58331: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F5B74A: XML_ParseBuffer (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4D14384: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D146A8: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D14A63: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454== 
==7454== Invalid read of size 4
==7454==    at 0x4CFD4A2: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4CFFB09: FcConfigFilename (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D141EB: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D14A63: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4F58D5A: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F59A81: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F568F0: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F58331: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F5B74A: XML_ParseBuffer (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4D14384: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D146A8: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D14A63: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==  Address 0x4fc7164 is 20 bytes inside a block of size 22 alloc'd
==7454==    at 0x402D5A9: malloc (vg_replace_malloc.c:296)
==7454==    by 0x4CFD407: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4CFFB09: FcConfigFilename (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D141EB: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D14A63: ??? (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4F58D5A: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F59A81: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F568F0: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F58331: ??? (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4F5B74A: XML_ParseBuffer (in /lib/i386-linux-gnu/libexpat.so.1.5.2)
==7454==    by 0x4D14384: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454==    by 0x4D146A8: FcConfigParseAndLoad (in /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4)
==7454== 

Loading images from /media/DATA/DoctoratTlemcen/Git/mixim/mixim/examples/veins/bitmaps: *: 0   Loading images from ./bitmaps: *: 0   Loading images from ./images: *: 0   Loading images from /home/arslan/Bureau/Doctorat/SIM_Tools_Arslan/omnetpp-4.2/images: *: 0 abstract/*: 90  background/*: 4  block/*: 320  device/*: 195  maps/*: 9  misc/*: 70  msg/*: 55  old/*: 111  status/*: 28  

Plugin path: ./plugins

RUNTIME ERROR. A cRuntimeError exception is about to be thrown, and you requested (by setting debug-on-errors=true in the ini file) that errors abort execution and break into the debugger.

You should now probably be running the simulation under gdb or another debugger. The simulation kernel will now raise a SIGABRT signal which will get you into the debugger. If you are not running under a debugger, you can still use the core dump for post-mortem debugging. Once in the debugger, view the call stack (in gdb: "bt" command) to see the context of the runtime error.

<!> Error in module (cCompoundModule) scenario (id=1) during network setup: Class "ObstacleControl" not found -- perhaps its code was not linked in, or the class wasn't registered with Register_Class(), or in the case of modules and channels, with Define_Module()/Define_Channel().

TRAPPING on the exception above, due to a debug-on-errors=true configuration option. Is your debugger ready?
==7454== 
==7454== HEAP SUMMARY:
==7454==     in use at exit: 29,804,879 bytes in 31,424 blocks
==7454==   total heap usage: 475,694 allocs, 444,270 frees, 682,975,656 bytes allocated
==7454== 
==7454== LEAK SUMMARY:
==7454==    definitely lost: 3,828 bytes in 85 blocks
==7454==    indirectly lost: 15,079 bytes in 473 blocks
==7454==      possibly lost: 28,326,958 bytes in 19,505 blocks
==7454==    still reachable: 1,459,014 bytes in 11,361 blocks
==7454==         suppressed: 0 bytes in 0 blocks
==7454== Rerun with --leak-check=full to see details of leaked memory
==7454== 
==7454== For counts of detected and suppressed errors, rerun with: -v
==7454== ERROR SUMMARY: 22 errors from 6 contexts (suppressed: 0 from 0) Processus arrêté

我还尝试激活转储文件并使用gdb进行分析,我得到了这个输出:

Reading symbols from /nfs/homes/hc.arslan90/mixim/mixim/examples/veins/veins...(no debugging symbols found)...done.

warning: exec file is newer than core file. [New LWP 879]

warning: Can't read pathname for load map: Erreur d'entrée/sortie.

warning: .dynamic section for "/nfs/homes/hc.arslan90/mixim/mixim/examples/veins/../../out/gcc-release/src/modules/libmiximmodules.so" is not at the expected address (wrong library or version mismatch?) [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `./veins -f /home/dist/hc.arslan90/mixim/mixim/examples/veins/petite2H_Ack/proph'. Program terminated with signal 6, Aborted.
#0  0x00002ad31876c1a5 in *__GI_raise (sig=<optimized out>)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 64    ../nptl/sysdeps/unix/sysv/linux/raise.c: Aucun fichier ou dossier de ce type.

有人可以帮助识别错误吗?

注意:buggly代码引入了一个特定的数据结构,它是一个std :: map,它包含一个std :: set

的值

2 个答案:

答案 0 :(得分:2)

您需要使用相同的命令行参数启动模拟的调试(或内存检查)运行;否则,不会加载模型库,也不会执行模拟。

请注意,无论您如何开始模拟的调试或内存检查运行,都应确保在Cmdenv(命令行环境)而不是Tkenv中运行它。您的模拟不仅会执行得更快,还可以确保所有警告都与您的仿真模型相关,而不是GUI和各种GUI库。您可以通过编辑模拟的运行配置并选择用户界面:命令行,将-u Cmdenv附加到命令行或(在IDE中)来执行此操作。

如果从命令行运行模拟,只需将opp_run或模拟二进制文件(例如./veins)的常规执行加上gdb --args的前缀(以运行调试器)或valgrind --tool=memcheck(运行内存检查器)。示例命令行可能是/usr/bin/valgrind --tool=memcheck opp_run -l../../src/veins -n../../src/veins;. -u Cmdenv(其中添加了粗体文本)。

如果要从命令行运行模拟,但当前正在使用OMNeT ++ IDE,则可以快速检查用于运行模拟的命令行参数。运行模拟时,请在控制台视图中观察输出。输出可能以OMNeT++ Discrete Event Simulation开头。在输出的开头附近,您还会发现以$开头的两行。这些是IDE用于运行模拟的确切命令。

如果您想从OMNeT ++ IDE运行模拟,请注意它还具有内置功能,可以使用调试器或内存检查器运行模拟。要在其中任何一个中运行模拟,请右键单击.ini文件(例如,模拟的omnetpp.ini,然后选择调试为(对于 gdb )或< strong> Profile As (对于 valgrind ),然后 OMNeT ++ Simulation 。运行模拟后,您可以找到 valgrind 的输出在新的 Valgrind 视图中。

答案 1 :(得分:0)

  

我猜这是一个内存分配错误

不是。这是一个堆损坏错误。

  

但似乎所有返回的错误与我的代码无关(因为我对以前的代码执行相同的工作正常并且我得到相同的输出)

并非每个堆损坏错误都会导致崩溃,因此如果Valgrind报告了堆损坏错误,那么它几乎肯定是崩溃的根源。 (您也可以使用实际 Valgrind错误报告更新您的问题。)