美文网首页
Thread Frame

Thread Frame

作者: 低吟浅唱1990 | 来源:发表于2019-04-19 11:04 被阅读0次

在Mac终端中输入lldb进入LLDB模式,然后输入thread help

(lldb) thread help
     Commands for operating on one or more threads in the current process.

Syntax: thread <subcommand> [<subcommand-options>]

The following subcommands are supported:

      backtrace      -- Show thread call stacks.  Defaults to the current thread, thread indexes can be specified as
                        arguments.
                        Use the thread-index "all" to see all threads.
                        Use the thread-index "unique" to see threads grouped by unique call stacks.
      continue       -- Continue execution of the current target process.  One or more threads may be specified, by
                        default all threads continue.
      info           -- Show an extended summary of one or more threads.  Defaults to the current thread.
      jump           -- Sets the program counter to a new address.
      list           -- Show a summary of each thread in the current target process.
      plan           -- Commands for managing thread plans that control execution.
      return         -- Prematurely return from a stack frame, short-circuiting execution of newer frames and
                        optionally yielding a specified value.  Defaults to the exiting the current stack frame. 
                        Expects 'raw' input (see 'help raw-input'.)
      select         -- Change the currently selected thread.
      step-in        -- Source level single step, stepping into calls.  Defaults to current thread unless specified.
      step-inst      -- Instruction level single step, stepping into calls.  Defaults to current thread unless
                        specified.
      step-inst-over -- Instruction level single step, stepping over calls.  Defaults to current thread unless
                        specified.
      step-out       -- Finish executing the current stack frame and stop after returning.  Defaults to current thread
                        unless specified.
      step-over      -- Source level single step, stepping over calls.  Defaults to current thread unless specified.
      step-scripted  -- Step as instructed by the script class passed in the -C option.
      until          -- Continue until a line number or address is reached by the current or specified thread.  Stops
                        when returning from the current function as a safety measure.  The target line number(s) are
                        given as arguments, and if more than one is provided, stepping will stop when the first one is
                        hit.
For more help on any particular subcommand, type 'help <command> <subcommand>'.

以上是thread相关的命令。

(lldb) frame help
     Commands for selecting and examing the current thread's stack frames.

Syntax: frame <subcommand> [<subcommand-options>]

The following subcommands are supported:

      info     -- List information about the current stack frame in the current thread.
      select   -- Select the current stack frame by index from within the current thread (see 'thread backtrace'.)
      variable -- Show variables for the current stack frame. Defaults to all arguments and local variables in scope.
                  Names of argument, local, file static and file global variables can be specified. Children of
                  aggregate variables can be specified such as 'var->child.x'.

以上是frame的相关命令

断点

设置入上图中的断点,并运行程序。Xcode左边会出现线程信息。

Thread
//显示线程调用堆栈
(lldb)thread backtrace
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
  * frame #0: 0x0000000103b67c34 Signals`MasterViewController.viewWillAppear(animated=false, self=0x00007f978fc10b60) at MasterViewController.swift:54
    frame #1: 0x0000000103b682f3 Signals`@objc MasterViewController.viewWillAppear(_:) at <compiler-generated>:0
    frame #2: 0x000000010dd21443 UIKitCore`-[UIViewController _setViewAppearState:isAnimating:] + 690
    frame #3: 0x000000010dd219a9 UIKitCore`__52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke + 265
    frame #4: 0x0000000106401a6a CoreFoundation`-[__NSSingleObjectArrayI enumerateObjectsWithOptions:usingBlock:] + 58
    frame #5: 0x000000010dd21737 UIKitCore`-[UIViewController _setViewAppearState:isAnimating:] + 1446
    frame #6: 0x000000010dd21bd4 UIKitCore`-[UIViewController __viewWillAppear:] + 131
    frame #7: 0x000000010dc7b6e2 UIKitCore`-[UINavigationController _startTransition:fromViewController:toViewController:] + 893
    frame #8: 0x000000010dc7c48b UIKitCore`-[UINavigationController _startDeferredTransitionIfNeeded:] + 896
    frame #9: 0x000000010dc7d7e0 UIKitCore`-[UINavigationController __viewWillLayoutSubviews] + 150
    frame #10: 0x000000010dc5d600 UIKitCore`-[UILayoutContainerView layoutSubviews] + 217
    frame #11: 0x000000010e824795 UIKitCore`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1441
    frame #12: 0x000000010b8b8b19 QuartzCore`-[CALayer layoutSublayers] + 175
    frame #13: 0x000000010b8bd9d3 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 395
    frame #14: 0x000000010b8367ca QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 342
    frame #15: 0x000000010b86d97e QuartzCore`CA::Transaction::commit() + 576
    frame #16: 0x000000010e3552d0 UIKitCore`__34-[UIApplication _firstCommitBlock]_block_invoke_2 + 139
    frame #17: 0x000000010641962c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    frame #18: 0x0000000106418de0 CoreFoundation`__CFRunLoopDoBlocks + 336
    frame #19: 0x0000000106413654 CoreFoundation`__CFRunLoopRun + 1284
    frame #20: 0x0000000106412e11 CoreFoundation`CFRunLoopRunSpecific + 625
    frame #21: 0x000000010b77b1dd GraphicsServices`GSEventRunModal + 62
    frame #22: 0x000000010e33a81d UIKitCore`UIApplicationMain + 140
    frame #23: 0x0000000103b6ecc7 Signals`main at AppDelegate.swift:32
    frame #24: 0x0000000107c27575 libdyld.dylib`start + 1
    frame #25: 0x0000000107c27575 libdyld.dylib`start + 1
//输出当前线程的调用栈的信息。
(lldb) frame info
frame #0: 0x0000000103b67c34 Signals`MasterViewController.viewWillAppear(animated=false, self=0x00007f978fc10b60) at MasterViewController.swift:54
//显示当前调用栈中的所有变量和值
(lldb) frame variable
(Bool) animated = false
(Signals.MasterViewController) self = 0x00007f978fc10b60 {
  UIKit.UITableViewController = {
    baseUIViewController@0 = {
      UIResponder = {
        NSObject = {
          isa = 0x00007f978fc10b60
        }
      }
      _overrideTransitioningDelegate = 0x00007f978fc10b60
      _view = 0x00007f978fc10b60
      _tabBarItem = 0x00007f978fc10b60
      _navigationItem = 0x00007f978fc10b60
      _toolbarItems = 0x00007f978fc10b60
      _title = 0x00007f978fc10b60
      _nibName = 0x00007f978fc10b60
      _nibBundle = 0x00007f978fc10b60
      _parentViewController = 0x00007f978fc10b60
      _childModalViewController = 0x00007f978fc10b60
      _parentModalViewController = 0x00007f978fc10b60
      _previousRootViewController = 0x00007f978fc10b60
      _modalTransitionView = 0x00007f978fc10b60
      _modalPreservedFirstResponder = 0x00007f978fc10b60
      _dimmingView = 0x00007f978fc10b60
      _dropShadowView = 0x00007f978fc10b60
      _currentAction = 0x00007f978fc10b60
      _storyboard = 0x00007f978fc10b60
      _externalObjectsTableForViewLoading = 0x00007f978fc10b60
      _topLevelObjectsToKeepAliveFromStoryboard = 0x00007f978fc10b60
      _savedHeaderSuperview = 0x00007f978fc10b60
      _savedFooterSuperview = 0x00007f978fc10b60
      _editButtonItem = 0x00007f978fc10b60
      _searchDisplayController = 0x00007f978fc10b60
      _strongSearchDisplayController = 0x00007f978fc10b60
      _modalTransitionStyle = 140288928582496
      _modalPresentationStyle = 140288928582496
      _lastKnownInterfaceOrientation = 140288928582496
      _popoverController = 0x00007f978fc10b60
      _containerViewInSheet = 0x00007f978fc10b60
      _recordedContentScrollView = 0x00007f978fc10b60
      _afterAppearance = 0x00007f978fc10b60
      _explicitAppearanceTransitionLevel = 140288928582496
      _interfaceBuilderKeyCommands = 0x00007f978fc10b60
      _addedKeyCommands = 0x00007f978fc10b60
      _overrideTraitCollectionsForChildren = 0x00007f978fc10b60
      _previewSourceViews = 0x00007f978fc10b60
      _retainCount = 140288928582496
      _ignoreAppSupportedOrientations = true
      _viewHostsLayoutEngine = true
      _storyboardIdentifier = 0x00007f978fc10b60
      _transitioningDelegate = 0x00007f978fc10b60
      _frozenTraitCollection = 0x00007f978fc10b60
      _overrideTraitCollection = 0x00007f978fc10b60
      _accessibilityHUD = 0x00007f978fc10b60
      overrideUseCustomPresentation = true
      _modalPresentationCapturesStatusBarAppearance = true
      _ignoresParentMargins = true
      _childViewControllers = 0x00007f978fc10b60
      _customNavigationInteractiveTransitionDuration = 6.9311940104487398E-310
      _customNavigationInteractiveTransitionPercentComplete = 6.9311940104487398E-310
      _customTransitioningView = 0x00007f978fc10b60
      _lastNotifiedTraitCollection = 0x00007f978fc10b60
      _presentationController = 0x00007f978fc10b60
      _navigationControllerContentOffsetAdjustment = 6.9311940104487398E-310
      _leftContentMargin = 6.9311940104487398E-310
      _rightContentMargin = 6.9311940104487398E-310
      _contentMargin = 6.9311940104487398E-310
      _topLayoutGuide = 0x00007f978fc10b60
      _bottomLayoutGuide = 0x00007f978fc10b60
      _topBarInsetGuideConstraint = 0x00007f978fc10b60
      _bottomBarInsetGuideConstraint = 0x00007f978fc10b60
      _storyboardSegueTemplates = 0x00007f978fc10b60
      _segueResponsibleForModalPresentation = 0x00007f978fc10b60
      _sourceViewControllerIfPresentedViaPopoverSegue = 0x00007f978fc10b60
      _modalSourceViewController = 0x00007f978fc10b60
      _expectedWindow = 0x00007f978fc10b60
      _presentedStatusBarViewController = 0x00007f978fc10b60
      _presentedUserInterfaceStyleViewController = 0x00007f978fc10b60
      _edgesForExtendedLayout = 140288928582496
      __childControllerToIgnoreWhileLookingForTransitionCoordinator = 0x00007f978fc10b60
      _presentingFocusedItem = 0x00007f978fc10b60
      _navigationInsetAdjustment = 0x00007f978fc10b60
      _storyboardPreviewSegueTemplates = 0x00007f978fc10b60
      _storyboardCommitSegueTemplates = 0x00007f978fc10b60
      _storyboardPreviewingRegistrants = 0x00007f978fc10b60
      __embeddedView = 0x00007f978fc10b60
      __embeddingView = 0x00007f978fc10b60
      __embeddedDelegate = 0x00007f978fc10b60
      _originalPresentationController = 0x00007f978fc10b60
      _temporaryPresentationController = 0x00007f978fc10b60
      _preferredFocusedItem = 0x00007f978fc10b60
    }
    _tableViewStyle = 0
    _keyboardSupport = nil
    _staticDataSource = nil
    _filteredDataSource = 0x0000600003f72520
    _filteredDataType = 0
  }
  detailViewController = nil
}
(lldb) 

相关文章

网友评论

      本文标题:Thread Frame

      本文链接:https://www.haomeiwen.com/subject/bzezwqtx.html