valgrind

Debugging Symbols Lost When Linking?

别来无恙 提交于 2019-12-03 23:02:46
I'm trying to compile a program with debugging symbols so that valgrind will give me line numbers. I have found that if I compile a simple test program in one go (with -g) then it contains the symbols. However, if I compile in two passes (i.e. compile then link) then it does not contain the debugging symbols. Here's the compile command for the single pass case: g++ -g file.c -o file And for two passes g++ -g -c file.c -o file.o g++ -g file.o -o file The actual program looks like this and contains a simple Invalid Write int main(){ int* x = new int[10]; x[10]=1; } If I compile with one pass

Valgrind's massif tool will not profile my application

别等时光非礼了梦想. 提交于 2019-12-03 22:52:06
I am developing a statically-linked 64-bit C++ application on 64-bit CentOS 5.8 using the standard gcc 4.4 packages from the CentOS repositories. It appears to be using more memory than I expected, so I tried using massif to profile the memory usage. I have compiled with debug information and then run valgrind --tool=massif ./MyProg from the directory where MyProg resides. It never produces any results other than the following massif.out.XXXX example. desc: (none) cmd: ./MyProg time_unit: i #----------- snapshot=0 #----------- time=0 mem_heap_B=0 mem_heap_extra_B=0 mem_stacks_B=0 heap_tree

Valgrind giving error but everything seems fine

你。 提交于 2019-12-03 22:10:40
问题 This one seems like a duplicate of my previous post but it is not..... Here Valgrind giving the following error: udit@udit-Dabba ~/mec $ valgrind --leak-check=full sendip -v -p ipv6 -f file.txt -6s ::1 -p esp -es 0x20 -eq 0x40 -ei z30 -eI z100 -p tcp -ts 21 -td 21 ::2 ==4331== Memcheck, a memory error detector ==4331== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==4331== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info ==4331== Command: sendip -v -p ipv6

Segmentation faults occur when I run a parallel program with Open MPI

故事扮演 提交于 2019-12-03 17:11:49
问题 on my previous post I needed to distribute data of pgm files among 10 computers. With help from Jonathan Dursi and Shawn Chin, I have integrate the code. I can compile my program but it got segmentation fault. I ran but nothing happen mpirun -np 10 ./exmpi_2 balloons.pgm output.pgm The result is [ubuntu:04803] *** Process received signal *** [ubuntu:04803] Signal: Segmentation fault (11) [ubuntu:04803] Signal code: Address not mapped (1) [ubuntu:04803] Failing at address: 0x7548d0c [ubuntu

Unable to build and install Valgrind on macOS High Sierra

Deadly 提交于 2019-12-03 16:37:07
问题 I cannot install Valgrind on macOS High Sierra. It's not available through brew . I've tried with 3.10. After make install , I get this message: configure: error: Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x and 14.x (Mac OS X 10.6/7/8/9/10) Homebrew says: valgrind: This formula either does not compile or function as expected on macOS versions newer than Sierra due to an upstream incompatibility. Error: An unsatisfied requirement failed this build. 回答1: I had the problem like this. So, I

Dumping contents of lost memory reported by Valgrind

倖福魔咒の 提交于 2019-12-03 13:15:30
问题 When I run valgrind --leak-check=yes on a program, a few bytes of lost memory are reported. Is it possible to view the contents of this memory (i.e. dump the data that is stored in it)? 回答1: You can do that with the last version of Valgrind (3.8.1): Start your executable activating the gdbserver at startup: valgrind --vgdb-error=0 ....<your program> Then in another window, connect a gdb to Valgrind (following the indications given by Valgrind). Then put a breakpoint at a relevant place (e.g.

valgrind error and ucontext. Why “Use of uninitialised value of size 8”?

为君一笑 提交于 2019-12-03 13:06:21
I have been trying to understand why valgrind complains about "Use of uninitialised value of size 8" for this small test program that uses ucontexts. It is basically a program that creates "n_ucs" ucontexts and switches over them for "max_switch" times. I understand the "Warning: client switching stacks?" (which is basically what the program all about), but I can't really make sense to all the "Use of uninitialised value of size 8" I would like to get some help understanding if Valgrind errors are false positive or if this program has something fundamentally wrong. (I see a lot of them on a

C++ Program Always Crashes While doing a std::string assign

若如初见. 提交于 2019-12-03 12:13:09
问题 I have been trying to debug a crash in my application that crashes (i.e. asserts a * glibc detected * free(): invalid pointer: 0x000000000070f0c0 ***) while I'm trying to do a simple assign to a string. Note that I'm compiling on a linux system with gcc 4.2.4 with an optimization level set to -O2. With -O0 the application no longer crashes. E.g. std::string abc; abc = "testString"; but if I changed the code as follows it no longer crashes std::string abc("testString"); So again I scratched my

How would you generically detect cache line associativity from user mode code?

一世执手 提交于 2019-12-03 11:21:47
问题 I'm putting together a small patch for the cachegrind/callgrind tool in valgrind which will auto-detect, using completely generic code, CPU instruction and cache configuration (right now only x86/x64 auto-configures, and other architectures don't provide CPUID type configuration to non-privileged code). This code will need to execute entirely in a non-privileged context i.e. pure user mode code. It also needs to be portable across very different POSIX implementations, so grokking /proc

How do you interpret cachegrind output for caching misses?

折月煮酒 提交于 2019-12-03 11:16:37
Out of curiosity I ran coded up several different versions of matrix Multiplication and ran cachegrind against it. In my results below, I was wondering which parts were L1,L2,L3 misses and references and what it all really means? Below is my code for the matrix multiplications also, in case anyone needs that. #define SLOWEST ==6933== Cachegrind, a cache and branch-prediction profiler ==6933== Copyright (C) 2002-2012, and GNU GPL'd, by Nicholas Nethercote et al. ==6933== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==6933== Command: ./a.out 500 ==6933== --6933-- warning: L3