1. 安装gdb和相關文件18Please respect copyright.PENANA3fCzyESXWf
# sudo apt install gdb18Please respect copyright.PENANAtr73ijOsWQ
18Please respect copyright.PENANAemFAnkEfwa
2. 開始調試18Please respect copyright.PENANAl91qQfL9Gu
# gdb my_exe18Please respect copyright.PENANAXcWWuPYqe1
(gdb) r
3. 發生錯誤時查看出錯地點和調用過程18Please respect copyright.PENANAdEBERcmLpi
(gdb) bt
4. 退出gdb18Please respect copyright.PENANA9bmTbjUnkm
(gdb) q
有時候需要glibc的源文件,可先下載glibc,然後指定給gdb18Please respect copyright.PENANAzh6AskiqcP
# cd /usr/src/glibc18Please respect copyright.PENANA2RP90fBMeu
# tar xvf glibc-2.39.tar.xz18Please respect copyright.PENANAbZLLwzJ2lJ
在gdb中指定glibc的源代碼:18Please respect copyright.PENANAUGgCFBjwZ7
(gdb) directory /usr/src/glibc/glibc-2.39
如果您對程式設計、編程技術、C語言、網站開發、計算機系統的管理維護等有興趣,可以通過以下方式與淨明交流:【微信】si_jinmin 【Email】si.jinmin@gmail.com
ns 15.158.61.20da2