Valgrind 报告 RaspberryPi 4B 上的 Hello World 程序存在数百个错误

问题描述 投票:0回答:1

我有 RaspberryPi 4B,并完全更新了最新的 Raspbian。我试图让事情像在 RaspberryPi 3B 上一样工作,但即使是通过

hello_world.c
执行的简单
valgrind
也不是没有错误。安装的 valgrind 版本是
valgrind-3.7.0

当我运行这个 hello world 程序时:

#include <stdio.h>
int main() {
    puts("Hello, World!");
    return 0;
}

使用

gcc t.c -o t -g
编译并使用
valgrind ./t
执行,我收到大量这样的错误:

==5542== Memcheck, a memory error detector
==5542== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==5542== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==5542== Command: ./t
==5542== 
--5542-- WARNING: Serious error when reading debug info
--5542-- When reading debug info from /lib/arm-linux-gnueabihf/ld-2.28.so:
--5542-- Ignoring non-Dwarf2/3/4 block in .debug_info
--5542-- WARNING: Serious error when reading debug info
--5542-- When reading debug info from /lib/arm-linux-gnueabihf/ld-2.28.so:
--5542-- Last block truncated in .debug_info; ignoring
==5542== Conditional jump or move depends on uninitialised value(s)
==5542==    at 0x401A5D0: index (in /lib/arm-linux-gnueabihf/ld-2.28.so)
==5542== 
==5542== Conditional jump or move depends on uninitialised value(s)
==5542==    at 0x401A5D4: index (in /lib/arm-linux-gnueabihf/ld-2.28.so)
==5542== 
==5542== Conditional jump or move depends on uninitialised value(s)
==5542==    at 0x4008040: _dl_dst_count (in /lib/arm-linux-gnueabihf/ld-2.28.so)
==5542== 
==5542== Conditional jump or move depends on uninitialised value(s)
==5542==    at 0x4008288: expand_dynamic_string_token (in /lib/arm-linux-gnueabihf/ld-2.28.so)
==5542== 
==5542== Conditional jump or move depends on uninitialised value(s)
==5542==    at 0x401AA80: strlen (in /lib/arm-linux-gnueabihf/ld-2.28.so)
==5542== 
==5542== Conditional jump or move depends on uninitialised value(s)
==5542==    at 0x401AA84: strlen (in /lib/arm-linux-gnueabihf/ld-2.28.so)
==5542== 
==5542== Conditional jump or move depends on uninitialised value(s)
==5542==    at 0x4017F68: malloc (in /lib/arm-linux-gnueabihf/ld-2.28.so)

.....

==5542== Use of uninitialised value of size 4
==5542==    at 0x40103D4: _dl_init (in /lib/arm-linux-gnueabihf/ld-2.28.so)
==5542== 
==5542== Use of uninitialised value of size 4
==5542==    at 0x400FA00: _dl_fixup (in /lib/arm-linux-gnueabihf/ld-2.28.so)
==5542== 
==5542== Conditional jump or move depends on uninitialised value(s)
==5542==    at 0x400FA8C: _dl_fixup (in /lib/arm-linux-gnueabihf/ld-2.28.so)
==5542== 
==5542== Use of uninitialised value of size 4
==5542==    at 0x400FA8C: _dl_fixup (in /lib/arm-linux-gnueabihf/ld-2.28.so)
==5542== 
==5542== Use of uninitialised value of size 4
==5542==    at 0x4015B4C: _dl_runtime_resolve (in /lib/arm-linux-gnueabihf/ld-2.28.so)
==5542== 
Hello, World!
==5542== Conditional jump or move depends on uninitialised value(s)
==5542==    at 0x40105D0: _dl_fini (in /lib/arm-linux-gnueabihf/ld-2.28.so)
==5542== 
==5542== Conditional jump or move depends on uninitialised value(s)
==5542==    at 0x4016178: _dl_sort_maps (in /lib/arm-linux-gnueabihf/ld-2.28.so)
==5542== 
==5542== Use of uninitialised value of size 4
==5542==    at 0x48F8824: free (in /lib/arm-linux-gnueabihf/libc-2.28.so)
==5542== 
==5542== Use of uninitialised value of size 4
==5542==    at 0x499F050: free_mem (in /lib/arm-linux-gnueabihf/libc-2.28.so)
==5542== 
==5542== Conditional jump or move depends on uninitialised value(s)
==5542==    at 0x499F0D0: free_mem (in /lib/arm-linux-gnueabihf/libc-2.28.so)
==5542== 
==5542== Use of uninitialised value of size 4
==5542==    at 0x499EF64: free_slotinfo (in /lib/arm-linux-gnueabihf/libc-2.28.so)
==5542== 
==5542== 
==5542== HEAP SUMMARY:
==5542==     in use at exit: 0 bytes in 0 blocks
==5542==   total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
==5542== 
==5542== All heap blocks were freed -- no leaks are possible
==5542== 
==5542== For counts of detected and suppressed errors, rerun with: -v
==5542== Use --track-origins=yes to see where uninitialised values come from
==5542== ERROR SUMMARY: 4732 errors from 193 contexts (suppressed: 87 from 1)

有人知道该怎么办吗?

谢谢您的提前!

c linux gcc arm raspberry-pi4
1个回答
0
投票

如果您从源代码构建最新的 Valgrind,它应该运行得相当好。

libarmmem.so 仍然存在一个未解决的问题

https://bugs.launchpad.net/raspbian/+bug/2051392

坦白说,我认为最好的解决方案是放弃 Raspberry Pi 操作系统。

© www.soinside.com 2019 - 2024. All rights reserved.