gdb on mac 10.9 fails with “not in executable format: File format not recognized” for 32+64 arch

前端 未结 2 785
予麋鹿
予麋鹿 2021-02-07 08:23
$ file app
app: Mach-O universal binary with 2 architectures
app (for architecture i386):    Mach-O executable i386
app (for architecture x86_64):  Mach-O 64-bit executa         


        
2条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-07 09:08

    Unfortunately, the non-Apple version of GNU gdb is currently unable to debug universal (or 'fat') binaries (ones that contain both 32-bit and 64-bit executables).

    One option is to use lipo to extract a single architecture and run gdb on that:

    lipo -thin x86_64 -output app-x86_64 ./app
    

    or

    lipo -thin i386 -output app-i386 ./app
    

    If you'd prefer to debug the combined executable, you could try using LLDB, or an Apple version of gdb.

提交回复
热议问题