gdb error not in executable format: File format not recognized

后端 未结 2 429
春和景丽
春和景丽 2020-12-16 12:29

I am trying to debug a simple \"hello world\" C++ program on Ubuntu 16.04 but gdb is not able to recognize the executable file format. However, I am able to successfully run

2条回答
  •  被撕碎了的回忆
    2020-12-16 12:54

    It is almost certain that ks1322's comment is correct one:

    1. You've installed a 64-bit GCC, so your ./hello is a 64-bit binary (use file ./hello to confirm).
    2. You've installed a 32-bit only GDB, so it doesn't know how to debug x86_64 binaries.

    The fix is simple: install 64-bit GDB (which is capable of debugging both 32 and 64-bit binaries), or build hello in 32-bit mode (with g++ -m32 ...).

提交回复
热议问题