GBD: info thead输出各个字段的含义

GDB是一个强大的调试工具,文中详细介绍了使用infothread命令查看线程信息,包括线程ID、目标ID、详细信息、线程名、状态和执行帧等。当线程停止时,会显示当前执行的栈帧信息,这对于理解和调试多线程程序的执行流程非常有帮助。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、进行调试:

(gdb) info thread
  Id   Target Id                                Frame 
  1    Thread 0x7fa684e78740 (LWP 5733) "a.out" main () at 1.cpp:54
  2    Thread 0x7fa6850ab740 (LWP 5734) "a.out" clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:78
  3    Thread 0x7fa684e77700 (LWP 6022) "a.out" 0x000055cf97389245 in timer_thread (v=...)
    at 1.cpp:10
* 4    Thread 0x7fa67ffff700 (LWP 6023) "a.out" timer_thread (v=...) at 1.cpp:10

2、信息说明
Whenever GDB has to report an information about a thread, it uses a tuple with the following fields. The fields are always present unless stated otherwise.
id
The global numeric id assigned to the thread by GDB.

target-id
The target-specific string identifying the thread.

details
Additional information about the thread provided by the target. It is supposed to be human-readable and not interpreted by the frontend. This field is optional.

name
The name of the thread. If the user specified a name using the thread name command, then this name is given. Otherwise, if GDB can extract the thread name from the target, then that name is given. If GDB cannot find the thread name, then this field is omitted.

state
The execution state of the thread, either ‘stopped’ or ‘running’, depending on whether the thread is presently running.

frame
The stack frame currently executing in the thread. This field is only present if the thread is stopped. Its format is documented in GDB/MI Frame Information.

core
The value of this field is an integer number of the processor core the thread was last seen on. This field is optional.

3参考文档

https://sourceware.org/gdb/current/onlinedocs/gdb.html/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值