summaryrefslogtreecommitdiff
path: root/misc/gdb.py
diff options
context:
space:
mode:
-rw-r--r--misc/gdb.py34
1 files changed, 26 insertions, 8 deletions
@@ -1,8 +1,17 @@
import textwrap
-# Usage:
-# cfp: Dump the current cfp
-# cfp 1: Dump the caller cfp
class CFP(gdb.Command):
FRAME_MAGICS = [
# frame types
@@ -35,10 +44,16 @@ class CFP(gdb.Command):
def __init__(self):
super(CFP, self).__init__('cfp', gdb.COMMAND_USER)
- def invoke(self, offset, from_tty):
- if not offset:
- offset = '0'
- cfp = f'(ruby_current_ec->cfp + ({offset}))'
end_cfp = self.get_int('ruby_current_ec->vm_stack + ruby_current_ec->vm_stack_size')
cfp_count = int((end_cfp - self.get_int('ruby_current_ec->cfp')) / self.get_int('sizeof(rb_control_frame_t)'))
@@ -65,7 +80,10 @@ class CFP(gdb.Command):
self.print_stack(cfp, -1, self.frame_types(cfp, -1))
print()
- stack_size = int((self.get_int(f'{cfp}->sp') - self.get_int(f'vm_base_ptr({cfp})')) / 8)
print(f'Stack (size={stack_size}):')
for i in range(0, stack_size):
self.print_stack(cfp, i, self.rp(cfp, i))