Valgrind: fatal error: memcheck.h: No such file or directory

We are trying to track a conditional transition or movement depending on an uninitialized value in a C ++ project reported by Valgrind. The address provided in this search is not very useful, as it indicates the end of the GCC extended assembly block, and not the actual variable causing the problem.

According to Valgrind , VALGRIND_CHECK_MEM_IS_DEFINED undefined values ​​with Valgrind is an easy way , we can use VALGRIND_CHECK_MEM_IS_DEFINED or VALGRIND_CHECK_VALUE_IS_DEFINED after including <memcheck.h> . In addition, these macros or functions are apparently documented in the header file (there is definitely no help page for them).

However, when I include <memcheck.h> or <valgrind/memcheck.h> , this results in:

Fatal error: memcheck.h: No such file or directory

Based on stack overflow How do I find which rpm package delivers the file I'm looking for? , I searched for the RPM file , but its return is 0 hits for memcheck.h .

QUESTIONS

  • The blog article is a bit outdated. Is information stored?

  • If the information is accurate, then where do I find memcheck.h ?


 $ uname -a Linux localhost.localdomain 4.1.4-200.fc22.x86_64 #1 SMP Tue Aug 4 03:22:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux $ g++ --version g++ (GCC) 5.1.1 20150618 (Red Hat 5.1.1-4) ... $ valgrind --version valgrind-3.10.1 
+5
source share
2 answers

You must install the valgrind-devel RPM that contains memcheck.h .

*-devel are usually located in "optional" repositories (for example, rhel-x86_64-server-optional-6 on RHEL 6). Alternatively, you can find the RPM on Google, download it and install it yourself. With any approach, memcheck.h usually placed in /usr/include/valgrind after installation.

+2
source

Another way to delve into an uninitialized value error with valgrind is to use the built-in gdbserver.

You can then put breakpoints in your program and interactively check the specificity of different addresses / lengths using various memcheck monitoring commands, such as:

  check_memory [addressable|defined] <addr> [<len>] check that <len> (or 1) bytes at <addr> have the given accessibility and outputs a description of <addr> 

See http://www.valgrind.org/docs/manual/mc-manual.html#mc-manual.monitor-commands for more information

0
source

All Articles