Skip to content

Instantly share code, notes, and snippets.

@SpringMT
Last active December 4, 2016 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SpringMT/dfc443f97804f61d1804d3c4a1f56625 to your computer and use it in GitHub Desktop.
Save SpringMT/dfc443f97804f61d1804d3c4a1f56625 to your computer and use it in GitHub Desktop.
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