728x90

Official link: https://valgrind.org/

 

Valgrind Home

Valgrind is an instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail. You can also use Valgrind to build new tool

valgrind.org

 

Install:

sudo apt install valgrind  # Ubuntu, Debian, etc.
sudo yum install valgrind  # RHEL, CentOS, Fedora, etc.
sudo pacman -Syu valgrind  # Arch, Manjaro, Garuda, etc

 

 

내부적으로 GDB를 사용하기 때문에 addr2line같은 것들이 제대로 동작해야 한다.

이전 포스팅에서 추가했던 secure compile option들을 넣으면 안된다.

대신 -g를 추가하여 debugging이 가능하도록 해야 한다.

https://bluelimn.tistory.com/entry/secure-compile

 

secure compile

checksec를 통해 secure compile 정보를 알 수 있다. https://github.com/slimm609/checksec.sh GitHub - slimm609/checksec.sh: Checksec.sh Checksec.sh. Contribute to slimm609/checksec.sh development by creating an account on GitHub. github.com 우선 3

bluelimn.tistory.com

 

ref: https://stackoverflow.com/questions/5134891/how-do-i-use-valgrind-to-find-memory-leaks

valgrind --leak-check=full \
         --show-leak-kinds=all \
         --track-origins=yes \
         --verbose \
         --log-file=valgrind-out.txt \
         ./executable exampleParam1

 

728x90

+ Recent posts