The dladdr() function queries the dynamic linker for information aboutthe shared object containing the address addr. The information isreturned in the structure
specified by info. The structure containsat least the following members
關於dladdr函數可以知道關於包含了這個地址的共用對象的動態連結的資訊,這些資訊會記錄到info這個結構中,這個結構包含一下幾個成員
constchar *dli_fname
The pathname of the shared object containing the address.
這個路徑是包含這個共用對象地址的檔案路徑,以我的理解就是調用這個函數的檔案
void*dli_fbase
The base address at which the shared object is mapped into the addressspace of the calling process.
這個地址是這個共用庫被映射到調用他的進程的地址空間中的地址
constchar *dli_sname
Thename of the nearest run-time symbol with a value less than or equalto addr. When possible, the symbol name is returned as it wouldappear in C source code.
If no symbol with a suitable value is found,both this field and dli_saddr are set to NULL.
這個是在運行時的符號表中,小於或者等於addr(這個addr是參數傳進來的)這個地址的最接近的符號,如果可能的話,那麼就返回一個源碼中的字串,如果不行的話那就是使dli_saddr為null
void*dli_saddr
Thevalue of the symbol returned in dli_sname.
返回dli_sanme這個值的地址,通常是函數的地址
Thedladdr() function is available only in dynamically linked programs.
這個dladdr這個函數只對動態連結程式起作用。