1. 安装gdb和相關文件51Please respect copyright.PENANAQoIabeEYLZ
# sudo apt install gdb51Please respect copyright.PENANADjBhgkRlW8
51Please respect copyright.PENANAE6tk3gu0TY
2. 開始調試51Please respect copyright.PENANAx1LGHK8fXa
# gdb my_exe51Please respect copyright.PENANA3Nkjb9I1jV
(gdb) r
3. 發生錯誤時查看出錯地點和調用過程51Please respect copyright.PENANAbNSR81ToBR
(gdb) bt
4. 退出gdb51Please respect copyright.PENANAnkUBzdnE90
(gdb) q
有時候需要glibc的源文件,可先下載glibc,然後指定給gdb51Please respect copyright.PENANAYEHG1mDdKa
# cd /usr/src/glibc51Please respect copyright.PENANALUPsoIgf7F
# tar xvf glibc-2.39.tar.xz51Please respect copyright.PENANAqJ64SQ60py
在gdb中指定glibc的源代碼:51Please respect copyright.PENANAGVcEQ82CNx
(gdb) directory /usr/src/glibc/glibc-2.39
如果您對程式設計、編程技術、C語言、網站開發、計算機系統的管理維護等有興趣,可以通過以下方式與淨明交流:【微信】si_jinmin 【Email】si.jinmin@gmail.com
ns18.227.140.153da2