summaryrefslogtreecommitdiff
path: root/.gdbinit
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-19 06:17:31 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-19 06:17:31 (GMT)
commit80eda69d26f901abc39ba6ef617315d50ae96e3d (patch)
treef7a1c8f6f3e16d00868f8773101fdbf083dad2ca /.gdbinit
parent55cc90b7e260d6fc5af71c07db48b676753ff195 (diff)
* .gdbinit (rb_method_entry): search method entry by class and id.
git-svn-id: svn+ssh://ci.ruby-lang.org/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 f486d36..ab3962f 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