summaryrefslogtreecommitdiffstats
path: root/.gdbinit
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-19 06:17:31 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-19 06:17:31 +0000
commit56ab5a31f8631feec0971135ad43725c2ff57c38 (patch)
treef7a1c8f6f3e16d00868f8773101fdbf083dad2ca /.gdbinit
parent1b220be4976daa55d63cbf20dd745f9057d903ef (diff)
downloadruby-56ab5a31f8631feec0971135ad43725c2ff57c38.tar.gz
ruby-56ab5a31f8631feec0971135ad43725c2ff57c38.tar.xz
ruby-56ab5a31f8631feec0971135ad43725c2ff57c38.zip
* .gdbinit (rb_method_entry): search method entry by class and id.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to '.gdbinit')
-rw-r--r--.gdbinit62
1 files changed, 61 insertions, 1 deletions
diff --git a/.gdbinit b/.gdbinit
index f486d36de..ab3962fe0 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -614,8 +614,68 @@ define rb_p
call rb_p($arg0)
end
+define rb_numtable_entry
+ set $rb_numtable_tbl = $arg0
+ set $rb_numtable_id = (st_data_t)$arg1
+ set $rb_numtable_key = 0
+ set $rb_numtable_rec = 0
+ if $rb_numtable_tbl->entries_packed
+ set $rb_numtable_p = $rb_numtable_tbl->bins
+ while $rb_numtable_p && $rb_numtable_p < $rb_numtable_tbl->bins+$rb_numtable_tbl->num_entries
+ if (st_data_t)$rb_numtable_p[0] == $rb_numtable_id
+ set $rb_numtable_key = (st_data_t)$rb_numtable_p[0]
+ set $rb_numtable_rec = (st_data_t)$rb_numtable_p[1]
+ set $rb_numtable_p = 0
+ else
+ set $rb_numtable_p = $rb_numtable_p + 2
+ end
+ end
+ else
+ set $rb_numtable_p = $rb_numtable_tbl->bins[$rb_numtable_id % $rb_numtable_tbl->num_bins]
+ while $rb_numtable_p
+ if $rb_numtable_p->key == $rb_numtable_id
+ set $rb_numtable_key = $rb_numtable_p->key
+ set $rb_numtable_rec = $rb_numtable_p->record
+ set $rb_numtable_p = 0
+ else
+ set $rb_numtable_p = $rb_numtable_p->next
+ end
+ end
+ end
+end
+
define rb_id2name
- call rb_id2name($arg0)
+ rb_numtable_entry global_symbols.id_str (ID)$arg0
+ if $rb_numtable_rec
+ rp $rb_numtable_rec
+ else
+ echo undef\n
+ end
+end
+document rb_id2name
+ Print the name of id
+end
+
+define rb_method_entry
+ set $rb_method_entry_klass = (struct RClass *)$arg0
+ set $rb_method_entry_id = (ID)$arg1
+ set $rb_method_entry_me = (rb_method_entry_t *)0
+ while !$rb_method_entry_me && $rb_method_entry_klass
+ rb_numtable_entry $rb_method_entry_klass->m_tbl $rb_method_entry_id
+ set $rb_method_entry_me = (rb_method_entry_t *)$rb_numtable_rec
+ if !$rb_method_entry_me
+ set $rb_method_entry_klass = (struct RClass *)$rb_method_entry_klass->ptr->super
+ end
+ end
+ if $rb_method_entry_me
+ print *$rb_method_entry_klass
+ print *$rb_method_entry_me
+ else
+ echo method not found\n
+ end
+end
+document rb_method_entry
+ Search method entry by class and id
end
define rb_classname