I'm debugging a program (in Solaris) that may be writing into memory marked read-only, but I'm unsure how to determine whether that page of memory is actually marked as read-only.
Can I make that determination 开发者_开发知识库with gdb? If not, what can I use?
On Solaris you can look at the address space of a process by using the pmap command, e.g. pmap <pid>
. This will display the r/w/x permissions for each mapping; along with other information.
Example from Solaris man page:
$ pmap 102905 102905: sh 00010000 192K r-x-- /usr/bin/ksh 00040000 8K rwx-- /usr/bin/ksh 00042000 40K rwx-- [ heap ] FF180000 664K r-x-- /usr/lib/libc.so.1 FF236000 24K rwx-- /usr/lib/libc.so.1 FF23C000 8K rwx-- /usr/lib/libc.so.1 FF250000 8K rwx-- [ anon ] ... total 1880K
Look into pmap
and pmem
tools.
精彩评论