2017-06-06 62 views
4

當通過kdp調試遠程機器驅動程序(kext)時,我想從lldb讀取用戶空間地址。我知道,在我的代碼可以使用copyin以移動代碼到內核空間,容易閱讀,因此預期當我試圖讀取用戶內存直接失敗:在調試kext時讀取用戶空間地址地址

(lldb) memory read 0x000070000d15a024 
error: kdp read memory failed (error 4) 

有一些替代到copyin在運行時調試會話將我的數據轉換到某處我可以從調試器中讀取它?

感謝

回答

1

假設你加載調試腳本您使用的特定內核(應該是在合適的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