我正在尝试使用 dlopen 调用对动态加载的共享库中的特定地址空间进行写访问。这样做有什么限制吗?我知道可以这样做,因为可以使用 gdb 调试 solibs。Gdb 使用 mprotect 获得对 solib 的写访问权,以插入和清除断点。
作为回报,我得到 -1 作为回报,29 作为错误号,perror 给出ENOMEM Cannot allocate memory
ENOMEM
The application has requested Single UNIX Specification, Version 2 compliant behavior, but addresses in the range are not valid for the address space of the process, or the addresses specify one or more pages that are not attached to the user's address space by a previous mmap or shmat subroutine call.