user497977
user497977

Reputation: 11

in linux, how to find which thread is in suspend state inside gdb?

i have a multi-threaded program which has ~200 threads running on linux, i know it's kind of a lot. well, this is a legacy program :) this program is running on 2.6.29 with debian OS how can i easily find out which thread's stack frame contain like functionA? i am using "thread apply all bt" to display all the threads's backtrace. However, i need to examine each stack frame to find the correct thread that contain functionA.

thank you! questionchild

Upvotes: 1

Views: 1502

Answers (1)

ks1322
ks1322

Reputation: 35716

You can save output of thread apply all bt to log file and then grep it or examine somehow else. Also it will be useful to disable pagination.

[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

Upvotes: 2

Related Questions