Skip to content

Commit

Permalink
Merge pull request #172 from dmpv/ivarDescription_support
Browse files Browse the repository at this point in the history
[pinternals] -a option added
kastiglione authored Nov 25, 2016
2 parents 2715d65 + cf36274 commit bbfac3e
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions commands/FBPrintCommands.py
Original file line number Diff line number Diff line change
@@ -259,12 +259,23 @@ def description(self):

def args(self):
return [ fb.FBCommandArgument(arg='object', type='id', help='Object expression to be evaluated.') ]

def options(self):
return [
fb.FBCommandArgument(arg='appleWay', short='-a', long='--apple', boolean=True, default=False, help='Print ivars the apple way')
]

def run(self, arguments, options):
object = fb.evaluateObjectExpression(arguments[0])
objectClass = fb.evaluateExpressionValue('(id)[(id)(' + object + ') class]').GetObjectDescription()

command = 'p *(({} *)((id){}))'.format(objectClass, object)
if options.appleWay:
if fb.evaluateBooleanExpression('[{} respondsToSelector:@selector(_ivarDescription)]'.format(object)):
command = 'po [{} _ivarDescription]'.format(object)
else:
print 'Sorry, but it seems Apple dumped the _ivarDescription method'
return
else:
objectClass = fb.evaluateExpressionValue('(id)[(id)(' + object + ') class]').GetObjectDescription()
command = 'p *(({} *)((id){}))'.format(objectClass, object)
lldb.debugger.HandleCommand(command)


0 comments on commit bbfac3e

Please sign in to comment.