我想lldb
在调试远程机器驱动程序(kext)时通过kdp
. 我知道在代码中我可以使用copyin
它来将代码移动到内核空间并轻松读取它,因此当我尝试直接读取用户内存时它失败了:
(lldb) memory read 0x000070000d15a024
error: kdp read memory failed (error 4)
在运行时调试会话期间是否有一些替代方法copyin
可以将我的数据转换为我可以从调试器中读取的地方?
谢谢
我想lldb
在调试远程机器驱动程序(kext)时通过kdp
. 我知道在代码中我可以使用copyin
它来将代码移动到内核空间并轻松读取它,因此当我尝试直接读取用户内存时它失败了:
(lldb) memory read 0x000070000d15a024
error: kdp read memory failed (error 4)
在运行时调试会话期间是否有一些替代方法copyin
可以将我的数据转换为我可以从调试器中读取的地方?
谢谢
假设您为您使用的特定内核加载调试脚本(应该在适当的 KDK 中),您就有了printuserdata
命令。
这是它的描述:
printuserdata:
Read userspace data for given task and print based on format provided.
Syntax: (lldb) printuserdata <task_t> <uspace_address> <format_specifier>
params:
<task_t> : pointer to task
<uspace_address> : address to user space memory
<format_specifier> : String representation for processing the data and printing it.
e.g Q -> unsigned long long, q -> long long, I -> unsigned int, i -> int
10i -> 10 ints, 20s -> 20 character string, s -> null terminated string
See: https://docs.python.org/2/library/struct.html#format-characters
options:
-X : print all values in hex.
-O <file path>: Save data to file
示例调用:
(lldb) printuserdata 0xffffff8013257d80 0x00007fff941f5000 10c