2
votes

I compiled a project for debugging, but when I try to run it through GDB I get this message: Reading symbols from FSOP...

BFD: /usr/lib/dyld(i386:x86-64): unknown load command 0x34

BFD: /usr/lib/dyld(i386:x86-64): unknown load command 0x34

BFD: /usr/lib/dyld(i386:x86-64): unknown load command 0x34

I am using GDB 9.1 and am on Mac OS Catilina. Anyone know what is going wrong?

2
More detail is required. - trojanfoe
Have you fixed this? - Frank AK

2 Answers

1
votes

In short:

GDB just sucks on Mac OS now, don't use it. Use lldb, Visual Studio Code or Xcode to debug your C program instead.

Or, if you believe there is a way to use gdb but I just don't know it, please let me know by leave a comment. But I haven't really talked to people on stack overflow, so I'm not sure if I'm allowed to reply a comment. If I cannot, I will just reply by editing my answer, so please check again if you haven't received my reply in a while.

The longer version:

This is not really an answer to OP's question, but I decide to write this, which may possibly help people suffering the same pain with me. I tried to get GDB 9.2 working, with macOS Catalina version 10.15.6, but failed.

First, note that the messages are warnings. They probably won't affect gdb running as explained in the other answer here. It took me a while to figure out that, if your gdb is still not working, that's probably due to something else. Try to see one more line under the warning messages mentioned by OP; you should be able to find the correct reason.

Bad news is, the other problem is still hard to solve. I spent some more hours on it, but I just couldn't solve it.

All I need is just a debugger with gui to debug a small C program, so I gave up trying make gdb running, and turn to use Visual Studio Code instead. Xcode should be able to do the job, too.

0
votes

BFD is complaining because there is a mach-o load command in dyld that it doesn't understand. The load commands are the directives the linker uses to describe the contents of a mach-o executable.

You can find all the mach-o load commands in usr/include/mach-o/loader.h. 0x34 is LC_DYLD_CHAINED_FIXUPS. Looks like it was added at the end of 2019.

lldb doesn't have to do anything with this load command (other than not complain about it). So gdb shouldn't need to handle this either, and provided this is just a warning and not an error from BFD, you can ignore it.

I don't remember whether gdb uses its own copy of the loader.h defines or uses the one from the system includes. If the latter, you probably just need to rebuild gdb against a Catalina SDK.