Examining mmaped addresses using GDB

后端 未结 7 1967
[愿得一人]
[愿得一人] 2020-12-13 21:19

I\'m using the driver I posted at Direct Memory Access in Linux to mmap some physical ram into a userspace address. However, I can\'t use GDB to look at any of the address;

7条回答
  •  别那么骄傲
    2020-12-13 21:42

    you go "info files"

    (gdb) help info files
    Names of targets and files being debugged.
    Shows the entire stack of targets currently in use (including the exec-file,
    core-file, and process, if any), as well as the symbol file name.
    (gdb) info files
    Symbols from "/bin/ls".
    Unix child process:
            Using the running image of child Thread 4160418656 (LWP 10729).
            While running this, GDB does not access memory from...
    Local exec file:
            `/bin/ls', file type elf32-powerpc.
            Entry point: 0x10002a10
            0x10000134 - 0x10000141 is .interp
            0x10000144 - 0x10000164 is .note.ABI-tag
            0x10000164 - 0x100008f8 is .gnu.hash
            0x100008f8 - 0x10001728 is .dynsym
            0x10001728 - 0x100021f3 is .dynstr
            0x100021f4 - 0x100023ba is .gnu.version
    ...
            0x0ffa8300 - 0x0ffad8c0 is .text in /lib/libacl.so.1
            0x0ffad8c0 - 0x0ffad8f8 is .fini in /lib/libacl.so.1
            0x0ffad8f8 - 0x0ffadbac is .rodata in /lib/libacl.so.1
            0x0ffadbac - 0x0ffadd58 is .eh_frame_hdr in /lib/libacl.so.1
            0x0ffadd58 - 0x0ffae4d8 is .eh_frame in /lib/libacl.so.1
            0x0ffbe4d8 - 0x0ffbe4e0 is .ctors in /lib/libacl.so.1
            0x0ffbe4e0 - 0x0ffbe4e8 is .dtors in /lib/libacl.so.1
    ...
    
    (gdb) info sh
    From        To          Syms Read   Shared Object Library
    0xf7fcf960  0xf7fe81a0  Yes         /lib/ld.so.1
    0x0ffd0820  0x0ffd5d10  Yes         /lib/librt.so.1
    0x0ffa8300  0x0ffad8c0  Yes         /lib/libacl.so.1
    0x0ff6a840  0x0ff7f4f0  Yes         /lib/libselinux.so.1
    0x0fdfe920  0x0ff1ae70  Yes         /lib/libc.so.6
    0x0fda23d0  0x0fdb0db0  Yes         /lib/libpthread.so.0
    

    Failing this, you can use "mem" to configure memory ranges.

    (gdb) mem 1 1414
    (gdb) info mem
    Num Enb Low Addr   High Addr  Attrs
    1   y   0x00000001 0x00000586 rw nocache
    (gdb) disable mem 1
    (gdb) info mem
    Num Enb Low Addr   High Addr  Attrs
    1   n   0x00000001 0x00000586 rw nocache
    

提交回复
热议问题