【问题标题】:in linux, how to find which thread is in suspend state inside gdb?在linux中,如何在gdb中找到哪个线程处于挂起状态?
【发布时间】:2010-11-05 04:12:40
【问题描述】:

我有一个多线程程序,它在 linux 上运行了大约 200 个线程,我知道它有点多。好吧,这是一个遗留程序:) 该程序在 2.6.29 上运行,带有 debian OS 如何轻松找出哪个线程的堆栈帧包含类似functionA? 我正在使用“线程应用所有 bt”来显示所有线程的回溯。但是,我需要检查每个堆栈帧以找到包含 functionA 的正确线程。

谢谢! 问题孩子

【问题讨论】:

    标签: linux multithreading debugging gdb backtrace


    【解决方案1】:

    您可以将 thread apply all bt 的输出保存到日志文件,然后对其进行 grep 或以其他方式检查。禁用分页也很有用。

    [root@localhost ~]# gdb
    GNU gdb (GDB) 7.2
    Copyright (C) 2010 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "i686-pc-linux-gnu".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    (gdb) set logging on
    (gdb) set pagination off
    (gdb) thread apply all bt
    

    【讨论】:

    • 这就是我所做的......我认为可能有其他方法可以找到它。可能是 gdb 或其他工具中的某些命令。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-24
    • 1970-01-01
    • 2012-11-24
    • 2023-03-29
    相关资源
    最近更新 更多