Xcode “如何使用lldb”;“内存查找”;指挥部?
根据lldb联机帮助,Xcode “如何使用lldb”;“内存查找”;指挥部?,xcode,macos,lldb,Xcode,Macos,Lldb,根据lldb联机帮助,内存查找的工作原理如下: Find a value in the memory of the process being debugged. Syntax: memory find <cmd-options> <address> <value> [<value> [...]] Command Options Usage: memory find <address> <value> [<va
内存查找
的工作原理如下:
Find a value in the memory of the process being debugged.
Syntax: memory find <cmd-options> <address> <value> [<value> [...]]
Command Options Usage:
memory find <address> <value> [<value> [...]]
memory find [-e <expr>] [-s <name>] [-c <count>] [-o <offset>] <address> <value> [<value> [...]]
-c <count> ( --count <count> )
How many times to perform the search.
-e <expr> ( --expression <expr> )
Evaluate an expression to obtain a byte pattern.
-o <offset> ( --dump-offset <offset> )
When dumping memory for a match, an offset from the match location
to start dumping from.
-s <name> ( --string <name> )
Use text to find a byte pattern.
This command takes options and free-form arguments. If your arguments
resemble option specifiers (i.e., they start with a - or --), you must use
' -- ' between the end of the command options and the beginning of the
arguments.
(lldb) me fi -s "f" -- ptr ptr+8192*256
Your data was found at location: 0x11033e20c
0x11033e20c: 66 bb 58 07 d0 b7 32 7d ff 7f 00 00 66 5b e7 82 f.X...2}....f[..
或
或
我在谷歌上搜索了一些用法示例,但什么也没找到。如果有人举一个有效的例子,我将不胜感激。特别是,我想从指针标识的块的开始搜索给定数量的字节,以找到特定(字节)值(本例中为255)的第一次出现
我在OSX上使用的是Xcode 7.0.1,lldb版本是lldb-340.4.70
。
更新 我发现
-s
选项可以正常工作,例如:
Find a value in the memory of the process being debugged.
Syntax: memory find <cmd-options> <address> <value> [<value> [...]]
Command Options Usage:
memory find <address> <value> [<value> [...]]
memory find [-e <expr>] [-s <name>] [-c <count>] [-o <offset>] <address> <value> [<value> [...]]
-c <count> ( --count <count> )
How many times to perform the search.
-e <expr> ( --expression <expr> )
Evaluate an expression to obtain a byte pattern.
-o <offset> ( --dump-offset <offset> )
When dumping memory for a match, an offset from the match location
to start dumping from.
-s <name> ( --string <name> )
Use text to find a byte pattern.
This command takes options and free-form arguments. If your arguments
resemble option specifiers (i.e., they start with a - or --), you must use
' -- ' between the end of the command options and the beginning of the
arguments.
(lldb) me fi -s "f" -- ptr ptr+8192*256
Your data was found at location: 0x11033e20c
0x11033e20c: 66 bb 58 07 d0 b7 32 7d ff 7f 00 00 66 5b e7 82 f.X...2}....f[..
可能只是-e
选项(我在本例中需要此选项)已损坏,例如:
(lldb) me fi -e 255 -- ptr ptr+8191*256
error: expression evaluation failed. pass a string instead?
试图诱使-s
选项接受转义的十六进制或十进制值似乎也不起作用,不幸的是:
(lldb) me fi -s "\xff" -- ptr ptr+8191*256
Your data was not found within the range.
(lldb) me fi -s "\255" -- ptr ptr+8191*256
Your data was not found within the range.
此问题已在开源LLDB中修复,修订版为243893()
我无法对Xcode中此修复程序的可用性发表任何评论,但您可以尝试的一件事是从源代码编译LLDB,并使用手动构建的LLDB和修复程序来调试您的问题谢谢-我将向Apple提交一份错误报告。
(lldb) me fi -s "\xff" -- ptr ptr+8191*256
Your data was not found within the range.
(lldb) me fi -s "\255" -- ptr ptr+8191*256
Your data was not found within the range.