[英]How to use lldb “memory find” command?
根據lldb在線幫助, memory find
應該像這樣工作:
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.
我懷疑實現與幫助信息不匹配,因為我使用的任何語法我似乎得到各種神秘的錯誤消息之一,例如:
error: two addresses needed for memory find
要么
error: do not know how to deal with larger than 8 byte result types. pass a string instead
要么
error: please pass either a block of text, or an expression to evaluate.
我用Google搜索了一些用法示例,並且沒有提出任何問題。 如果有人有一個有效的例子,我將不勝感激。 特別是我想從指針標識的塊的開頭搜索給定的字節數,以找到特定(字節)值的第一次出現(在這種情況下為255)。
我在OS X上使用Xcode 7.0.1,而lldb版本是lldb-340.4.70
。
我發現-s
選項可以工作,例如:
(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( http://llvm.org/viewvc/llvm-project?view=revision&revision=243893 )
我無法對Xcode中此修復程序的可用性發表任何評論,但您可以嘗試的一件事是從源代碼編譯LLDB並使用手工構建的LLDB和修復程序調試您的問題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.