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.

Answer from Andrew on Stack Overflow
🌐
GitHub
gist.github.com › mike-myers-tob › 9a6013124bad7ff074d3297db2c98247
Steps to get GDB actually working in April 2021 on macOS (Intel x86-64 only) · GitHub
Really, as Andrew said on StackOverflow (2 years ago, so the details aren't fully current, but the gist still very much is): "GDB has not (yet) been ported to MacOS running on the M2 (AArch64) architecture.
🌐
Medium
medium.com › @AI_and_Blockchain › how-to-get-gdb-running-on-macos-with-arm-chips-using-qemu-ff9041d6f380
How to Get GDB Running on macOS with ARM Chips Using QEMU | by AI_and_Blockchain | Medium
December 13, 2023 - Unfortunately, GDB doesn’t run natively on macOS with these chips, and LLDB, the default debugger on macOS, doesn’t support the 32-bit RISC-V architecture.
🌐
Apple Community
discussions.apple.com › thread › 253272158
gdb compiler - Apple Community
I’d expect gdb to install with gcc, so (if this is not already what you are trying) try installing gcc:
🌐
Tweaking4All
tweaking4all.com › forums › software developmen... › delphi, lazarus, fr...
macOS - Install GDB in 2023 (for use with Lazarus Pascal)
August 2, 2021 - A lot has changed since Apple dropped GDB support in favor of LLDB, and some devs on the Lazarus team have done great effort to make LLDB work, and it...
🌐
Reddit
reddit.com › r/asahilinux › gdb on m2 (osx)
r/AsahiLinux on Reddit: GDB on M2 (OSX)
January 5, 2023 -

Hey! I know this isn't an Asahi Linux question, but you people will probably know more than your generic r/m2 or whatever the sub is. Has anyone gotten gdb installed in osx? I just want to debug a simple C program, so I'm also happy to use whatever cli alternative you might have.

🌐
MacPorts
ports.macports.org › port › gdb-apple
Install gdb-apple on macOS with MacPorts
GDB can run on most popular UNIX and Microsoft Windows variants. ... If not done already, install MacPorts.
Find elsewhere
🌐
DEV Community
dev.to › jasonelwood › setup-gdb-on-macos-in-2020-489k
Install Gdb Mac: Setup gdb on macOS in 2020 - DEV Community
September 18, 2020 - If you tried debugging with gdb now, you would likely receive a "No symbol table is loaded" error. In order to solve this, you'll need to compile programs with the -ggdb option, as in the following example: ... At this point you should be able to successfully debug your programs on Mac using gdb.
🌐
GitHub
github.com › kingking888 › gdb-plugins-for-mac
GitHub - kingking888/gdb-plugins-for-mac: Mac M1 M2 gdb plugins
Run install.sh and then use one of the commands below to launch the corresponding GDB environment: gdb-peda gdb-peda-intel gdb-peda-arm gdb-pwndbg gdb-gef ... cd ~ && git clone https://github.com/kingking888/gdb-plugins-for-mac.git cd ~/gdb-plugins-for-mac ./install.sh
Author   kingking888
🌐
GitHub
github.com › orgs › Homebrew › discussions › 1114
Support for gdb on m1? · Homebrew · Discussion #1114
Yes it is installable using brew install gdb, but still you can't debug native Mach-O binaries. GDB never worked good with Mach-O.
🌐
UCI ICS
ics.uci.edu › ~pattis › common › handouts › macmingweclipse › allexperimental › mac-gdb-install.html
ICS 46: GDB Installation on Mac OS X
For each of them, open the Debugger tab, set the GDB debugger field to the same path /usr/local/bin/gdb, and click the Apply button. After repeating this change for all listed projects, click Close. ... If the above steps do not solve the issue on your machine, or you encounter a problem while following them, please do not hesitate to come to one of the upcoming common labs for help.
🌐
YouTube
youtube.com › watch
How to install gdb on MacOS terminal Sierra - YouTube
macos: How to install gdb on MacOS terminal SierraThanks for taking the time to learn more. In this video I'll go through your question, provide various answ...
Published   April 4, 2023
🌐
Reddit
reddit.com › r/c_programming › does installing gdb on a mac usually take a while? or is it only me?
r/C_Programming on Reddit: Does installing GDB on a mac usually take a while? or is it only me?
April 13, 2024 - It takes forever for Apple Silicon users unless you install JetBrains CLion and harvest the gdb build from there. It's ridiculous it took all these years to get it. ... Don't buy mac if you want to do anything beyond browsing the web and doing some basic video editing - a big fuckin' waste of money for us, coding apes ....
🌐
MacPorts
ports.macports.org › port › gdb
Install gdb on macOS with MacPorts
GDB can run on most popular UNIX and Microsoft Windows variants. ... If not done already, install MacPorts.