zoukankan      html  css  js  c++  java
  • gdb调试多线程

    二、编译运行

    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

  • 相关阅读:
    UVa 727
    UVa 11495
    UVa 299
    UVa 10194
    UVa 146
    10025
    Tug of War POJ 2576 DP(类似背包)
    Problem A: Freckles UVA 10034 裸生成树
    UVA 562
    CF DIV 2 206 C. Vasya and Robot
  • 原文地址:https://www.cnblogs.com/xuelei/p/7531889.html
Copyright © 2011-2022 走看看