Xcode调试器(lldb)从内存地址获取对象描述 [英] Xcode debugger (lldb) get object description from memory address

查看:1574
本文介绍了Xcode调试器(lldb)从内存地址获取对象描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鲜为人知的事实:现在,在Xcode中,当它在调试器中暂停时,可以对通知中心进行自省,以了解注册了哪些对象以接收哪些通知:

Little-known fact: It is now possible, in Xcode, while paused in the debugger, to introspect the notification center to learn what objects are registered to receive what notifications:

(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获取学习 是什么对象?

Very nice, but how do I get from the memory address 0x7fc795700140 to learning what object that is?

编辑,我在这里留下这个问题,但是我认为正确的答案是

EDIT I'm leaving this question here, but I think the correct answer is the kind of thing shown at LLDB (Swift): Casting Raw Address into Usable Type

推荐答案

po适用于地址(至少在Objective-C/Mac环境中)

po works for addresses (In Objective-C/Mac context, at least)

例如:

(lldb)po [NSNotificationCenter defaultCenter]

(lldb) po [NSNotificationCenter defaultCenter]

NSWindowDidResizeNotification,0x7fff9a0e98e0、0x6100001246a0、1400

NSWindowDidResizeNotification, 0x7fff9a0e98e0, 0x6100001246a0, 1400

(lldb)po 0x6100001246a0

(lldb) po 0x6100001246a0

ExpandOneView:0x6100001246a0

ExpandOneView: 0x6100001246a0

这篇关于Xcode调试器(lldb)从内存地址获取对象描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆