GDB show R/W Permissions in specific memory address

3

I have a simulation in Matlab Simulink which uses an SO library file with my algo code. I want to know the read/write permissions of a specific memory address using GDB. For example I care about knowing the permissions on the memory of this variable:

(gdb) p &CalValid
$3 = (const WORD *) 0x91f6005c <CalValid>

If I use (gdb) maintenance info sections it shows only the memory space of the matlab process and no the loaded library.

Exec file:

`/appl/matlab2010a32/bin/glnx86/MATLAB', file type elf32-i386.
0x8048134->0x8048147 at 0x00000134: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS
0x8048148->0x8048168 at 0x00000148: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS
...
0x0000->0x00c4 at 0x00001fa0: .comment READONLY HAS_CONTENTS
0x0000->0x0010 at 0x00002064: .gnu_debuglink READONLY HAS_CONTENTS

The reason I need this is because even though the variable is const I have mprotect() elsewhere in the code changing memory permissions of cont variables.

c
linux
memory-management
permissions
gdb
asked on Stack Overflow Jun 16, 2017 by mashrur

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0