I am getting segmentation fault error in C code so I think the best thing to use to find error would be gdb but gdb is not found.
GDB has not (yet) been ported to MacOS running on the M2 (AArch64) architecture. Even GDB for MacOS on the old x86-64 was not very well tested as far as I know.
I believe lldb might be available for the MacOS/M2 target, but I know nothing about installing this debugger on MacOS.
If you really want to use gdb on mac, which is as Andrew stated, not well tested, you can use x86_64 version of brew:
First, you need to install x86_64 brew:
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Then, you can install gdb right away using:
arch -x86_64 zsh
arch -x86_64 brew install gdb
In addition, you might want need to alias x86_64 brew by adding it to your .zshrc
alias x86brew='arch -x86_64 /usr/local/bin/brew'
So you can just use "x86brew" to install without having to "arch -x86_64 zsh"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With