File: rclass_ext_command.py

package info (click to toggle)
ruby3.3 3.3.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 153,620 kB
  • sloc: ruby: 1,244,308; ansic: 836,474; yacc: 28,074; pascal: 6,748; sh: 3,913; python: 1,719; cpp: 1,158; makefile: 742; asm: 712; javascript: 394; lisp: 97; perl: 62; awk: 36; sed: 23; xml: 4
file content (14 lines) | stat: -rw-r--r-- 699 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from lldb_rb.rb_base_command import RbBaseCommand

class RclassExtCommand(RbBaseCommand):
    program = "rclass_ext"
    help_string = "retrieves and prints the rb_classext_struct for the VALUE pointer passed in"

    def call(self, debugger, command, exe_ctx, result):
        uintptr_t = self.target.FindFirstType("uintptr_t")
        rclass_t = self.target.FindFirstType("struct RClass")
        rclass_ext_t = self.target.FindFirstType("rb_classext_t")

        rclass_addr = self.target.EvaluateExpression(command).Cast(uintptr_t)
        rclass_ext_addr = (rclass_addr.GetValueAsUnsigned() + rclass_t.GetByteSize())
        debugger.HandleCommand("p *(rb_classext_t *)%0#x" % rclass_ext_addr)