mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
lldb: dump_page_rvalue - dump a heap page containing an RVALUE
rather than having to do this in a two step process: 1. heap_page obj 2. dump_page $2 (or whatever lldb variable heap_page set) we can now just dump_page_rvalue obj
This commit is contained in:
parent
c752a35816
commit
f64bb9fc84
Notes:
git
2021-04-27 23:59:15 +09:00
1 changed files with 30 additions and 10 deletions
|
@ -552,19 +552,10 @@ class HeapPageIter:
|
|||
raise StopIteration
|
||||
|
||||
|
||||
def dump_page(debugger, command, result, internal_dict):
|
||||
def dump_page_internal(page, target, process, thread, frame, result, debugger):
|
||||
if not ('RUBY_Qfalse' in globals()):
|
||||
lldb_init(debugger)
|
||||
|
||||
target = debugger.GetSelectedTarget()
|
||||
process = target.GetProcess()
|
||||
thread = process.GetSelectedThread()
|
||||
frame = thread.GetSelectedFrame()
|
||||
|
||||
tHeapPageP = target.FindFirstType("struct heap_page").GetPointerType()
|
||||
page = frame.EvaluateExpression(command)
|
||||
page = page.Cast(tHeapPageP)
|
||||
|
||||
ruby_type_map = ruby_types(debugger)
|
||||
|
||||
freelist = []
|
||||
|
@ -593,6 +584,34 @@ def dump_page(debugger, command, result, internal_dict):
|
|||
print(result_str, file=result)
|
||||
|
||||
|
||||
def dump_page(debugger, command, result, internal_dict):
|
||||
target = debugger.GetSelectedTarget()
|
||||
process = target.GetProcess()
|
||||
thread = process.GetSelectedThread()
|
||||
frame = thread.GetSelectedFrame()
|
||||
|
||||
tHeapPageP = target.FindFirstType("struct heap_page").GetPointerType()
|
||||
page = frame.EvaluateExpression(command)
|
||||
page = page.Cast(tHeapPageP)
|
||||
|
||||
dump_page_internal(page, target, process, thread, frame, result, debugger)
|
||||
|
||||
|
||||
def dump_page_rvalue(debugger, command, result, internal_dict):
|
||||
target = debugger.GetSelectedTarget()
|
||||
process = target.GetProcess()
|
||||
thread = process.GetSelectedThread()
|
||||
frame = thread.GetSelectedFrame()
|
||||
|
||||
val = frame.EvaluateExpression(command)
|
||||
page = get_page(lldb, target, val)
|
||||
page_type = target.FindFirstType("struct heap_page").GetPointerType()
|
||||
page.Cast(page_type)
|
||||
|
||||
dump_page_internal(page, target, process, thread, frame, result, debugger)
|
||||
|
||||
|
||||
|
||||
def rb_type(flags, ruby_types):
|
||||
flType = flags & RUBY_T_MASK
|
||||
return "%-10s" % (ruby_types.get(flType, ("%0#x" % flType)))
|
||||
|
@ -623,6 +642,7 @@ def __lldb_init_module(debugger, internal_dict):
|
|||
debugger.HandleCommand("command script add -f lldb_cruby.heap_page_body heap_page_body")
|
||||
debugger.HandleCommand("command script add -f lldb_cruby.rb_backtrace rbbt")
|
||||
debugger.HandleCommand("command script add -f lldb_cruby.dump_page dump_page")
|
||||
debugger.HandleCommand("command script add -f lldb_cruby.dump_page_rvalue dump_page_rvalue")
|
||||
|
||||
lldb_init(debugger)
|
||||
print("lldb scripts for ruby has been installed.")
|
||||
|
|
Loading…
Reference in a new issue