valgrind

Does boost::bind() copy parameters by reference or by value?

强颜欢笑 提交于 2019-12-17 16:37:39
问题 Why does valgrind's DRD tool complaines "Conflicting load by thread ... at size 4": about such code: void SomeFunction(const int& value) { boost::bind(..., value); /* <-- complaines on this line with last backtrace function "new(int)" */ } Does boost::bind() stores values by reference or value? 回答1: By value. 1 But you can make it copy by ref instead: void SomeFunction(const int& value) { boost::bind(..., boost::ref(value)); boost::bind(..., boost::cref(value)); // by const ref } 1 http://www

Valgrind Unrecognised instruction

拥有回忆 提交于 2019-12-17 16:32:08
问题 I have the following code: #include <iostream> #include <random> int main() { std::mt19937_64 rng(std::random_device{}()); std::cout << std::uniform_int_distribution<>(0, 100)(rng) << '\n'; } I try to profile it using valgrind , but it says: vex amd64->IR: unhandled instruction bytes: 0xF 0xC7 0xF0 0x89 0x6 0xF 0x42 0xC1 vex amd64->IR: REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0 vex amd64->IR: VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=0F vex amd64->IR: PFX.66=0 PFX.F2=0 PFX.F3=0 ==2092== valgrind:

Any references on Dynamic Code Analysis?

半腔热情 提交于 2019-12-17 16:26:51
问题 Yesterday I was reading about debugging techniques and found Valgrind to be really interesting. It seems to use techniques from dynamic code analysis. And I followed a link from the original reference to something else called Path Profiling. I tried Googling but I guess I am using the wrong terms to search for a good reference on these concepts. Can someone suggest a good resource taking into account that I do not have a background in compilers and programming languages? 回答1: Path Profiling

Valgrind: can possibly lost be treated as definitely lost?

限于喜欢 提交于 2019-12-17 15:46:48
问题 Can I treat the output of a Valgrind memcheck, "possibly lost" as "definitely lost"? Possibly lost, or “dubious”: A pointer to the interior of the block is found. The pointer might originally have pointed to the start and have been moved along, or it might be entirely unrelated. Memcheck deems such a block as “dubious”, because it's unclear whether or not a pointer to it still exists. Definitely lost, or “leaked”: The worst outcome is that no pointer to the block can be found. The block is

Valgrind Massif tool output graphical interface?

旧街凉风 提交于 2019-12-17 15:12:09
问题 I'm using Valgrind 3.3.1 with the Massif tool to profile the heap of a C++ application, and I'm wondering if there is a graphical tool to examine the textual outputfile file. Thanks for any suggestion. 回答1: For anyone else who is still interested in graphical output of Massif from Valgrind please consider massif-visualizer, it is beautiful. You can find the project page at KDE-Apps. For Ubuntu you should build massif-visualizer from source or install package from Kubuntu-ppa repo: add-apt

Valgrind showing memory leak for printf and unused blocks

自闭症网瘾萝莉.ら 提交于 2019-12-17 14:45:35
问题 #include <string.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]){ char *str = malloc(sizeof(char)*5); str = strcpy(str, "test"); printf("%s\n", str); free(str); return 0; } When I use Valgrind on my Mac (OS X, 10.9.5) I get the following message: ==77215== HEAP SUMMARY: ==77215== in use at exit: 29,211 bytes in 374 blocks ==77215== total heap usage: 451 allocs, 77 frees, 35,160 bytes allocated ==77215== ==77215== 4,096 bytes in 1 blocks are still reachable in loss

why pthread causes a memory leak

我是研究僧i 提交于 2019-12-17 13:45:35
问题 Whenever I create a pthread, valgrind outputs a memory leak, For example the below code: #include <stdio.h> #include <unistd.h> #include <pthread.h> void *timer1_function (void *eit){ (void) eit; printf("hello world\n"); pthread_exit(NULL); } int main(void){ pthread_t timer1; pthread_create( &timer1, NULL, timer1_function, NULL); ///////line13 int i=0; for(i=0;i<2;i++){usleep(1);} return 0; } valgrind outputs ==1395== HEAP SUMMARY: ==1395== in use at exit: 136 bytes in 1 blocks ==1395== total

why pthread causes a memory leak

ぃ、小莉子 提交于 2019-12-17 13:45:23
问题 Whenever I create a pthread, valgrind outputs a memory leak, For example the below code: #include <stdio.h> #include <unistd.h> #include <pthread.h> void *timer1_function (void *eit){ (void) eit; printf("hello world\n"); pthread_exit(NULL); } int main(void){ pthread_t timer1; pthread_create( &timer1, NULL, timer1_function, NULL); ///////line13 int i=0; for(i=0;i<2;i++){usleep(1);} return 0; } valgrind outputs ==1395== HEAP SUMMARY: ==1395== in use at exit: 136 bytes in 1 blocks ==1395== total

How to undo strip - i.e. add symbols back to stripped binary

自古美人都是妖i 提交于 2019-12-17 10:45:00
问题 I have a stripped binary and symbol-file. Is it possible to add the symbols back to binary and create an unstripped binary. My use-case is using this binary w/ valgrind. 回答1: Valgrind supports separate debug files, so you should use the answer here, and valgrind should work properly with the externalized debug file. 回答2: For those tools that do not support separate files for debug information, you can glue the debug sections back to the original binary . You can do something along these lines

How to use the addr2line command in Linux?

我们两清 提交于 2019-12-17 05:40:59
问题 I am trying to use addr2line command in Unix but everytime it is giving the same output as ??:0. I am giving command as addr2line -e a.out 0x4005BDC . I got this address while running this a.out executable with valgrind tool to find the memory leakage. I also compiled the source code with -g option. 回答1: You can also use gdb instead of addr2line to examine memory address. Load executable file in gdb and print the name of a symbol which is stored at the address. 16 Examining the Symbol Table.