gdb調試多線程

來源:互聯網
上載者:User

標籤:.net   targe   net   多線程   size   ati   font   位置   pstree   

二、編譯運行

 

2.1 編譯

        gcc -g test.c -lpthread -o test

2.2 運行

        ./test 

2.3 輸出結果

三、調試 -- 方法1

3.1 查看 test進程號

        ps aux|grep test

3.2 查看進程中的所有線程

        pstree -p 13006

3.3 gdb調試定位bug位置

        gdb

        attach 進程號

        bt 【thread apply all bt】

如:

        thread apply all bt

四、調試 --  方法2

4.1 查看 test進程號

        ps -e|grep test

4.2 gdb調試定位bug位置

        gdb test 進程號   啟動gdb attach 進程

        info threads         顯示所有線程資訊

        thread 2               調到第2個線程

        bt                           查看第2個線程的堆棧,即可可以看到線程死結的地方

 

 

參考資料:

      使用gdb調試死結線程:http://blog.csdn.net/atinybirdinit/article/details/41550149

 

原文地址:http://blog.csdn.net/guowenyan001/article/details/46238355

gdb調試多線程

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.