Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MacOS Valgrind alternative?

I'm running MacOS Big Sur and trying to install valgrind for an assignment.

brew install valgrind doesn't currently work and installing from the tar.bz2 distribution doesn't either.

Running ./configure (according to the readme instructions) returns this at the end:

checking for a supported OS... ok (darwin20.1.0)
checking for the kernel version... unsupported (20.1.0)
configure: error: Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x, 14.x, 15.x, 16.x and 17.x (Mac OS X 10.6/7/8/9/10/11 and macOS 10.12/13)

Judging from that, looks like valgrind hasn't worked for the last couple of MacOS releases.

Is there an alternative for current MacOS releases or is this a good time for me to make a partition on my hard drive for Linux? Or am I missing something with installation?

like image 746
breakthatbass Avatar asked Nov 25 '20 17:11

breakthatbass


People also ask

Does macOS have valgrind?

x and later), ARM64/Android, X86/Android (4.0 and later), MIPS32/Android, X86/FreeBSD, AMD64/FreeBSD, X86/Darwin and AMD64/Darwin (Mac OS X 10.12). Valgrind is Open Source / Free Software, and is freely available under the GNU General Public License, version 2.

Does valgrind work on M1 Mac?

Valgrind does not seem to work on M1 Macs. Issue #5 · LouisBrunner/homebrew-valgrind · GitHub.


1 Answers

As mentioned in the comments, Louis Brunner's github repo is your best bet at the moment. This should give you at least a minimally functional build.

Other than the usual version number changes, one of the big, breaking, changes in Big Sur is the fact that the system libraries are cached (and hidden) by dyld. So right now Valgrind is not able to read libsystem_malloc.dylib in order to determine the address of functions like malloc so that they can be redirected.

If anyone wants to take a stab at it, then my guess is that you will need to follow these instructions, and change initimg-darwin.c so that dyld_cache_value is "avoid".

like image 196
Paul Floyd Avatar answered Sep 25 '22 08:09

Paul Floyd