Backtrace of every the threads

Ricardo Ribalda Delgado ricardo.ribalda at gmail.com
Wed Feb 10 05:56:40 EST 2016


I did not explain myself well.

By thread I mean kernel thread, and user thread.

What i want to get is a back trace of ALL the programs running in user
and kernel space.

Your example is a single program, and the trace ends in userspace.


Sorry for the missunderstunding.

On Wed, Feb 10, 2016 at 11:32 AM, Anupam Kapoor <anupam.kapoor at gmail.com> wrote:
>
>>>>>> [2016-02-10T15:06:30+0530]: "Ricardo Ribalda Delgado" (ricardo-delgado):
> ,----[ ricardo-delgado ]
> | Unfortunately not :( But thanks for trying :)
> `----
> seems to work just fine on a trivial program here:
> < aside: hopefully, i will not be judged too harshly for c++ :) >
>
> ,----
> | anupam at fatcat cpu-stuff % gdb obj/affine-thread-to-cpu
> | GNU gdb (GDB) 7.10.1
> | Copyright (C) 2015 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 "x86_64-unknown-linux-gnu".
> | Type "show configuration" for configuration details.
> | For bug reporting instructions, please see:
> | <http://www.gnu.org/software/gdb/bugs/>.
> | Find the GDB manual and other documentation resources online at:
> | <http://www.gnu.org/software/gdb/documentation/>.
> | For help, type "help".
> | Type "apropos word" to search for commands related to "word"...
> | Reading symbols from obj/affine-thread-to-cpu...done.
> | (gdb) core core.11717
> | warning: core file may not match specified executable file.
> | [New LWP 11717]
> | [New LWP 11718]
> | [New LWP 11720]
> | [New LWP 11721]
> | [New LWP 11719]
> | warning: Could not load shared library symbols for linux-vdso.so.1.
> | Do you need "set solib-search-path" or "set sysroot"?
> | [Thread debugging using libthread_db enabled]
> | Using host libthread_db library "/usr/lib/libthread_db.so.1".
> | Core was generated by `./obj/affine-thread-to-cpu'.
> | Program terminated with signal SIGSEGV, Segmentation fault.
> | #0  0x00007f4a34f9170d in pthread_join () from /usr/lib/libpthread.so.0
> | [Current thread is 1 (Thread 0x7f4a3536f740 (LWP 11717))]
> | (gdb) thread apply all
> | Please specify a command following the thread ID list
> | (gdb) thread apply all bt
> |
> | Thread 5 (Thread 0x7f4a33b4d700 (LWP 11719)):
> | #0  0x00007f4a34f9965d in nanosleep () from /usr/lib/libpthread.so.0
> | #1  0x0000000000401534 in std::this_thread::sleep_for<long, std::ratio<1l, 1000l> > (__rtime=...) at /usr/include/c++/5.3.0/thread:292
> | #2  <lambda()>::operator() (__closure=0x24d8de8) at affine-thread-to-cpu.cpp:27
> | #3  std::_Bind_simple<main(int, char**)::<lambda()>()>::_M_invoke<> (this=0x24d8de8) at /usr/include/c++/5.3.0/functional:1531
> | #4  std::_Bind_simple<main(int, char**)::<lambda()>()>::operator() (this=0x24d8de8) at /usr/include/c++/5.3.0/functional:1520
> | #5  std::thread::_Impl<std::_Bind_simple<main(int, char**)::<lambda()>()> >::_M_run(void) (this=0x24d8dd0) at /usr/include/c++/5.3.0/thread:115
> | #6  0x00007f4a34cbff40 in std::(anonymous namespace)::execute_native_thread_routine (__p=<optimized out>)
> |     at /build/gcc/src/gcc-5.3.0/libstdc++-v3/src/c++11/thread.cc:84
> | #7  0x00007f4a34f904a4 in start_thread () from /usr/lib/libpthread.so.0
> | #8  0x00007f4a3443813d in clone () from /usr/lib/libc.so.6
> |
> | Thread 4 (Thread 0x7f4a32b4b700 (LWP 11721)):
> | #0  0x00007f4a34f9965d in nanosleep () from /usr/lib/libpthread.so.0
> | #1  0x0000000000401534 in std::this_thread::sleep_for<long, std::ratio<1l, 1000l> > (__rtime=...) at /usr/include/c++/5.3.0/thread:292
> | #2  <lambda()>::operator() (__closure=0x24d90c8) at affine-thread-to-cpu.cpp:27
> | #3  std::_Bind_simple<main(int, char**)::<lambda()>()>::_M_invoke<> (this=0x24d90c8) at /usr/include/c++/5.3.0/functional:1531
> | #4  std::_Bind_simple<main(int, char**)::<lambda()>()>::operator() (this=0x24d90c8) at /usr/include/c++/5.3.0/functional:1520
> | #5  std::thread::_Impl<std::_Bind_simple<main(int, char**)::<lambda()>()> >::_M_run(void) (this=0x24d90b0) at /usr/include/c++/5.3.0/thread:115
> | #6  0x00007f4a34cbff40 in std::(anonymous namespace)::execute_native_thread_routine (__p=<optimized out>)
> |     at /build/gcc/src/gcc-5.3.0/libstdc++-v3/src/c++11/thread.cc:84
> | #7  0x00007f4a34f904a4 in start_thread () from /usr/lib/libpthread.so.0
> | #8  0x00007f4a3443813d in clone () from /usr/lib/libc.so.6
> |
> | Thread 3 (Thread 0x7f4a3334c700 (LWP 11720)):
> | #0  0x00007f4a34f9965d in nanosleep () from /usr/lib/libpthread.so.0
> | #1  0x0000000000401534 in std::this_thread::sleep_for<long, std::ratio<1l, 1000l> > (__rtime=...) at /usr/include/c++/5.3.0/thread:292
> | #2  <lambda()>::operator() (__closure=0x24d8f58) at affine-thread-to-cpu.cpp:27
> | #3  std::_Bind_simple<main(int, char**)::<lambda()>()>::_M_invoke<> (this=0x24d8f58) at /usr/include/c++/5.3.0/functional:1531
> | #4  std::_Bind_simple<main(int, char**)::<lambda()>()>::operator() (this=0x24d8f58) at /usr/include/c++/5.3.0/functional:1520
> | #5  std::thread::_Impl<std::_Bind_simple<main(int, char**)::<lambda()>()> >::_M_run(void) (this=0x24d8f40) at /usr/include/c++/5.3.0/thread:115
> | #6  0x00007f4a34cbff40 in std::(anonymous namespace)::execute_native_thread_routine (__p=<optimized out>)
> |     at /build/gcc/src/gcc-5.3.0/libstdc++-v3/src/c++11/thread.cc:84
> | #7  0x00007f4a34f904a4 in start_thread () from /usr/lib/libpthread.so.0
> | #8  0x00007f4a3443813d in clone () from /usr/lib/libc.so.6
> |
> | Thread 2 (Thread 0x7f4a3434e700 (LWP 11718)):
> | #0  0x00007f4a34f9965d in nanosleep () from /usr/lib/libpthread.so.0
> | #1  0x0000000000401534 in std::this_thread::sleep_for<long, std::ratio<1l, 1000l> > (__rtime=...) at /usr/include/c++/5.3.0/thread:292
> | #2  <lambda()>::operator() (__closure=0x24d8c78) at affine-thread-to-cpu.cpp:27
> | #3  std::_Bind_simple<main(int, char**)::<lambda()>()>::_M_invoke<> (this=0x24d8c78) at /usr/include/c++/5.3.0/functional:1531
> | #4  std::_Bind_simple<main(int, char**)::<lambda()>()>::operator() (this=0x24d8c78) at /usr/include/c++/5.3.0/functional:1520
> | #5  std::thread::_Impl<std::_Bind_simple<main(int, char**)::<lambda()>()> >::_M_run(void) (this=0x24d8c60) at /usr/include/c++/5.3.0/thread:115
> | #6  0x00007f4a34cbff40 in std::(anonymous namespace)::execute_native_thread_routine (__p=<optimized out>)
> |     at /build/gcc/src/gcc-5.3.0/libstdc++-v3/src/c++11/thread.cc:84
> | #7  0x00007f4a34f904a4 in start_thread () from /usr/lib/libpthread.so.0
> | #8  0x00007f4a3443813d in clone () from /usr/lib/libc.so.6
> |
> | Thread 1 (Thread 0x7f4a3536f740 (LWP 11717)):
> | #0  0x00007f4a34f9170d in pthread_join () from /usr/lib/libpthread.so.0
> | #1  0x00007f4a34cbfe57 in __gthread_join (__value_ptr=0x0, __threadid=<optimized out>)
> |     at /build/gcc/src/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu/bits/gthr-default.h:668
> | #2  std::thread::join (this=this at entry=0x24d8c20) at /build/gcc/src/gcc-5.3.0/libstdc++-v3/src/c++11/thread.cc:107
> | #3  0x0000000000401248 in main (argc=<optimized out>, argv=<optimized out>) at affine-thread-to-cpu.cpp:45
> | (gdb)
> |
> `----
>
> --
>
> kind regards
> anupam



-- 
Ricardo Ribalda



More information about the Kernelnewbies mailing list