gdb 命令获取给定地址的虚拟内存页权限

gdb command to get the virtual memory page's permissions for a given address

gdb 中是否有一个命令可以让我查看我的应用程序崩溃的内存页面是否具有 Read/Write/Execute 权限?

基本上我想要的是我进入时的样子:

gdb:> addrinfo 0x12345678

我得到:

address 0x12345678 is in range ....
which is occupied by executable image (if any)...../my-lib.so
vm page permsissions: RWX

谢谢!

您可以在“/proc/'pid_of_your_app'/maps”文件中找到此信息。请检查 Understanding Linux /proc/id/maps 了解更多信息。

如果您经常需要在地图文件中查找地址,您可以编写一个小脚本来执行此操作...