gpt4 book ai didi

Xcode调试器(lldb)从内存地址获取对象描述

转载 作者:行者123 更新时间:2023-12-03 04:45:01 25 4
gpt4 key购买 nike

鲜为人知的事实:现在可以在 Xcode 中,当在调试器中暂停时,内省(introspection)通知中心以了解注册了哪些对象来接收哪些通知:

(lldb) po NotificationCenter.default

<NSNotificationCenter:0x6040000d40b0>
Name, Object, Observer, Options
com.apple.accessibility.reduce.motion.status, 0x10b126190, 0x7fc795700140, 1001
com.apple.accessibility.asst.scanner.status, 0x10b126190, 0x7fc795700140, 1001
// ... etc. ...

非常好,但是我如何从获取内存地址 0x7fc795700140 到了解它是什么对象?

编辑我将这个问题留在这里,但我认为正确的答案是 LLDB (Swift): Casting Raw Address into Usable Type 中显示的那种内容。

最佳答案

菲利普的答案在 Swift 中的等价物是:

(lldb) expr -l objc -O -- 0x7fc795700140
<UIApplication: 0x7fc795700140>

关于Xcode调试器(lldb)从内存地址获取对象描述,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45463132/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com