[#25936] [Bug:1.9] [rubygems] $LOAD_PATH includes bin directory — Nobuyoshi Nakada <nobu@...>

Hi,

10 messages 2009/10/05

[#25943] Disabling tainting — Tony Arcieri <tony@...>

Would it make sense to have a flag passed to the interpreter on startup that

16 messages 2009/10/05

[#26028] [Bug #2189] Math.atanh(1) & Math.atanh(-1) should not raise an error — Marc-Andre Lafortune <redmine@...>

Bug #2189: Math.atanh(1) & Math.atanh(-1) should not raise an error

14 messages 2009/10/10

[#26222] [Bug #2250] IO::for_fd() objects' finalization dangerously closes underlying fds — Mike Pomraning <redmine@...>

Bug #2250: IO::for_fd() objects' finalization dangerously closes underlying fds

11 messages 2009/10/22

[#26244] [Bug #2258] Kernel#require inside rb_require() inside rb_protect() inside SysV context fails — Suraj Kurapati <redmine@...>

Bug #2258: Kernel#require inside rb_require() inside rb_protect() inside SysV context fails

24 messages 2009/10/22

[#26361] [Feature #2294] [PATCH] ruby_bind_stack() to embed Ruby in coroutine — Suraj Kurapati <redmine@...>

Feature #2294: [PATCH] ruby_bind_stack() to embed Ruby in coroutine

42 messages 2009/10/27

[#26371] [Bug #2295] segmentation faults — tomer doron <redmine@...>

Bug #2295: segmentation faults

16 messages 2009/10/27

[ruby-core:26155] RTypedData type unavailable to gdb?

From: Joshua ben Jore <twists@...>
Date: 2009-10-18 23:41:05 UTC
List: ruby-core #26155
Hi,
I'm trying to write some gdb script kind of like "ps" but against
1.9's threads and callstacks. Right now, I'm stymied because gdb
doesn't get the definition for the RTypedData struct from
include/ruby/ruby.h. At the shortest. My ruby is built with -g so this
ought to be no problem.

  (gdb) p (RTypedData)0
  No symbol "RTypedData" in current context.

My current script creates a top level function rb_ps which walks down
from ruby_current_vm down through the living_threads hash and attempts
to get the rb_thread_t pointers from the RTypedData objects. No such
luck. Can someone lend some advice to how to proceed here? My OS X
manual says `nm -a' shows all the symbols but I don't see anything
that looks like any data type names in there.

  define rb_ps
    rb_ps_vm ruby_current_vm
  end
  document rb_ps
  Dump all threads and their callstacks
  end

  define rb_ps_vm
    print $ps_vm = (rb_vm_t*)$arg0
    print $ps_threads = (st_table*)$ps_vm->living_threads
    if $ps_threads->entries_packed
      print $ps_threads_i = 0
      while $ps_threads_i < $ps_threads->num_entries
        print $ps_threads_key = (st_data_t*)$ps_threads->bins[
$ps_threads_i * 2     ]
        print $ps_threads_val = (st_data_t*)$ps_threads->bins[
$ps_threads_i * 2 + 1 ]
        rb_ps_thread $ps_threads_key, $ps_threads_val
        print $ps_threads_i = 1 + $ps_threads_i
      end
    else
      print $ps_threads_ptr = (st_table_entry*)$ps_threads->head
      while $ps_threads_ptr
        print $ps_threads_key = (st_data_t*)$ps_threads_ptr->key
        print $ps_threads_val = (st_data_t*)$ps_threads_ptr->val
        rb_ps_thread $ps_threads_key, $ps_threads_val
        print $ps_threads_ptr = (st_table_entry*)$ps_threads_ptr->fore
      end
    end
  end
  document rb_ps_vm
  Dump all threads in a (rb_vm_t*) and their callstacks
  end

  define rb_ps_thread
    print $ps_thread = (RTypedData*)$arg0
    print $ps_thread_id = $arg1
    print $ps_thread_th = (rb_thread_t*)$ps_thread->data
    print *$ps_thread_th
  end

Josh

In This Thread

Prev Next