Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/471.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
arm 32位板的Valgrind交叉编译-橙色pi_Arm_Cross Compiling_Valgrind_Orange Pi - Fatal编程技术网

arm 32位板的Valgrind交叉编译-橙色pi

arm 32位板的Valgrind交叉编译-橙色pi,arm,cross-compiling,valgrind,orange-pi,Arm,Cross Compiling,Valgrind,Orange Pi,如何在x86 ubuntu机器上交叉编译ARM的valgrind 这里是一个自包含的过程,假设您是在x86_64 Ubuntu Linux机器上构建的。如果不是这样,只需为linux发行版提供的arm none linux gnueabihf目标安装交叉编译器,确保它位于您的路径中,并相应地修改configure命令 在PC端: # downloading/installing toolchain wget https://developer.arm.com/-/media/Files/down

如何在x86 ubuntu机器上交叉编译ARM的valgrind


这里是一个自包含的过程,假设您是在x86_64 Ubuntu Linux机器上构建的。如果不是这样,只需为linux发行版提供的
arm none linux gnueabihf
目标安装交叉编译器,确保它位于您的路径中,并相应地修改
configure
命令

在PC端:

# downloading/installing toolchain
wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.2-2020.11/binrel/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf.tar.xz?revision=d0b90559-3960-4e4b-9297-7ddbc3e52783&la=en&hash=985078B758BC782BC338DB947347107FBCF8EF6B

sudo mkdir -p /opt/arm/10
sudo tar Jxf gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf.tar.xz -C /opt/arm/10

# downloading/extracting valgrind
wget https://sourceware.org/pub/valgrind/valgrind-3.16.1.tar.bz2
tar jxf valgrind-3.16.1.tar.bz2

# building
export PATH=/opt/arm/10/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/bin:$PATH
mdkir valgrind
cd valgrind

../valgrind-3.16.1/configure --host=arm-none-linux-gnueabihf --prefix=$(pwd)/valgrind-3.16.1-arm-none-linux-gnueabihf
make all install
关于Orangepi:

valgrind-3.16.1-arm-none-linux-gnueabihf
目录及其子目录的内容从PC复制到Orangepi的/usr/local目录中

安装
libc6dbg
(假设您在Orangepi上运行Ubuntu或Debian):
apt get Install libc6dbg

使用以下程序进行测试:

wgethttp://cs.ecs.baylor.edu/~donahoo/tools/valgrind/test.c
gcc-o测试-g测试.c
valgrind--tool=memcheck--leak check=yes--show reachable=yes--num callers=20--track fds=yes./test
==2034==Memcheck,内存错误检测器
==2034==2002-2017年版权(C)和GNU GPL'd,朱利安·苏厄德等人。
==2034==使用Valgrind-3.16.1和LibVEX;使用-h重新运行以获取版权信息
==2034==命令:./test
==2034==
==2034==
==2034==文件描述符:3在退出时打开。
==2034==打开文件描述符2:/dev/ttyS0
==2034==    
==2034==
==2034==打开文件描述符1:/dev/ttyS0
==2034==    
==2034==
==2034==打开文件描述符0:/dev/ttyS0
==2034==    
==2034==
==2034==
==2034==堆摘要:
==2034==在出口处使用:2个块中有35个字节
==2034==总堆使用率:3个allocs,1个free,分配47个字节
==2034==
==2034==1个块中的16个字节肯定会在丢失记录1(共2个)中丢失
==2034==at 0x484A4B0:malloc(vg\U替换\U malloc.c:307)
==2034==0x1087DB:main(test.c:15)
==2034==
==2034==1个块中的19个字节肯定会在丢失记录2(共2个)中丢失
==2034==at 0x484A4B0:malloc(vg\U替换\U malloc.c:307)
==2034==0x1087BB:main(test.c:8)
==2034==
==2034==泄漏汇总:
==2034==肯定丢失:2个块中有35个字节
==2034==间接丢失:0个块中有0个字节
==2034==可能丢失:0个块中有0个字节
==2034==仍然可访问:0个块中有0个字节

如果这个或任何答案解决了你的问题,请通过点击复选标记来考虑。这向更广泛的社区表明,你已经找到了一个解决方案,并给回答者和你自己带来了一些声誉。当然没有义务这么做。谢谢你的回复。&一定要接受。
wget http://cs.ecs.baylor.edu/~donahoo/tools/valgrind/test.c
gcc -o test -g test.c

valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./test
    ==2034== Memcheck, a memory error detector
    ==2034== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
    ==2034== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
    ==2034== Command: ./test
    ==2034==
    ==2034==
    ==2034== FILE DESCRIPTORS: 3 open at exit.
    ==2034== Open file descriptor 2: /dev/ttyS0
    ==2034==    <inherited from parent>
    ==2034==
    ==2034== Open file descriptor 1: /dev/ttyS0
    ==2034==    <inherited from parent>
    ==2034==
    ==2034== Open file descriptor 0: /dev/ttyS0
    ==2034==    <inherited from parent>
    ==2034==
    ==2034==
    ==2034== HEAP SUMMARY:
    ==2034==     in use at exit: 35 bytes in 2 blocks
    ==2034==   total heap usage: 3 allocs, 1 frees, 47 bytes allocated
    ==2034==
    ==2034== 16 bytes in 1 blocks are definitely lost in loss record 1 of 2
    ==2034==    at 0x484A4B0: malloc (vg_replace_malloc.c:307)
    ==2034==    by 0x1087DB: main (test.c:15)
    ==2034==
    ==2034== 19 bytes in 1 blocks are definitely lost in loss record 2 of 2
    ==2034==    at 0x484A4B0: malloc (vg_replace_malloc.c:307)
    ==2034==    by 0x1087BB: main (test.c:8)
    ==2034==
    ==2034== LEAK SUMMARY:
    ==2034==    definitely lost: 35 bytes in 2 blocks
    ==2034==    indirectly lost: 0 bytes in 0 blocks
    ==2034==      possibly lost: 0 bytes in 0 blocks
    ==2034==    still reachable: 0 bytes in 0 blocks