Verified Commit fa3d3b1f authored by Tim Gymnich's avatar Tim Gymnich
Browse files

Added ValueFormatter for llvm::Value

parent 1245b96a
command regex dump 's/(.+)/expression -O -l c++ -- ((llvm::Value*) %1 )->dump()/'
command alias d dump
\ No newline at end of file
command alias d dump
command script import ${CMAKE_SOURCE_DIR}/lldb/
\ No newline at end of file
......@@ -254,3 +254,5 @@ foreach(src ${SAMPLES})
configure_file( .lldbinit)
\ No newline at end of file
import lldb
def ValueFormatter(valobj, internal_dict):
frame = lldb.debugger.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
options = lldb.SBExpressionOptions()
options.SetTimeoutInMicroSeconds(5000000) # 5s
addr = valobj.GetValue()
expr = frame.EvaluateExpression('((llvm::Value*) {0})->getName().data()'.format(addr), options)
name = expr.GetSummary()
return '{0}'.format(name)
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand("type summary add -F " + __name__ + ".ValueFormatter llvm::Value")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment