Richard
Richard

Reputation: 121

GDB doesn't work - not executable format?

When trying to run gdb with gdb ./mm.c I'm getting the following error:

"0x7ffee71424c0s": not in executable format: file format not recognise

Does someone recognise this error and can help me to fix it?

Upvotes: 0

Views: 788

Answers (1)

pmg
pmg

Reputation: 108967

C is (usually) a compiled language (vs. interpreted language such as (usually) JavaScript).

Your computer "speaks" 0s and 1s, not for and if.
The source code you write (the fors and ifs) needs to be translated (compiled) to the proper 0s and 1s. That is the job of the compiler.

gcc -Wall -Wextra nm.c -O0 -ggdb -oexefile
^^^                                             compile
                  ^^^^                          the fors and ifs in nm.c
                                 ^^^^^^^^^      into 0s and 1s in exefile
    ^^^^^^^^^^^^^                               warn about most common mistakes
                       ^^^                      do not optimize
                           ^^^^^                and output debug information for gdb

Then the job of the debugger is to show the 0s and 1s (grouped back to the original source lines when possible) as they execute, statement by statement

gdb ./exefile

With optimizations, the compiler would (very possibly) make 0s and 1s with no relation to the original fors and ifs, making it impossible for gdb to associate them with original for and if statements.

Upvotes: 1

Related Questions