Valgrind reports memory definitely lost along with file and function names in x86 machine as expected.
1 #include<bits/stdc++.h>
2
3 using namespace std;
4 int main()
5 {
6 char *name = new char[30];
7 cout << "Enter name" << endl;
8 cin >> name;
9 cout << "Hi " << name << endl;
10 //delete name;
11 return 0;
12 }
x86 machine
uname -a:
Linux raja-VirtualBox 5.4.0-135-generic #152~18.04.2-Ubuntu SMP Tue Nov 29 08:23:49 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
==8975== 30 bytes in 1 blocks are definitely lost in loss record 1 of 1
==8975== at 0x4C3289F: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8975== *
*by 0x1089CB: main (test.cpp:6)**
==8975==
==8975== LEAK SUMMARY:
But the same code when ran in an aarch64 machine, valgrind doesn't report any info like file or function name, though memory definitely lost is being reported.
aarch64 board
uname -a:
Linux ds4 4.9.253-tegra #1 SMP PREEMPT Thu Feb 24 11:50:52 EST 2022 aarch64 aarch64 aarch64 GNU/Linux
==19468== 30 bytes in 1 blocks are definitely lost in loss record 1 of 1
==19468== at 0x48468F4: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-arm64-linux.so)
==19468==
==19468== LEAK SUMMARY:
Anybody faced this in aarch64? How to get function, file names, line num.. in valgrind report for aarch64 or any such boards?
Note: valgrind and compiler versions are same in both x86 and aarch64.
Upgrading to latest valgrind version valgrind-3.20.0 resolved. x86 gives debug info without valgrind upgrade, only aacrh64 requires upgrade.
Thanks @phd for your answer!!
PS: If someone facing "valgrind is already the newest version" due to your linux distribution and want's to manually download/compile valgrind you can refer: How to install valgrind properly??