gdb fails to run ELF 64-bit program with “File format not recognized”

后端 未结 5 1738
不知归路
不知归路 2021-02-13 13:02

I\'m trying to use GDB to debug (to find an annoying segfault). When I run:

gdb ./filename

from the command line, I get the following error:

5条回答
  •  情深已故
    2021-02-13 13:43

    The question refers to "./filename" and to "/path/executable". Are these the same file?

    If you are doing a post-mortem analysis, you would run:

    gdb executable-file core-file
    

    If you are going to ignore the core file, you would run:

    gdb executable-file
    

    In both cases, 'executable-file' means a pathname to the binary you want to debug. Most usually, that is actually a simple filename in the current directory, since you have the source code from your debug build there.

    On Solaris, a 64-bit build of GDB is supposed to be able to debug both 32-bit and 64-bit executables (though I've had some issues with recent versions of GDB). I'm not sure of the converse - that a 32-bit GDB can necessarily debug 64-bit executables.

提交回复
热议问题