我開始使用這個GDB(工作目錄是/ home /萊昂/開發/測試/原子/):GDB不找貨源
gdb ./bin/lin64/httpress
然後,添加目錄與源文件,並理解我:
Source directories searched: /home/leon/Develop/tests/atomic/third/http_parser:/home/leon/Develop/tests/atomic/src/tools:$cdir:$cwd
當我運行我的二進制文件時,gdb無法識別我的源代碼中發生段錯誤的行。 如何設置gdb的源文件?
gcc -D_AMD64_ -D_LIN_ -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -m64 -march=core2 -O2 -Wall -I. -I src/include -I src/lib/zlib/ -I src/lib/otg -I third/openssl/include/ -I src/lib/otg/Tools/HostTime/Interfaces/ -I src/lib/otg/Tools/OpenToolsGate/Guest/Interfaces/ -I src/lib/otg/Tools/OpenToolsGate/Guest/Cross -I src/lib/otg/Tools/OpenToolsGate/Common/Interfaces/ -o bin/lin64/httpress -std=c99 -lpthread -lev -lgnutls -O2 -s -DWITH_SSL -Wno-strict-aliasing \
-I /usr/include/libev src/tools/httpress.c -I third/http_parser/ third/http_parser/http_parser.c
好吧,我做了一些改動:
gcc -g -ggdb -D_AMD64_ -D_LIN_ -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -m64 -march=core2 -Wall -I. -I src/include -I src/lib/zlib/ -I src/lib/otg -I third/openssl/include/ -I src/lib/otg/Tools/HostTime/Interfaces/ -I src/lib/otg/Tools/OpenToolsGate/Guest/Interfaces/ -I src/lib/otg/Tools/OpenToolsGate/Guest/Cross -I src/lib/otg/Tools/OpenToolsGate/Common/Interfaces/ -o bin/lin64/httpress -std=c99 -lpthread -lev -lgnutls -s -DWITH_SSL -Wno-strict-aliasing \
-I /usr/include/libev src/tools/httpress.c -I third/http_parser/ third/http_parser/http_parser.c
在這種情況下,它仍然無法找到二進制符號
該計劃是由GCC編譯。 但如果我從gcc調用中刪除-s選項。它寫道:
Reading symbols from /home/leon/Develop/tests/atomic/bin/lin64/httpress...done.
但Debugger仍這樣說:
(gdb) info source
No current source file.
...我點他與源目錄後。
如果你沒有運行該程序,那麼'info source'返回'沒有當前源文件'是正常的。你嘗試過'信息源'嗎? – jcm