I am able to check a certain SW with Valgrind on my PC (Ubuntu) but for more realistic results I also want to check the same SW on OpenWRT (21.02.0-rc4).
Basicly Valgrind runs in OpenWRT but currently there are several issues:
1- I'm running
valgrind -s --leak-check=full --show-leak-kinds=all --track-origins=yes ./my_SW
On the PC this works but on OpenWRT the --track-origins=yes
parameter causes a "Killed" message right after start of Valgrind.
2- When I skip the track-origins parameter Valgrind is able to run my SW but in the report at the end:
==12462== HEAP SUMMARY:
==12462== in use at exit: 0 bytes in 0 blocks
==12462== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==12462==
==12462== All heap blocks were freed -- no leaks are possible
On the PC, Valgrind reports thousands of allocs and the same amount of frees, but on OpenWRT it seems it can't detect any Heap usage.
3- On OpenWRT I get many errors like the one below, whereas the same SW runs on the PC error free:
==12462== Conditional jump or move depends on uninitialised value(s)
==12462== at 0x4079058: ??? (in /lib/libc.so)
==12462== by 0x408A4B4: ??? (in /lib/libc.so)
I thought my problems may be related with the issue below:
cross-compiled Valgrind does not detect obvious leaks
So I tried to apply the suggested solution and use an unstripped version of my SW, Valgrind and libc. I did this for my SW and Valgrind, but I don't know how to build an unstripped version of libc in OpenWRT. I couldn't find the related makefile. Any ideas?
UPDATE: @Paul Floyd I tried your recommendation but it seems my valgrind is not even working for pwd:
root@OpenWrt:/opt# valgrind --tool=none pwd
==2919== Nulgrind, the minimal Valgrind tool
==2919== Copyright (C) 2002-2017, and GNU GPL'd, by Nicholas Nethercote.
==2919== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==2919== Command: pwd
==2919==
vex mips->IR: unhandled instruction bytes: 0xE8 0x67 0x25 0xB3
==2919==
==2919== Process terminating with default action of signal 4 (SIGILL)
==2919== at 0x43B405: ??? (in /bin/busybox)
==2919== by 0x4021A0C: ??? (in /lib/libc.so)
==2919==
Illegal instruction
root@OpenWrt:/opt#