在 Xcode 中从地址开始查看内存(字节)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33650134/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Viewing the memory (bytes) from an address onwards in Xcode
提问by dumbledad
In visual studio I can set a breakpoint in my code and, when execution breaks, get the address of the memory I am interested in, and then put the address into the memory window to see all the memory bytes from the address onwards. Here's an example:
在visual studio中,我可以在我的代码中设置一个断点,当执行中断时,获取我感兴趣的内存的地址,然后将该地址放入内存窗口中,以查看从该地址开始的所有内存字节。下面是一个例子:
You can see the breakpoint hit in the middle Visual Studio window, the watch on the variable I am interested in in the bottom window that gives me the address, and I typed the address into the top window to see the memory there.
您可以在中间的 Visual Studio 窗口中看到断点命中,在底部窗口中我感兴趣的变量上的观察为我提供了地址,我将地址输入到顶部窗口中以查看那里的内存。
After execution hits a breakpoint in Xcode how do I view the bytes in memory from a particular address onwards?
执行在 Xcode 中遇到断点后,如何从特定地址开始查看内存中的字节?
(N.B. I have tried to search online for this but my search results are dominated by Xcode's memory usage monitor, which is not what I am after.)
(注意,我曾尝试在线搜索此内容,但我的搜索结果由 Xcode 的内存使用情况监视器主导,这不是我所追求的。)
回答by dumbledad
As Martin Rpoints out in his comment on my question, Eric covers exactly this in his answerto the question How to print memory in 0xb0987654 using lldb. Eric explains that Xcode has a Memory Browserwindow that displays the contents of a given memory addresses.
正如Martin R在他对我的问题的评论中指出的那样,Eric 在他对How to print memory in 0xb0987654 using lldb问题的回答中完全涵盖了这一点。Eric 解释说 Xcode 有一个Memory Browser窗口,可以显示给定内存地址的内容。
Eric mentions that we can access the memory browser by pressing ???Mor through the Debug --> Debug Workflow --> View Memorymenus.
Eric 提到我们可以通过按???M或通过Debug --> Debug Workflow --> View Memory菜单访问内存浏览器。
He notes that there is a field in its bottom left corner where we can paste the memory address you want to inspect.
他注意到它的左下角有一个字段,我们可以在其中粘贴您要检查的内存地址。
Lastly he provides a link to the documentationand to another related answer
回答by Santiago
In Xcode, there is two options of view memory, you should choose the view memory of *XXX, not view memory of XXX.
在Xcode中,view memory有两个选项,你应该选择*XXX的view memory,而不是xxx的view memory。