簡體   English   中英

GDB 不起作用 - 不是可執行格式?

[英]GDB doesn't work - not executable format?

嘗試使用gdb ./mm.c運行 gdb 時,出現以下錯誤:

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

有人認出這個錯誤並且可以幫助我修復它嗎?

C 語言(通常)是一種編譯語言(相對於解釋性語言,例如(通常)JavaScript)。

您的計算機“說話” 0 s 和1 s,而不是forif
您編寫的源代碼( for s 和if s)需要被翻譯(編譯)為正確的0 s 和1 s。 這就是編譯器的工作。

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

然后調試器的工作是顯示0 s 和1 s(在可能的情況下組合回原始源代碼行),因為它們逐個語句執行

gdb ./exefile

通過優化,編譯器(很可能)使0 s 和1 s 與原始for s 和if s 無關,從而使 gdb 無法將它們與原始的forif語句相關聯。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM