Skip to content

Instantly share code, notes, and snippets.

@matsuda
Last active August 23, 2021 00:58
Show Gist options
  • Save matsuda/e4da2f061982d3362fb6ac962e7ba500 to your computer and use it in GitHub Desktop.
Save matsuda/e4da2f061982d3362fb6ac962e7ba500 to your computer and use it in GitHub Desktop.
LLDB tips
Simulator起動時に `Lost connection to the debugger` と表示されてディタッチされてしまう&Simulator上でアプリが起動しない
# https://developer.apple.com/forums/thread/681037
```
settings set plugin.process.gdb-remote.packet-timeout 300
```
/**
* Swift
*/
// 変数に代入
// `$`を付ける
(lldb) e var $vc = viewController
(lldb) po $vc
// ライブラリをimport
(lldb) expr -l Swift -- import SomeLibrary
/**
* Objective-C
*/
// poiter addressを変数に代入
(lldb) po UIView* $v = nil
(lldb) po $v = (UIView *)0x10551b330
// 参考
* http://akisute.com/2015/12/xcode-72-lldb-swift.html
/// LLDB (Swift): Casting Raw Address into Usable Type
/// https://stackoverflow.com/a/42766226
expr -l Swift -- import UIKit
expr -l Swift -- let $pin = unsafeBitCast(0x7df67c50, to: UIViewController.self)
expr -l Swift -- print($pin.alpha)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment