加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xcode – 如何使用lldb“memory find”命令?

发布时间:2020-12-14 19:08:56 所属栏目:百科 来源:网络整理
导读:根据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 [value [...]] memory find [-e ex
根据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> [<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.

UPDATE

我发现可以使-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和修复程序调试您的问题

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读