Last active
December 4, 2016 16:14
-
-
Save SpringMT/dfc443f97804f61d1804d3c4a1f56625 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set print pretty on | |
set pagination off | |
define ruby_thread | |
set $ruby_thread = ruby_current_vm->running_thread | |
printf "running_thread set $ruby_thread \n" | |
end | |
define vm_cfp_cnt | |
printf "cfp_cnt %d \n", ((rb_control_frame_t *)(($arg0)->stack + ($arg0)->stack_size) - (rb_control_frame_t *)($arg1)) | |
end | |
document vm_cfp_cnt | |
cfp_cnt ruby_thread and cfp(from https://github.com/ruby/ruby/blob/202bbda2bf5f25343e286099140fb9282880ecba/vm_dump.c#L24) | |
end | |
define vm_frame_type | |
printf "vm_frame_type %x ", (((rb_control_frame_t *)($arg0))->flag & ~(~(VALUE)0<<8)) | |
set $cfp_flag = (((rb_control_frame_t *)($arg0))->flag & ~(~(VALUE)0<<8)) | |
if $cfp_flag == 0x41 | |
printf " %s \n", "TOP" | |
else | |
if $cfp_flag == 0x11 | |
printf " %s \n", "METHOD" | |
else | |
if $cfp_flag == 0x31 | |
printf " %s \n", "CLASS" | |
else | |
if $cfp_flag == 0x21 | |
printf " %s \n", "BLOCK" | |
else | |
if $cfp_flag == 0x61 | |
printf " %s \n", "CFUNC" | |
else | |
if $cfp_flag == 0x71 | |
printf " %s \n", "PROC" | |
else | |
if $cfp_flag == 0xa1 | |
printf " %s \n", "LAMBDA" | |
else | |
if $cfp_flag == 0x81 | |
printf " %s \n", "IFUNC" | |
else | |
if $cfp_flag == 0x91 | |
printf " %s \n", "EVAL" | |
else | |
if $cfp_flag == 0xb1 | |
printf " %s \n", "RESCUE" | |
else | |
if $cfp_flag == 0 | |
printf " %s \n", "------" | |
else | |
printf " %s \n", "(none)" | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
end | |
document vm_frame_type | |
vm_frame_type cfp (from https://github.com/ruby/ruby/blob/202bbda2bf5f25343e286099140fb9282880ecba/vm_dump.c#L46) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment