Lorgnette(liblorgnette)是一个在OSX上在任意运行中的进程中定位符号的开发包。类似dlsym()方法,但不限于当前进程,运行你在你系统上运行的所有程序。
使用方法:
#include "lorgnette.h"mach_vm_address_t main_addr = lorgnette_lookup(mach_task_self(), "main");assert(dlsym(RTLD_DEFAULT, "main") == main_addr);或者:
pid_t proc = 20131;task_t target;task_for_pid(mach_task_self(), proc, &target);mach_vm_address_t remote_addr = lorgnette_lookup(target, "_private_function");
评论