Exemplo n.º 1
0
 def setCurrentView(self, view, oldView=None):
     if view:
         self.currentView = view
         if oldView:
             viewHelpers.unmaskView(oldView)
         viewHelpers.maskView(self.currentView, 'red', '0.4')
         print fb.describeObject(view)
Exemplo n.º 2
0
 def setCurrentView(self, view, oldView=None):
   if view:
     self.currentView = view
     if oldView:
       viewHelpers.unmaskView(oldView)
     viewHelpers.maskView(self.currentView, 'red', '0.4')
     print fb.describeObject(view)
Exemplo n.º 3
0
 def taplog_callback(frame, bp_loc, internal_dict):
     parameterExpr = objc.functionPreambleExpressionForObjectParameterAtIndex(
         0)
     print fb.describeObject('[[[%s allTouches] anyObject] view]' %
                             (parameterExpr))
     # We don't want to proceed event (click on button for example), so we just skip it
     lldb.debugger.HandleCommand('thread return')
Exemplo n.º 4
0
def _visualize(target):
    target = fb.evaluateInputExpression(target)

    if fb.evaluateBooleanExpression('(unsigned long)CFGetTypeID((CFTypeRef)' +
                                    target +
                                    ') == (unsigned long)CGImageGetTypeID()'):
        _showImage('(id)[UIImage imageWithCGImage:' + target + ']')
    else:
        if objectHelpers.isKindOfClass(target, 'UIImage'):
            _showImage(target)
        elif objectHelpers.isKindOfClass(target, 'UIView'):
            _showLayer('[(id)' + target + ' layer]')
        elif objectHelpers.isKindOfClass(target, 'CALayer'):
            _showLayer(target)
        elif objectHelpers.isKindOfClass(
                target, 'UIColor') or objectHelpers.isKindOfClass(
                    target, 'CIColor') or _colorIsCGColorRef(target):
            _showColor(target)
        elif objectHelpers.isKindOfClass(target, 'NSData'):
            if _dataIsImage(target):
                _showImage('(id)[UIImage imageWithData:' + target + ']')
            elif _dataIsString(target):
                print fb.describeObject('[[NSString alloc] initWithData:' +
                                        target + ' encoding:4]')
            else:
                print 'Data isn\'t an image and isn\'t a string.'
        else:
            print '{} isn\'t supported. You can visualize UIImage, CGImageRef, UIView, CALayer, NSData, UIColor, CIColor, or CGColorRef.'.format(
                objectHelpers.className(target))
Exemplo n.º 5
0
 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)
     print fb.describeObject('[{} valueForKeyPath:@"{}"]'.format(object, keypath))
Exemplo n.º 6
0
 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)
     print fb.describeObject('[{} valueForKeyPath:@"{}"]'.format(object, keypath))
Exemplo n.º 7
0
    def run(self, arguments, options):
        upwards = 'YES' if options.upwards else 'NO'
        showViews = 'YES' if options.showViews == 'YES' else 'NO'

        view = fb.evaluateInputExpression(arguments[0])
        print fb.describeObject(
            '[CKComponentHierarchyDebugHelper componentHierarchyDescriptionForView:(UIView *)'
            + view + ' searchUpwards:' + upwards + ' showViews:' + showViews +
            ']')
Exemplo n.º 8
0
  def run(self, arguments, options):
    upwards = 'YES' if options.upwards else 'NO'
    showViews = 'YES' if options.showViews == 'YES' else 'NO'

    view = fb.evaluateInputExpression(arguments[0])
    if not viewHelpers.isView(view):
        # assume it's a CKComponent
        view = fb.evaluateExpression('((CKComponent *)%s).viewContext.view' % view)

    print fb.describeObject('[CKComponentHierarchyDebugHelper componentHierarchyDescriptionForView:(UIView *)' + view + ' searchUpwards:' + upwards + ' showViews:' + showViews + ']')
Exemplo n.º 9
0
  def run(self, arguments, options):
    isMac = runtimeHelpers.isMacintoshArch()

    if arguments[0] == '__keyWindow_rootVC_dynamic__':
      if fb.evaluateBooleanExpression('[UIViewController respondsToSelector:@selector(_printHierarchy)]'):
        print fb.describeObject('[UIViewController _printHierarchy]')
        return

      arguments[0] = '(id)[(id)[[UIApplication sharedApplication] keyWindow] rootViewController]'
      if isMac:
        arguments[0] = '(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:0] contentViewController]'

    print vcHelpers.viewControllerRecursiveDescription(arguments[0])
Exemplo n.º 10
0
  def run(self, arguments, options):
    isMac = runtimeHelpers.isMacintoshArch()

    if arguments[0] == '__keyWindow_rootVC_dynamic__':
      if fb.evaluateBooleanExpression('[UIViewController respondsToSelector:@selector(_printHierarchy)]'):
        print fb.describeObject('[UIViewController _printHierarchy]')
        return

      arguments[0] = '(id)[(id)[[UIApplication sharedApplication] keyWindow] rootViewController]'
      if isMac:
        arguments[0] = '(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:0] contentViewController]'

    print vcHelpers.viewControllerRecursiveDescription(arguments[0])
Exemplo n.º 11
0
 def setCurrentView(self, view, oldView=None):
     if view:
         self.currentView = view
         if oldView:
             viewHelpers.unmaskView(oldView)
         viewHelpers.maskView(self.currentView, "red", "0.4")
         print(fb.describeObject(view))
Exemplo n.º 12
0
 def run(self, arguments, options):
     view = fb.evaluateInputExpression(arguments[0])
     opt = fb.evaluateBooleanExpression(
         '[UIView instancesRespondToSelector:@selector(_autolayoutTraceRecursively:)]'
     )
     traceCall = '_autolayoutTraceRecursively:1' if opt else '_autolayoutTrace'
     print(fb.describeObject('[{} {}]'.format(view, traceCall)))
Exemplo n.º 13
0
def _visualize(target):
    target = fb.evaluateInputExpression(target)

    if fb.evaluateBooleanExpression("(unsigned long)CFGetTypeID((CFTypeRef)" +
                                    target +
                                    ") == (unsigned long)CGImageGetTypeID()"):
        _showImage("(id)[UIImage imageWithCGImage:" + target + "]")
    else:
        if objectHelpers.isKindOfClass(target, "UIImage"):
            _showImage(target)
        elif objectHelpers.isKindOfClass(target, "UIView"):
            _showLayer("[(id)" + target + " layer]")
        elif objectHelpers.isKindOfClass(target, "CALayer"):
            _showLayer(target)
        elif (objectHelpers.isKindOfClass(target, "UIColor")
              or objectHelpers.isKindOfClass(target, "CIColor")
              or _colorIsCGColorRef(target)):
            _showColor(target)
        elif objectHelpers.isKindOfClass(target, "NSData"):
            if _dataIsImage(target):
                _showImage("(id)[UIImage imageWithData:" + target + "]")
            elif _dataIsString(target):
                print(
                    fb.describeObject("[[NSString alloc] initWithData:" +
                                      target + " encoding:4]"))
            else:
                print("Data isn't an image and isn't a string.")
        else:
            print(
                "{} isn't supported. You can visualize UIImage, CGImageRef, UIView, CALayer, NSData, UIColor, CIColor, or CGColorRef."
                .format(  # noqa B950
                    objectHelpers.className(target)))
Exemplo n.º 14
0
 def run(self, arguments, options):
     view = fb.evaluateInputExpression(arguments[0])
     opt = fb.evaluateBooleanExpression(
         "[UIView instancesRespondToSelector:@selector(_autolayoutTraceRecursively:)]"  # noqa B950
     )
     traceCall = "_autolayoutTraceRecursively:1" if opt else "_autolayoutTrace"
     print(fb.describeObject("[{} {}]".format(view, traceCall)))
Exemplo n.º 15
0
 def taplog_callback(frame, bp_loc, internal_dict):
     parameterExpr = objc.functionPreambleExpressionForObjectParameterAtIndex(0)
     print(
         "Gesture Recognizers:\n{}".format(
             fb.describeObject(
                 "[[[%s allTouches] anyObject] gestureRecognizers]" % (parameterExpr)
             )
         )
     )
     print(
         "View:\n{}".format(
             fb.describeObject(
                 "[[[%s allTouches] anyObject] view]" % (parameterExpr)
             )
         )
     )
     # We don't want to proceed event (click on button for example), so we just skip it
     lldb.debugger.HandleCommand("thread return")
Exemplo n.º 16
0
    def inputCallback(self, input):
        oldView = self.currentView

        if input == 'q':
            cmd = 'echo %s | tr -d "\n" | pbcopy' % oldView
            os.system(cmd)

            print '\nI hope ' + oldView + ' was what you were looking for. I put it on your clipboard.'
            viewHelpers.unmaskView(oldView)
            self.keepRunning = False

        elif input == 'w':
            v = superviewOfView(self.currentView)
            if not v:
                print 'There is no superview. Where are you trying to go?!'
            self.setCurrentView(v, oldView)
        elif input == 's':
            v = firstSubviewOfView(self.currentView)
            if not v:
                print '\nThe view has no subviews.\n'
            self.setCurrentView(v, oldView)
        elif input == 'd':
            v = nthSiblingOfView(self.currentView, -1)
            if v == oldView:
                print '\nThere are no sibling views to this view.\n'
            self.setCurrentView(v, oldView)
        elif input == 'a':
            v = nthSiblingOfView(self.currentView, 1)
            if v == oldView:
                print '\nThere are no sibling views to this view.\n'
            self.setCurrentView(v, oldView)
        elif input == 'p':
            recursionName = 'recursiveDescription'
            isMac = runtimeHelpers.isMacintoshArch()

            if isMac:
                recursionName = '_subtreeDescription'

            print fb.describeObject('[(id){} {}]'.format(
                oldView, recursionName))
        else:
            print '\nI really have no idea what you meant by \'' + input + '\'... =\\\n'
Exemplo n.º 17
0
  def inputCallback(self, input):
    oldView = self.currentView

    if input == 'q':
      cmd = 'echo %s | tr -d "\n" | pbcopy' % oldView
      os.system(cmd)

      print '\nI hope ' + oldView + ' was what you were looking for. I put it on your clipboard.'
      viewHelpers.unmaskView(oldView)
      self.keepRunning = False

    elif input == 'w':
      v = superviewOfView(self.currentView)
      if not v:
        print 'There is no superview. Where are you trying to go?!'
      self.setCurrentView(v, oldView)
    elif input == 's':
      v = firstSubviewOfView(self.currentView)
      if not v:
        print '\nThe view has no subviews.\n'
      self.setCurrentView(v, oldView)
    elif input == 'd':
      v = nthSiblingOfView(self.currentView, -1)
      if v == oldView:
        print '\nThere are no sibling views to this view.\n'
      self.setCurrentView(v, oldView)
    elif input == 'a':
      v = nthSiblingOfView(self.currentView, 1)
      if v == oldView:
        print '\nThere are no sibling views to this view.\n'
      self.setCurrentView(v, oldView)
    elif input == 'p':
      recursionName = 'recursiveDescription'
      isMac = runtimeHelpers.isMacintoshArch()

      if isMac:
        recursionName = '_subtreeDescription'

      print fb.describeObject('[(id){} {}]'.format(oldView, recursionName))
    else:
      print '\nI really have no idea what you meant by \'' + input + '\'... =\\\n'
Exemplo n.º 18
0
    def run(self, arguments, option):
        # Normalize encoding.
        encoding_text = option.encoding.lower().replace(' -', '')
        enc = 4  # Default encoding UTF-8.
        if encoding_text == 'ascii':
            enc = 1
        elif encoding_text == 'utf8':
            enc = 4
        elif encoding_text == 'latin1' or encoding_text == '88591' or encoding_text == 'iso88591':
            enc = 5
        elif encoding_text == 'latin2' or encoding_text == '88592' or encoding_text == 'iso88592':
            enc = 9
        elif encoding_text == 'unicode' or encoding_text == 'utf16':
            enc = 10
        elif encoding_text == '1251' or encoding_text == 'cp1251':
            enc = 11
        elif encoding_text == '1252' or encoding_text == 'cp1252':
            enc = 12
        elif encoding_text == '1253' or encoding_text == 'cp1253':
            enc = 13
        elif encoding_text == '1254' or encoding_text == 'cp1254':
            enc = 14
        elif encoding_text == '1250' or encoding_text == 'cp1250':
            enc = 15
        elif encoding_text == 'utf16b':
            enc = 0x90000100
        elif encoding_text == 'utf16l':
            enc = 0x94000100
        elif encoding_text == 'utf32':
            enc = 0x8c000100
        elif encoding_text == 'utf32b':
            enc = 0x98000100
        elif encoding_text == 'utf32l':
            enc = 0x9c000100

        print fb.describeObject(
            '[[NSString alloc] initWithData:{} encoding:{}]'.format(
                arguments[0], enc))
Exemplo n.º 19
0
def _visualize(target):
  target = '(' + target + ')'

  if fb.evaluateBooleanExpression('(unsigned long)CFGetTypeID((CFTypeRef)' + target + ') == (unsigned long)CGImageGetTypeID()'):
    _showImage('(id)[UIImage imageWithCGImage:' + target + ']')
  else:
    if objectHelpers.isKindOfClass(target, 'UIImage'):
      _showImage(target)
    elif objectHelpers.isKindOfClass(target, 'UIView'):
      _showLayer('[(id)' + target + ' layer]')
    elif objectHelpers.isKindOfClass(target, 'CALayer'):
      _showLayer(target)
    elif objectHelpers.isKindOfClass(target, 'UIColor') or objectHelpers.isKindOfClass(target, 'CIColor') or _colorIsCGColorRef(target):
      _showColor(target)
    elif objectHelpers.isKindOfClass(target, 'NSData'):
      if _dataIsImage(target):
        _showImage('(id)[UIImage imageWithData:' + target + ']')
      elif _dataIsString(target):
        print fb.describeObject('[[NSString alloc] initWithData:' + target + ' encoding:4]')
      else:
        print 'Data isn\'t an image and isn\'t a string.'
    else:
      print '{} isn\'t supported. You can visualize UIImage, CGImageRef, UIView, CALayer, NSData, UIColor, CIColor, or CGColorRef.'.format(objectHelpers.className(target))
Exemplo n.º 20
0
    def run(self, arguments, option):   # noqa C901
        # Normalize encoding.
        encoding_text = option.encoding.lower().replace(" -", "")
        enc = 4  # Default encoding UTF-8.
        if encoding_text == "ascii":
            enc = 1
        elif encoding_text == "utf8":
            enc = 4
        elif (
            encoding_text == "latin1"
            or encoding_text == "88591"
            or encoding_text == "iso88591"
        ):
            enc = 5
        elif (
            encoding_text == "latin2"
            or encoding_text == "88592"
            or encoding_text == "iso88592"
        ):
            enc = 9
        elif encoding_text == "unicode" or encoding_text == "utf16":
            enc = 10
        elif encoding_text == "1251" or encoding_text == "cp1251":
            enc = 11
        elif encoding_text == "1252" or encoding_text == "cp1252":
            enc = 12
        elif encoding_text == "1253" or encoding_text == "cp1253":
            enc = 13
        elif encoding_text == "1254" or encoding_text == "cp1254":
            enc = 14
        elif encoding_text == "1250" or encoding_text == "cp1250":
            enc = 15
        elif encoding_text == "utf16b":
            enc = 0x90000100
        elif encoding_text == "utf16l":
            enc = 0x94000100
        elif encoding_text == "utf32":
            enc = 0x8C000100
        elif encoding_text == "utf32b":
            enc = 0x98000100
        elif encoding_text == "utf32l":
            enc = 0x9C000100

        print(
            fb.describeObject(
                "[[NSString alloc] initWithData:{} encoding:{}]".format(
                    arguments[0], enc
                )
            )
        )
Exemplo n.º 21
0
  def run(self, arguments, option):
    # Normalize encoding.
    encoding_text = option.encoding.lower().replace(' -', '')
    enc = 4  # Default encoding UTF-8.
    if encoding_text == 'ascii':
      enc = 1
    elif encoding_text == 'utf8':
      enc = 4
    elif encoding_text == 'latin1' or encoding_text == '88591' or encoding_text == 'iso88591':
      enc = 5
    elif encoding_text == 'latin2' or encoding_text == '88592' or encoding_text == 'iso88592':
      enc = 9
    elif encoding_text == 'unicode' or encoding_text == 'utf16':
      enc = 10
    elif encoding_text == '1251' or encoding_text == 'cp1251':
      enc = 11
    elif encoding_text == '1252' or encoding_text == 'cp1252':
      enc = 12
    elif encoding_text == '1253' or encoding_text == 'cp1253':
      enc = 13
    elif encoding_text == '1254' or encoding_text == 'cp1254':
      enc = 14
    elif encoding_text == '1250' or encoding_text == 'cp1250':
      enc = 15
    elif encoding_text == 'utf16b':
      enc = 0x90000100
    elif encoding_text == 'utf16l':
      enc = 0x94000100
    elif encoding_text == 'utf32':
      enc = 0x8c000100
    elif encoding_text == 'utf32b':
      enc = 0x98000100
    elif encoding_text == 'utf32l':
      enc = 0x9c000100

    print fb.describeObject('[[NSString alloc] initWithData:{} encoding:{}]'.format(arguments[0], enc))
Exemplo n.º 22
0
    def inputCallback(self, input):
        oldView = self.currentView

        if input == "q":
            cmd = 'echo %s | tr -d "\n" | pbcopy' % oldView
            os.system(cmd)

            print(
                "\nI hope " + oldView +
                " was what you were looking for. I put it on your clipboard.")
            viewHelpers.unmaskView(oldView)
            self.keepRunning = False

        elif input == "w":
            v = superviewOfView(self.currentView)
            if not v:
                print("There is no superview. Where are you trying to go?!")
            self.setCurrentView(v, oldView)
        elif input == "s":
            v = firstSubviewOfView(self.currentView)
            if not v:
                print("\nThe view has no subviews.\n")
            self.setCurrentView(v, oldView)
        elif input == "d":
            v = nthSiblingOfView(self.currentView, -1)
            if v == oldView:
                print("\nThere are no sibling views to this view.\n")
            self.setCurrentView(v, oldView)
        elif input == "a":
            v = nthSiblingOfView(self.currentView, 1)
            if v == oldView:
                print("\nThere are no sibling views to this view.\n")
            self.setCurrentView(v, oldView)
        elif input == "p":
            recursionName = "recursiveDescription"
            isMac = runtimeHelpers.isMacintoshArch()

            if isMac:
                recursionName = "_subtreeDescription"

            print(
                fb.describeObject("[(id){} {}]".format(oldView,
                                                       recursionName)))
        else:
            print("\nI really have no idea what you meant by '" + input +
                  "'... =\\\n")
Exemplo n.º 23
0
    def run(self, arguments, options):
        upwards = "YES" if options.upwards else "NO"
        showViews = "YES" if options.showViews == "YES" else "NO"

        view = fb.evaluateInputExpression(arguments[0])
        if not viewHelpers.isView(view):
            # assume it's a CKComponent
            view = fb.evaluateExpression("((CKComponent *)%s).viewContext.view" % view)

        print(
            fb.describeObject(
                "[CKComponentHierarchyDebugHelper componentHierarchyDescriptionForView:(UIView *)"  # noqa B950
                + view
                + " searchUpwards:"
                + upwards
                + " showViews:"
                + showViews
                + "]"
            )
        )
Exemplo n.º 24
0
 def run(self, arguments, options):
   print fb.describeObject('[NSString stringWithCString:(char *)CARenderServerGetInfo(0, 2, 0)]')
Exemplo n.º 25
0
 def run(self, arguments, options):
   print fb.describeObject('[NSString stringWithCString:(char *)CARenderServerGetInfo(0, 2, 0)]')
Exemplo n.º 26
0
 def run(self, arguments, options):
     view = fb.evaluateInputExpression(arguments[0])
     print fb.describeObject('[{} _autolayoutTrace]'.format(view))
Exemplo n.º 27
0
 def run(self, arguments, options):
     print(
         fb.describeObject(
             '[[NSString alloc] initWithUTF8String:{}.data]'.format(
                 arguments[0])))
Exemplo n.º 28
0
 def taplog_callback(frame, bp_loc, internal_dict):
   parameterExpr = objc.functionPreambleExpressionForObjectParameterAtIndex(0)
   print fb.describeObject('[[[%s allTouches] anyObject] view]' % (parameterExpr))
   # We don't want to proceed event (click on button for example), so we just skip it
   lldb.debugger.HandleCommand('thread return')
Exemplo n.º 29
0
 def run(self, arguments, options):
   view = fb.evaluateInputExpression(arguments[0])
   print fb.describeObject('[{} _autolayoutTrace]'.format(view))
Exemplo n.º 30
0
def _copyFromURL(url, preferredFilename, noOpen):
    data = fb.evaluateObjectExpression(
        '(id)[NSData dataWithContentsOfURL:(id){}]'.format(url))
    defaultFilename = fb.describeObject(
        '(id)[[{} pathComponents] lastObject]'.format(url))
    _copyFromData(data, defaultFilename, preferredFilename, noOpen)
Exemplo n.º 31
0
 def run(self, arguments, options):
   view = fb.evaluateInputExpression(arguments[0])
   opt = fb.evaluateBooleanExpression('[UIView instancesRespondToSelector:@selector(_autolayoutTraceRecursively:)]')
   traceCall = '_autolayoutTraceRecursively:1' if opt else '_autolayoutTrace'
   print fb.describeObject('[{} {}]'.format(view, traceCall))
Exemplo n.º 32
0
 def run(self, arguments, options):
     homePath = fb.describeObject('(NSString *)NSHomeDirectory()')
     toexe = 'platform shell open %s' % homePath
     lldb.debugger.HandleCommand(toexe)
Exemplo n.º 33
0
  def run(self, arguments, options):
    upwards = 'YES' if options.upwards else 'NO'
    showViews = 'YES' if options.showViews == 'YES' else 'NO'

    view = fb.evaluateInputExpression(arguments[0])
    print fb.describeObject('[CKComponentHierarchyDebugHelper componentHierarchyDescriptionForView:(UIView *)' + view + ' searchUpwards:' + upwards + ' showViews:' + showViews + ']')