Exemplo n.º 1
0
    def run(self, arguments, options):
        maxDepth = int(options.depth)
        isMac = runtimeHelpers.isMacintoshArch()

        if arguments[0] == '__keyWindow_dynamic__':
            arguments[0] = '(id)[[UIApplication sharedApplication] keyWindow]'

            if isMac:
                arguments[
                    0] = '(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:0] contentView]'

        if options.upwards:
            view = arguments[0]
            description = viewHelpers.upwardsRecursiveDescription(
                view, maxDepth)
            if description:
                print description
            else:
                print 'Failed to walk view hierarchy. Make sure you pass a view, not any other kind of object or expression.'
        else:
            printingMethod = 'recursiveDescription'
            if isMac:
                printingMethod = '_subtreeDescription'

            description = fb.evaluateExpressionValue(
                '(id)[' + arguments[0] + ' ' + printingMethod +
                ']').GetObjectDescription()
            if maxDepth > 0:
                separator = re.escape("   | ")
                prefixToRemove = separator * maxDepth + " "
                description += "\n"
                description = re.sub(r'%s.*\n' % (prefixToRemove), r'',
                                     description)
            print description
Exemplo n.º 2
0
    def run(self, arguments, options):
        maxDepth = int(options.depth)
        isMac = runtimeHelpers.isMacintoshArch()

        if arguments[0] == "__keyWindow_dynamic__":
            arguments[0] = "(id)[[UIApplication sharedApplication] keyWindow]"

            if isMac:
                arguments[0] = "(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:0] contentView]"

        if options.upwards:
            view = arguments[0]
            description = viewHelpers.upwardsRecursiveDescription(view, maxDepth)
            if description:
                print description
            else:
                print "Failed to walk view hierarchy. Make sure you pass a view, not any other kind of object or expression."
        else:
            printingMethod = "recursiveDescription"
            if isMac:
                printingMethod = "_subtreeDescription"

            description = fb.evaluateExpressionValue(
                "(id)[" + arguments[0] + " " + printingMethod + "]"
            ).GetObjectDescription()
            if maxDepth > 0:
                separator = re.escape("   | ")
                prefixToRemove = separator * maxDepth + " "
                description += "\n"
                description = re.sub(r"%s.*\n" % (prefixToRemove), r"", description)
            print description
Exemplo n.º 3
0
  def run(self, arguments, options):
    maxDepth = int(options.depth)
    isMac = runtimeHelpers.isMacintoshArch()

    if arguments[0] == '__keyWindow_dynamic__':
      arguments[0] = '(id)[[UIApplication sharedApplication] keyWindow]'

      if isMac:
        arguments[0] = '(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:0] contentView]'

    if options.upwards:
      view = arguments[0]
      description = viewHelpers.upwardsRecursiveDescription(view, maxDepth)
      if description:
        print(description)
      else:
        print('Failed to walk view hierarchy. Make sure you pass a view, not any other kind of object or expression.')
    else:
      printingMethod = 'recursiveDescription'
      if isMac:
        printingMethod = '_subtreeDescription'

      description = fb.evaluateExpressionValue('(id)[' + arguments[0] + ' ' + printingMethod + ']').GetObjectDescription()
      if description:
        description = description.replace('    |', '  |')
        if maxDepth > 0:
          separator = re.escape("   | ")
          prefixToRemove = separator * maxDepth + " "
          description += "\n"
          description = re.sub(r'%s.*\n' % (prefixToRemove), r'', description)
        else:
          description = '\n'.join([l if not l.startswith('   |') else l[4:] for l in description.splitlines()])

      print(description)
Exemplo n.º 4
0
    def run(self, arguments, options):
        maxDepth = int(options.depth)
        window = int(options.window)
        isMac = runtimeHelpers.isMacintoshArch()

        if window > 0:
            if isMac:
                arguments[0] = (
                    "(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:"
                    + str(window)
                    + "] contentView]"
                )
            else:
                arguments[0] = (
                    "(id)[[[UIApplication sharedApplication] windows] objectAtIndex:"
                    + str(window)
                    + "]"
                )
        elif arguments[0] == "__keyWindow_dynamic__":
            if isMac:
                arguments[
                    0
                ] = "(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:0] contentView]"  # noqa B950
            else:
                arguments[0] = "(id)[[UIApplication sharedApplication] keyWindow]"

        if options.upwards:
            view = arguments[0]
            description = viewHelpers.upwardsRecursiveDescription(view, maxDepth)
            if description:
                print(description)
            else:
                print(
                    "Failed to walk view hierarchy. Make sure you pass a view, not any other kind of object or expression."  # noqa B950
                )
        else:
            printingMethod = "recursiveDescription"
            if isMac:
                printingMethod = "_subtreeDescription"

            description = fb.evaluateExpressionValue(
                "(id)[" + arguments[0] + " " + printingMethod + "]"
            ).GetObjectDescription()
            if maxDepth > 0:
                separator = re.escape("   | ")
                prefixToRemove = separator * maxDepth + " "
                description += "\n"
                description = re.sub(r"%s.*\n" % (prefixToRemove), r"", description)

            if options.short:
                toRemove = ":.*(?:\n|$)"
                description = re.sub(toRemove, r">\n", description)
            elif options.medium:
                toRemove = ";.*(?:\n|$)"
                description = re.sub(toRemove, r">\n", description)

            print(description)
Exemplo n.º 5
0
 def run(self, arguments, options):
     if options.upwards:
         view = arguments[0]
         description = viewHelpers.upwardsRecursiveDescription(view)
         if description:
             print description
         else:
             print 'Failed to walk view hierarchy. Make sure you pass a view, not any other kind of object or expression.'
     else:
         lldb.debugger.HandleCommand('po (id)[' + arguments[0] + ' recursiveDescription]')
Exemplo n.º 6
0
 def run(self, arguments, options):
   if options.upwards:
     view = arguments[0]
     description = viewHelpers.upwardsRecursiveDescription(view)
     if description:
       print description
     else:
       print 'Failed to walk view hierarchy. Make sure you pass a view, not any other kind of object or expression.'
   else:
     lldb.debugger.HandleCommand('po (id)[' + arguments[0] + ' recursiveDescription]')
Exemplo n.º 7
0
  def run(self, arguments, options):
    maxDepth = int(options.depth)

    if options.upwards:
      view = arguments[0]
      description = viewHelpers.upwardsRecursiveDescription(view, maxDepth)
      if description:
        print description
      else:
        print 'Failed to walk view hierarchy. Make sure you pass a view, not any other kind of object or expression.'
    else:
      description = fb.evaluateExpressionValue('(id)[' + arguments[0] + ' recursiveDescription]').GetObjectDescription()
      if maxDepth > 0:
        separator = re.escape("   | ")
        prefixToRemove = separator * maxDepth + " "
        description += "\n"
        description = re.sub(r'%s.*\n' % (prefixToRemove), r'', description)
      print description