Skip to content

Instantly share code, notes, and snippets.

@cheald
Created December 8, 2012 03:59
Show Gist options
  • Save cheald/4238531 to your computer and use it in GitHub Desktop.
Save cheald/4238531 to your computer and use it in GitHub Desktop.
(gdb) info threads
6 Thread 0x40b93940 (LWP 15361) 0x00000037efa0aee9 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
5 Thread 0x42755940 (LWP 15431) 0x00000037efa0cd01 in sem_wait () from /lib64/libpthread.so.0
4 Thread 0x413b7940 (LWP 15771) 0x00000037efa0aee9 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
3 Thread 0x41c0d940 (LWP 15772) 0x00000037efa0aee9 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
2 Thread 0x4011d940 (LWP 19424) 0x00000037eeacd722 in select () from /lib64/libc.so.6
* 1 Thread 0x2b96ec0facc0 (LWP 15167) 0x00000037eeabb187 in sched_yield () from /lib64/libc.so.6
(gdb) bt full
#0 0x00000037eeabb187 in sched_yield () from /lib64/libc.so.6
No symbol table info available.
#1 0x00002b96ebe39ba3 in gvl_yield (vm=0x55f8f20, th=<value optimized out>) at thread_pthread.c:123
No locals.
#2 0x00002b96ebe39f39 in rb_thread_schedule_limits () at thread.c:1025
No locals.
#3 rb_thread_schedule () at thread.c:1035
No locals.
#4 0x00002b96ebe3a136 in rb_thread_terminate_all () at thread.c:375
_th = 0x55f9520
_tag = {buf = {{__jmpbuf = {0, 7509665241996969646, 0, 140736260182128, 0, 90150176, 7509698779018709598, 7509641504071116675}, __mask_was_saved = 0, __saved_mask = {__val = {140736260182128, 0, 0, 7509698779018709902,
7509641504068102843, 140733193388032, 240243474669, 0, 47927202636682, 0, 8, 0, 140736260186112, 10485760, 301905312, 32}}}}, tag = 0, retval = 91278704, prev = 0x7fffb6cb8e50}
th = <value optimized out>
vm = 0x55f8f20
#5 0x00002b96ebd1af8e in ruby_cleanup (ex=6) at eval.c:140
_th = 0x55f9520
_tag = {buf = {{__jmpbuf = {90150176, 7509665241996969646, 0, 140736260182128, 0, 0, 7509698779018709134, 7509641504068103008}, __mask_was_saved = 0, __saved_mask = {__val = {140736260182128, 0, 0, 47927201075200, 240222523141,
5, 0, 10485760, 100700896, 47927201105296, 96114960, 0, 240222546306, 6, 0, 90150176}}}}, tag = 0, retval = 6, prev = 0x0}
state = <value optimized out>
errs = {161115400, 161115400}
th = 0x55f9520
#6 0x00002b96ebd1b0d6 in ruby_run_node (n=0x5ba9910) at eval.c:244
status = <value optimized out>
#7 0x00000000004008bf in main (argc=8, argv=0x7fffb6cb9078) at main.c:38
variable_in_this_stack_frame = 240224684992
(gdb)
372 while (!rb_thread_alone()) {
(gdb) list
367
368 thread_debug("rb_thread_terminate_all (main thread: %p)\n", (void *)th);
369 st_foreach(vm->living_threads, terminate_i, (st_data_t)th);
370 vm->inhibit_thread_creation = 1;
371
372 while (!rb_thread_alone()) {
373 PUSH_TAG();
374 if (EXEC_TAG() == 0) {
375 rb_thread_schedule();
376 }
(gdb) step
rb_thread_alone () at thread.c:2171
2171 if (GET_THREAD()->vm->living_threads) {
(gdb) list
2166
2167 int
2168 rb_thread_alone(void)
2169 {
2170 int num = 1;
2171 if (GET_THREAD()->vm->living_threads) {
2172 num = vm_living_thread_num(GET_THREAD()->vm);
2173 thread_debug("rb_thread_alone: %d\n", num);
2174 }
2175 return num == 1;
(gdb) p num
$1 = <value optimized out>
(gdb) stepi
0x00002b96ebe354f7 2171 if (GET_THREAD()->vm->living_threads) {
(gdb)
0x00002b96ebe354fa 2171 if (GET_THREAD()->vm->living_threads) {
(gdb)
0x00002b96ebe354fe 2171 if (GET_THREAD()->vm->living_threads) {
(gdb)
0x00002b96ebe35505 2171 if (GET_THREAD()->vm->living_threads) {
(gdb)
0x00002b96ebe3550a 2171 if (GET_THREAD()->vm->living_threads) {
(gdb)
0x00002b96ebe3550d 2171 if (GET_THREAD()->vm->living_threads) {
(gdb)
0x00002b96ebe3550f 2171 if (GET_THREAD()->vm->living_threads) {
(gdb)
0x00002b96ebe35513 2171 if (GET_THREAD()->vm->living_threads) {
(gdb)
0x00002b96ebe35516 2171 if (GET_THREAD()->vm->living_threads) {
(gdb)
0x00002b96ebe35519 2171 if (GET_THREAD()->vm->living_threads) {
(gdb)
0x00002b96ebe3551c 2171 if (GET_THREAD()->vm->living_threads) {
(gdb)
2176 }
(gdb) p num
$2 = <value optimized out>
(gdb) p num == 1
$3 = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
sched_yield() = 0
(and so on)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment