本文介绍了在lldb中转储内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如此所述。当我想要在gdb中转储内存时。

开始点是 0x1000 并且结束 0x2000

对于lldb开始, 0x1000 并结束 0x1200



这是有原因还是只是一个错误?




主要问题是:如何在lldb中将内存区域从 0x1000 转储为 0x2000

解决方案

以下工作适合我:

 (lldb)memory read --outfile /tmp/mem.txt 0x6080000fe680 0x6080000fe680 + 1000 

从给定的起始地址以十六进制格式转储1000字节的内存到/tmp/mem.txt。使用二进制格式。



您也可以使用'count'来表示要转储的字节数。

 (lldb)内存读取 -  outfile /tmp/mem.txt --count 1000 0x6080000fe680 

如果您在Xcode调试环境中并且有一个名为'note1'的变量,您还可以使用:

 (lldb)memory read --outfile /tmp/mem.bin note1 note1 + 100 

在实际位置读取0x1000在Xcode中失败(内存读取失败),必须以某种方式保护。



至于0x1200和0x2000在文档中,我认为这只是一个小错误。


As stated on this site. When I want to dump memory in gdb.

The start point is 0x1000 and end 0x2000.

For lldb start is 0x1000 and end 0x1200 .

Is there a reason for this or is just a mistake ?


Main question is: How do I dump a memory area from 0x1000 to 0x2000 in lldb?

解决方案

The following works fine for me:

    (lldb) memory read --outfile /tmp/mem.txt 0x6080000fe680 0x6080000fe680+1000

Dumps 1000 bytes of memory, from the given start address, in hex format, to /tmp/mem.txt. Use --binary for binary format.

You could also use 'count' to state how many bytes you want to dump:

    (lldb) memory read --outfile /tmp/mem.txt --count 1000 0x6080000fe680

If you are in Xcode debugging environment and have a variable named 'note1', you can also use:

    (lldb) memory read --outfile /tmp/mem.bin note1 note1+100

Reads at the actual location 0x1000 fail in Xcode for me ("memory read failed"), must be protected in some way.

As to the difference between 0x1200 and 0x2000 in the documentation, I think it's simply a small mistake.

这篇关于在lldb中转储内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-10 12:56