Xcode - 查看内存数据 | lldb指令

如何查看内存数据

1 - 断点配置:Debug\Debug Workflow\View Memory

 1 #import <Foundation/Foundation.h>
 2 @interface Student : NSObject{
 3     @public
 4     int _no;
 5     int _age;
 6 }
 7 
 8 @end
 9 
10 @implementation Student
11 
12 @end
13 
14 int main(int argc, const char * argv[]) {
15     
16     Student *stu = [[Student alloc] init];
17     stu->_no = 4;
18     stu->_age = 5;
19 
20     NSLog(@"%@",stu);
21     return 0;
22     
23 }

在第 20 行打上断点,stu 内分布状况如图所示:获取前 16个字节,从右至左读取

2 - 使用 lldb 指令,同样要打上断点

① 常用指令

② 如何使用:将 _no = 4 修改成了 _no = 8

 

posted on 2022-05-26 13:09  低头捡石頭  阅读(673)  评论(0编辑  收藏  举报

导航