for the past little bit I've been slowly working on developing a hobbyist kernel, and for all that time I've been using GDB with QEMU to investigate memory locations and registers and what not. However I recently wiped my Mac and installed a fresh copy of macOS Big Sur, and while GDB from homebrew on Mojave was able to load my kernel binary just fine, on Big Sur, it simply throws this error message: Reading symbols from ~/Kernel/bin/kernel... I'm sorry, Dave, I can't do that. Symbol format `elf32-i386' unknown.

I have no clue what's causing it, I'm using the stock version of GDB from homebrew, GDB 10.1. I also tried using i386-elf-gdb from homebrew but that doesn't work either. I even tried compiling GDB myself, and setting all sorts of configure options such as --enable-targets=all, and setting the target to i686-elf, but nothing seems to work, none of my configure options will enable any GDB on macOS Big Sur, either compiled from source, or downloaded from homebrew, to read elf32-i386 kernel binaries.

2 Answers 2


Figured out what the issue was, turns out that clang really doesn't like when you try and use strncmp without first including string.h. Meanwhile gcc is perfectly happy to compile elf-bfd.h without including string.h. As a result, even though GDB will compile on macOS, it simply refuses to load any ELF files because the ELF code isn't compiled correctly. The fix is just to add #include <string.h> to the top of elf-bfd.h and GDB will correctly load ELF binaries.


For macos if you are using brew you can install and use i386-elf-gdb - https://formulae.brew.sh/formula/i386-elf-gdb.

brew install i386-elf-gdb

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .