【发布时间】:2019-09-02 17:06:44
【问题描述】:
我正在尝试访问“集合结构”(struct r_debug *) 为了找到一个进程的链接图。 但是我一直遇到无效的地址,我真的想不通 发生了什么事。
这就是我继续尝试找到它的方法:
1. Get the AT_PHDR value from the auxiliary vector
2. Go through the program headers until I find the PT_DYNAMIC segment
3. Try to access the vaddr of that segment (PT_DYNAMIC) to get the dynamic tags
4. Iterate through the dynamic tags until I find DT_DEBUG. If I get here I should be done
问题是我无法通过第 3 步,因为 PT_DYNAMIC 的 vaddr 段总是指向一个无效的地址。
我做错了什么?我需要找到 vaddr 的搬迁吗? 我查看了 LLDB 来源,但无法弄清楚他们是如何获得地址的。
更新:@EmployedRussian 是对的,我正在查看与位置无关的可执行文件。 他计算搬迁的解决方案非常有效。
【问题讨论】:
-
我相信包含您的代码的 sn-p 和您收到的错误消息将有助于大大改善问题。
标签: c linux debugging elf debug-symbols