Records

Functions

  • void MergeMmapedModules (std::vector<debug_ipc::Module> & modulesconst std::vector<debug_ipc::AddressRegion> & mmapsstd::function<std::optional<ElfSegInfo> (uint64_t)> get_elf_info_for_base)

    With `-fuse-ld=lld -z noseparate-code`, multiple ELF segments could live on the same page and

    get mapped multiple times with different flags. For example,

    Program Headers:

    Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align

    LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000858 0x000858 R 0x1000

    LOAD 0x000860 0x0000000000001860 0x0000000000001860 0x000250 0x000250 R E 0x1000

    LOAD 0x000ab0 0x0000000000002ab0 0x0000000000002ab0 0x000220 0x000220 RW 0x1000

    LOAD 0x000cd0 0x0000000000003cd0 0x0000000000003cd0 0x000008 0x000008 RW 0x1000

    [zxdb] aspace

    Start End Prot Size Koid Offset Cmt.Pgs Name

    0x15fb9584000 0x15fb9585000 r-- 4K 479448 0x0 0 ...

    0x15fb9585000 0x15fb9586000 r-x 4K 479449 0x0 0 ...

    0x15fb9586000 0x15fb9587000 r-- 4K 479450 0x0 0 ...

    0x15fb9587000 0x15fb9588000 rw- 4K 479451 0x0 0 ...

    and the debugger will see four ELF headers from 0x15fb9584000 to 0x15fb9587000. The third has

    the same read-only protection at runtime because it contains read-only relocations.

    To solve this, we use a variable to track the end of the last module, and skip regions that

    overlap with the last module.

    Defined at line 175 of file ../../src/developer/debug/debug_agent/elf_utils.cc