valgrind 交叉编译和使用


  • administrators

    一、编译valgrind

    tar -xvf valgrind-3.14.0.tar
    cd valgrind-3.14.0/
    ./configure --host=arm-hisiv500-linux --prefix=/home/zzz/flow-tmp/valgrind
    make install

    编译后得到的结果
    zzz@ubuntu:~/flow-tmp/valgrind$ tree -d

    ├── bin
    ├── include
    │ └── valgrind
    │ └── vki
    ├── lib
    │ ├── pkgconfig
    │ └── valgrind
    └── share
    ├── doc
    │ └── valgrind
    │ └── html
    │ └── images
    └── man
    └── man1

    二、要调试的程序加上gcc参数-g

    三、使用
    开发板挂载虚拟机目录/home/zzz/ 到开发板 /home/zzz(看到网上教程都说编译指定的prefix目录和实际运行目录必须一致)

    1、export VALGRIND_LIB="/home/zzz/flow-tmp/valgrind/lib/valgrind"
    2、cd /home/zzz/flow-tmp/valgrind/bin
    3、./valgrind --log-file=/var/valgrind_report.log --tool=memcheck --leak-check=full --show-reachable=yes --workaround-gcc296-bugs=yes --undef-value-errors=no smart
    smart就是要跟踪的程序,可以在后面带参数


Log in to reply
 

Looks like your connection to AvPacket was lost, please wait while we try to reconnect.