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

  • 相关阅读:
    json
    网页版 treeview使用中遇到的问题
    随机获取一条数据
    oracle
    发送邮件
    DataGrid列的合并
    python简介
    SQLSERVER
    Maven 基础
    Maven 构建jar包
  • 原文地址:https://www.cnblogs.com/xuelei/p/7531889.html
Copyright © 2011-2022 走看看