1. 安装gdb和相關文件53Please respect copyright.PENANAx6pjVXC3ab
# sudo apt install gdb53Please respect copyright.PENANAQvwFgBY1pN
53Please respect copyright.PENANARpvZZn5i4H
2. 開始調試53Please respect copyright.PENANAmyKshos7ux
# gdb my_exe53Please respect copyright.PENANAugaRzb7bze
(gdb) r
3. 發生錯誤時查看出錯地點和調用過程53Please respect copyright.PENANAZyhgA09l5P
(gdb) bt
4. 退出gdb53Please respect copyright.PENANAwy93RtpLVR
(gdb) q
有時候需要glibc的源文件,可先下載glibc,然後指定給gdb53Please respect copyright.PENANAixcBgfawrw
# cd /usr/src/glibc53Please respect copyright.PENANAOhgACgbxYM
# tar xvf glibc-2.39.tar.xz53Please respect copyright.PENANA3aTwipw6p6
在gdb中指定glibc的源代碼:53Please respect copyright.PENANAKv7P8Q6Gcf
(gdb) directory /usr/src/glibc/glibc-2.39
如果您對程式設計、編程技術、C語言、網站開發、計算機系統的管理維護等有興趣,可以通過以下方式與淨明交流:【微信】si_jinmin 【Email】[email protected]
ns3.145.57.4da2