Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions commands/FBPrintCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def lldbcommands():
FBPrintOnscreenTableViewCells(),
FBPrintInternals(),
FBPrintInstanceVariable(),
FBPrintKeyPath(),
]

class FBPrintViewHierarchyCommand(fb.FBCommand):
Expand Down Expand Up @@ -272,3 +273,25 @@ def run(self, arguments, options):

printCommand = 'po' if ('@' in ivarTypeEncodingFirstChar) else 'p'
lldb.debugger.HandleCommand('{} (({} *)({}))->{}'.format(printCommand, objectClass, object, ivarName))

class FBPrintKeyPath(fb.FBCommand):
def name(self):
return 'pkp'

def description(self):
return "Print out the value of the key path expression using -valueForKeyPath:"

def args(self):
return [
fb.FBCommandArgument(arg='keypath', type='NSString *', help='The keypath to print'),
]

def run(self, arguments, options):
command = arguments[0]
if len(command.split('.')) == 1:
lldb.debugger.HandleCommand("po " + command)
else:
objectToMessage, keypath = command.split('.', 1)
object = fb.evaluateObjectExpression(objectToMessage)
printCommand = 'po [{} valueForKeyPath:@"{}"]'.format(object, keypath)
lldb.debugger.HandleCommand(printCommand)