-
-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
M1/M2 Compatibility #56
Comments
Hi @gilaroni, I have started on M1 support, it might take a bit but it's on the roadmap, yes. |
Hello, |
Any news here, its always not possible to install valgrind .... brew install --HEAD LouisBrunner/valgrind/valgrind If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core): valgrind's formula was built from an unstable upstream --HEAD. |
any update for the M1/M2 compatibility? |
ran into the same error as @eliesaikali on my M2 Pro MacBook Pro running macOS Ventura 13.2.1 (22D68). |
+1 |
M1 Pro MacBook Pro running macOS Venture 13.3.1. Same issue as @eliesaikali and @hacknus. |
Any details about the roadmap of Valgrind runs in the M1 arch? |
any update for the M1/M2 compatibility? |
This comment was marked as spam.
This comment was marked as spam.
Still need help? |
Would really like Valgrind w/ MacOS Silicon for school purposes. We're using it at school!
|
Pleeeassseee bump this up. We're using valgrind in our cs101 class to help with memory leaks in projects related to singly linked lists and pointers. We're also going to need valgrind in our upcoming cs102 class. I don't mind using our college's ubuntu desktops with valgrind, but the labs close at 10pm, and a lot of us do our best studying after 10pm. |
Speaking from experience, a huge amount of work is needed to get things running smoothly. |
What are the alternative to valgrind on MacOS what would be usable in a continuous integration environment ? |
@MartinDelille You can use leaks if you like on MacOS |
I wasn't aware of this xcode tool! Thanks a lot! 👌 |
Yes probably, but some people want to contribute like @JoonasMykkanen, but he doesn't get any answer |
None of my patches should change anything for FreeBSD or Linux. |
That ticket is old and lacks reproducers, but it sounds like Android might have the same issue (optimized libraries not checking if the instruction is available before using it). |
I put my patch also on that ticket, maybe there is some user feedback on it. Anyway feel free to re-use any part of my patches in any way you want. |
Hello, I've just tried building the M1 branch on my M1 Max and I got the exact same issue than rdoeffinger related to debug info.
After applying the patch and recompiling vg-in-place is now able to trace trivial applications such as ls. I have tried running a more advanced own app but it has 2 issues:
This is the output of VG when attempting to trace a custom CLI tool using a Rust dylib (everything is built with debug info including the Rust dylib):
I wonder if these errors are due to VG internal issues or if they are real and Apply really needs to fix their dyld... Are these errors expected? EDIT: I also wonder why it's calling _NSThreadPoisoned as in my test I have not used any threads. |
@Yuri6037 FYI, I edited your comment to remove the bulk of the errors (as they aren't particularly useful for this discussion and can still be accessed through the Github edit history otherwise) because your message made it difficult to scroll through this issue.
Good to know that it isn't an isolated issue. I have yet to reproduce it, I will have to look into it a bit more.
Valgrind should provide all DYLD env vars to the real dyld when running your binary. If you have a MRE, I would gladly look into that issue.
This is usually due to Valgrind not knowing about how the memory is laid out on macOS. In the past, they have been hidden through a copious amount of suppressions (a special Valgrind file). I haven't seen those specific one yet, so I don't know what's causing it but the general rule I found is: if you dig down to why an issue like
As stated in my latest update, this is currently expected. I haven't had time to investigate why that happens apart that objc is being loaded at some point. You don't have to use threads especially but if you use any macOS capability which rely on objc, you will have this crash.
I am not very knowledgeable about this so thanks for this background as it will make easier to research and fix. |
I just pushed a bunch of changes upstream for arm64 concerning several mrs and dc opcodes. That includes mrs dczd_el0 and dc zva. |
I was planning to merge the arm64 changes into Good newsValgrind is basically functional on Apple Silicon on feature/m1. This branch incorporates a lot of changes:
These changes mean that the regression tests have improved significantly, macOS 13 amd64 has a 30% reduction in failure and macOS 14 arm64 has less failures than the current So you can run Valgrind, it will probably work well and all is great. Bad newsThere is some kind of memory issue which happens when Valgrind is running (ironic, isn't it?). This is very obvious when running a GUI application or the regression tests. Your machine will slow down to a crawl and simply stopping Valgrind will not be enough to restore your system into a usable state, you will need to restart. Such freezes, where a force reset was required, happened to me a handful of time when working on Valgrind. I have been sampling my system with Due to the dramatic effect of this issue (requiring a reboot or basically crashing your computer altogether), I can't release the current state of arm64 on Going forwardI have been crunching pretty hard trying to get Valgrind ready for release and need to take break from it. I would have wanted to report the release of the first macOS arm64 version but it wasn't meant to be. However, we have never been so close to a stable release and I am confident that we are at the end of this long journey. |
Bravo! When you are ready we can work again on getting this merged upstream. |
Thank you for the amazing work. I hope you are rejuvenated by your break. I tried to run the version in the feature/m1 branch on a program of mine and got the following error. I'm on MacOS 14.7 (23H124) on an Apple M2 Max. I don't know if the following output is of interest: ` % ~/src/valgrind-macos/vg-in-place ./ref_speaker_curl_pump valgrind: the 'impossible' happened: host stacktrace: sched status: Thread 1: status = VgTs_Runnable syscall unix:197 (lwpid 259) Note: see also the FAQ in the source distribution. |
What kind of binary is ref_speaker_curl_pump? The 4k buffer on line 1164 of debuginfo.c might not be big enough. Can you try making it bigger? I need to clean up VG_(di_notify_mmap) and ML_(check_macho_and_get_rw_loads). ML_(check_macho_and_get_rw_loads) should be more like ML_(check_elf_and_get_rw_loads) taking the fd rather than relying on VG_(di_notify_mmap) to read the start of the binary into a fixed size buffer. |
Thanks for the response @paulfloyd !
The It is linked with code written in Rust and C++.
Thanks! That did change the behavior. If i increase the size to 16384 or 65536, there is an error later:
In this invocation, The C files were compiled with
The executable built with these |
Don't build your exe with sanitizers. Just -g and -fno-omit-frame-pointer are enough for Valgrind. Mixing sanitizers and Valgrind usually doesn't work. Apple has done a lot of work hardening its allocators and deallocators recently using type-aware functions. I don't know if that has spilled over into malloc_size. |
trying to impatiently compile the feature/m1 branch I get "make[3]: ./delayed-install-systemb.sh: No such file or directory"
https://github.com/search?q=delayed-install-systemb.sh&type=code |
Will the M2 ever come out one day? Thanks! |
This comment was marked as off-topic.
This comment was marked as off-topic.
Could we update this to include M3 as well. |
Just calling it arm64 would be simpler. |
Not really, because on Valgrind website, it clearly says 'ARM64/Linux: supported for ARMv8,' yet it's not compatible 😢 |
There are also M4 chips and will be more in the future. I suggest naming it |
It's just a variant of arm64. If/when this makes it upstream it will be ARM64/Darwin, probably keeping a parenthesized Mac OS X (or more likely macOS) on the front web page. |
There's no way that Apple marketing names are going to be used upstream. I mean, internally we refer to the OS as Darwin rather than the Apple product name. |
Well, that's what everybody else use, among both GUI and CLI apps. Almost every website that offers separate downloads for macOS lists them as "Intel" and "Apple Silicon". It is well-known, recognizable name, it's easy to understand for users. And it somewhat emphasizes the fact that Apple's aarch64 implementation, as usual, do not strictly follows the spec. Inventing new name for an existing thing just out of spite isn't reasonable |
Valgrind has been using Darwin since 2005. arm64 since 2014 (there are a small number of references to aarch64 but mostly we don't use the 'official' ARM name). We've also always used amd64 (the original name) rather than the more Intel-friendly x86_64. It's Apple that invented a new name, not us. |
will there be a version for m1?
The text was updated successfully, but these errors were encountered: