简体   繁体   English

无法在基于 Linux 的集群(cent OS)上运行的 Veins/o.net 程序上执行 Valgrind?

[英]Unable to execute Valgrind on a Veins/omnet program that is running on a Linux-based cluster(cent OS)?

I am using OMNeT++(4.6) and Veins(4.4) for my project development.我正在使用 OMNeT++(4.6) 和 Veins(4.4) 进行项目开发。 After an update in the veins MAC level, the program is crashing and I want to locate the point of error.在静脉MAC级别更新后,程序崩溃了,我想定位错误点。 Since I cannot find the error using debugging, I tried to install Valgrind for any memory leaks.由于我无法使用调试找到错误,因此我尝试为任何 memory 泄漏安装 Valgrind。 I sucessfully installed the valgrind in the cluster and I verified using the following command我成功地在集群中安装了 valgrind,并使用以下命令进行了验证

command:
$ valgrind --version
output:
valgrind-3.20.0

I checked valgrind with a simple c memory leak program and valgrind runs perfect in the cluster and generates output.我用一个简单的 c memory 泄漏程序检查了 valgrind,valgrind 在集群中运行完美并生成 output。

I usually run my veins simulations in the cluster using the run following command.我通常使用运行以下命令在集群中运行我的静脉模拟。 In the command line, I enter to the location of the o.net.ini file and run following command.在命令行中,我进入到o.net.ini文件的位置并运行以下命令。

command:
/../veins/run_release omnetpp.ini -c Highway

The file run_release is derived from veins run and has the following code文件run_release源自 veins run并具有以下代码

#!/usr/bin/env python
run_libs = ['src/veins']
run_neds = ['src/veins']

# ^-- contents of out/config.py go here

"""
Runs Veins simulation in current directory
"""

import sys
import os

def relpath(s):
    veins_root = os.path.dirname(os.path.realpath(__file__))
    return os.path.relpath(os.path.join(veins_root, s), '.')

run_libs = [relpath(s) for s in run_libs]
run_neds = [relpath(s) for s in run_neds] + ['.']

lib_flags = ['-l%s' % s for s in run_libs]
ned_flags = ['-n' + ';'.join(run_neds)]

prefix = []

cmdline = prefix + ['/../omnetpp-4.6/bin/opp_run_release'] + lib_flags + ned_flags + sys.argv[1:]

os.execvp('env', ['env'] + cmdline)

When i tried to enable valgrind to check my veins simulation using the following command options.当我尝试使用以下命令选项启用 valgrind 检查我的静脉模拟时。

command option 1:
valgrind -v --tool=memcheck --leak-check=yes --log-file=valgrind-out.txt /../veins/run_release omnetpp.ini -c Highway

command option 2:
valgrind -v --tool=memcheck --leak-check=yes --log-file=valgrind-out.txt /media/home/gokulnath/workspaceOMNET/VeinsBoschUMH/run_release omnetpp.ini -c Highway;. -u Cmdenv

command option 3:
~/valgrind/bin/valgrind -v --tool=memcheck --leak-check=full --track-origins=yes --log-file=valgrind-out.txt /media/home/gokulnath/workspaceOMNET/VeinsBoschUMH/run_release omnetpp.ini -c Highway;. -u Cmdenv

In all the cases, the following valgrind log file is generated in the valgrind-out.txt在所有情况下,都会在 valgrind-out.txt 中生成以下 valgrind 日志文件

==19038== Memcheck, a memory error detector
==19038== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==19038== Using Valgrind-3.20.0-5147d671e4-20221024 and LibVEX; rerun with -h for copyright info
==19038== Command: /../veins/run_release omnetpp.ini -c Highway
==19038== Parent PID: 18758
==19038== 
--19038-- 
--19038-- Valgrind options:
--19038--    -v
--19038--    --tool=memcheck
--19038--    --leak-check=full
--19038--    --track-origins=yes
--19038--    --log-file=valgrind-out.txt
--19038-- Contents of /proc/version:
--19038--   Linux version 3.10.0-693.21.1.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Wed Mar 7 19:03:37 UTC 2018
--19038-- 
--19038-- Arch and hwcaps: AMD64, LittleEndian, amd64-cx16-sse3
--19038-- Page sizes: currently 4096, max supported 4096
--19038-- Valgrind library directory: /../valgrind/libexec/valgrind
--19038-- Reading syms from /usr/bin/env
--19038--    object doesn't have a symbol table
--19038-- Reading syms from /usr/lib64/ld-2.17.so
--19038-- Reading syms from /../valgrind/libexec/valgrind/memcheck-amd64-linux
--19038--    object doesn't have a dynamic symbol table
--19038-- Scheduler: using generic scheduler lock implementation.
--19038-- Reading suppressions file: /../valgrind/libexec/valgrind/default.supp
==19038== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-19038-by-..
==19038== embedded gdbserver: writing to   /tmp/vgdb-pipe-to-vgdb-from-19038-by-..
==19038== embedded gdbserver: shared mem   /tmp/vgdb-pipe-shared-mem-vgdb-19038-..
==19038== 
==19038== TO CONTROL THIS PROCESS USING vgdb (which you probably
==19038== don't want to do, unless you know exactly what you're doing,
==19038== or are doing some strange experiment):
==19038==   /../valgrind/libexec/valgrind/../../bin/vgdb --pid=19038 ...command...
==19038== 
==19038== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==19038==   /path/to/gdb /../veins/run_release
==19038== and then give GDB the following command
==19038==   target remote | /../valgrind/libexec/valgrind/../../bin/vgdb --pid=19038
==19038== --pid is optional if only one valgrind process is running
==19038== 
--19038-- REDIR: 0x40192f0 (ld-linux-x86-64.so.2:strlen) redirected to 0x580cc9e5 (vgPlain_amd64_linux_REDIR_FOR_strlen)
--19038-- REDIR: 0x40190c0 (ld-linux-x86-64.so.2:index) redirected to 0x580cc9ff (vgPlain_amd64_linux_REDIR_FOR_index)
--19038-- Reading syms from /../valgrind/libexec/valgrind/vgpreload_core-amd64-linux.so
--19038-- Reading syms from /../valgrind/libexec/valgrind/vgpreload_memcheck-amd64-linux.so
==19038== WARNING: new redirection conflicts with existing -- ignoring it
--19038--     old: 0x040192f0 (strlen              ) R-> (0000.0) 0x580cc9e5 vgPlain_amd64_linux_REDIR_FOR_strlen
--19038--     new: 0x040192f0 (strlen              ) R-> (2007.0) 0x04c30b20 strlen
--19038-- REDIR: 0x4019270 (ld-linux-x86-64.so.2:strcmp) redirected to 0x4c31d10 (strcmp)
--19038-- REDIR: 0x4019e60 (ld-linux-x86-64.so.2:mempcpy) redirected to 0x4c35da0 (mempcpy)
--19038-- Reading syms from /usr/lib64/libc-2.17.so
==19038== WARNING: new redirection conflicts with existing -- ignoring it
--19038--     old: 0x04ebc950 (memalign            ) R-> (1011.0) 0x04c2fdf2 memalign
--19038--     new: 0x04ebc950 (memalign            ) R-> (1017.0) 0x04c2fdc2 aligned_alloc
==19038== WARNING: new redirection conflicts with existing -- ignoring it
--19038--     old: 0x04ebc950 (memalign            ) R-> (1011.0) 0x04c2fdf2 memalign
--19038--     new: 0x04ebc950 (memalign            ) R-> (1017.0) 0x04c2fd95 aligned_alloc
==19038== WARNING: new redirection conflicts with existing -- ignoring it
--19038--     old: 0x04ebc950 (memalign            ) R-> (1011.0) 0x04c2fdf2 memalign
--19038--     new: 0x04ebc950 (memalign            ) R-> (1017.0) 0x04c2fdc2 aligned_alloc
==19038== WARNING: new redirection conflicts with existing -- ignoring it
--19038--     old: 0x04ebc950 (memalign            ) R-> (1011.0) 0x04c2fdf2 memalign
--19038--     new: 0x04ebc950 (memalign            ) R-> (1017.0) 0x04c2fd95 aligned_alloc
--19038-- REDIR: 0x4ec5f80 (libc.so.6:strcasecmp) redirected to 0x4a247cf (_vgnU_ifunc_wrapper)
--19038-- REDIR: 0x4ec2d00 (libc.so.6:strnlen) redirected to 0x4a247cf (_vgnU_ifunc_wrapper)
--19038-- REDIR: 0x4ec8250 (libc.so.6:strncasecmp) redirected to 0x4a247cf (_vgnU_ifunc_wrapper)
--19038-- REDIR: 0x4ec5760 (libc.so.6:memset) redirected to 0x4a247cf (_vgnU_ifunc_wrapper)
--19038-- REDIR: 0x4ec5710 (libc.so.6:memcpy@GLIBC_2.2.5) redirected to 0x4a247cf (_vgnU_ifunc_wrapper)
--19038-- REDIR: 0x4ec46f0 (libc.so.6:__GI_strrchr) redirected to 0x4c304e0 (__GI_strrchr)
--19038-- REDIR: 0x4ec46b0 (libc.so.6:rindex) redirected to 0x4a247cf (_vgnU_ifunc_wrapper)
--19038-- REDIR: 0x4ec11c0 (libc.so.6:__GI_strcmp) redirected to 0x4c31c20 (__GI_strcmp)
--19038-- REDIR: 0x4ec2c20 (libc.so.6:__GI_strlen) redirected to 0x4c30a80 (__GI_strlen)
--19038-- REDIR: 0x4ec2e20 (libc.so.6:__GI_strncmp) redirected to 0x4c31270 (__GI_strncmp)
--19038-- REDIR: 0x4ec1100 (libc.so.6:__GI_strchr) redirected to 0x4c30610 (__GI_strchr)
--19038-- REDIR: 0x4ec4df0 (libc.so.6:memchr) redirected to 0x4c31db0 (memchr)
--19038-- REDIR: 0x4ecc210 (libc.so.6:strchrnul) redirected to 0x4c358c0 (strchrnul)
--19038-- REDIR: 0x4ebc0c0 (libc.so.6:malloc) redirected to 0x4c2b110 (malloc)
--19038-- REDIR: 0x4ec5930 (libc.so.6:__GI_mempcpy) redirected to 0x4c35ad0 (__GI_mempcpy)
--19038-- REDIR: 0x4eca990 (libc.so.6:__GI_memcpy) redirected to 0x4c329c0 (__GI_memcpy)
--19038-- REDIR: 0x4ebc4c0 (libc.so.6:free) redirected to 0x4c2d696 (free)
--19038-- REDIR: 0x4edb600 (libc.so.6:__GI_strstr) redirected to 0x4c36030 (__strstr_sse2)
--19038-- REDIR: 0x4ebc5a0 (libc.so.6:realloc) redirected to 0x4c2fa7b (realloc)
--19038-- REDIR: 0x4ec5fe0 (libc.so.6:__GI___strcasecmp_l) redirected to 0x4c31840 (__GI___strcasecmp_l)
--19038-- REDIR: 0x4ec2d30 (libc.so.6:__GI_strnlen) redirected to 0x4c30a30 (__GI_strnlen)
--19038-- REDIR: 0x4ec5e20 (libc.so.6:__GI_stpcpy) redirected to 0x4c34660 (__GI_stpcpy)
--19038-- REDIR: 0x4ec2650 (libc.so.6:__GI_strcpy) redirected to 0x4c30c20 (__GI_strcpy)
--19038-- REDIR: 0x4ecc000 (libc.so.6:__GI___rawmemchr) redirected to 0x4c35920 (__GI___rawmemchr)
--19038-- REDIR: 0x4ec10c0 (libc.so.6:index) redirected to 0x4a247cf (_vgnU_ifunc_wrapper)

From this log I understand that I am unable to use Valgrind to check for errors in my Veins simulation even though I am able to call it.从这个日志中我了解到我无法使用 Valgrind 检查我的 Veins 模拟中的错误,即使我可以调用它。 I have tried running Valgrind on both a working and a crashing version of Veins but am getting the same log output. While the simulation runs successfully with the working version of Veins, it continues to crash with the crashing version.我已经尝试在 Veins 的工作版本和崩溃版本上运行 Valgrind,但得到相同的日志 output。虽然模拟在 Veins 的工作版本上成功运行,但它继续在崩溃版本上崩溃。 How can I effectively use Valgrind to locate the cause of the crash in my Veins simulation?我如何有效地使用 Valgrind 来定位我的 Veins 模拟中崩溃的原因?

can someone help to identify the correct command or am I missing something?有人可以帮助确定正确的命令还是我遗漏了什么?

To execute valgrind update the run script.要执行 valgrind 更新run脚本。 You can find the updated script in this link您可以在此链接中找到更新的脚本

As you can see in the script that you need to update the prefix正如您在脚本中看到的那样,您需要更新prefix

prefix = ['valgrind', '--tool=memcheck', '--leak-check=full', '--dsymutil=yes', '--log-file=valgrind.out']

This update will check your veins profram in valgrind.此更新将在 valgrind 中检查您的静脉 profram。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM