Skip to content
ProcMapsFindByAddr

ProcMapsFindByAddr

Description

Find the entry whose [start, end) range contains addr. Linear scan; for a few dozen mappings this is fine.

Success

Returns a pointer to the matching entry inside self.

Failure

Returns NULL if addr is not in any mapping.

Usage example (Cross-references)

Usage examples (Cross-references)
        // mapping of the test binary itself.
        u64                 self_addr = (u64)(uintptr_t)&test_procmaps_find_self;
        const ProcMapEntry *entry     = ProcMapsFindByAddr(&maps, self_addr);
    
        bool ok = entry != NULL && (entry->perms & PROC_MAP_PERM_EXEC) != 0;
        u64 addr = (u64)(uintptr_t)runtime_addr;
    
        const ProcMapEntry *entry = ProcMapsFindByAddr(&self->maps, addr);
        if (!entry || !entry->path || entry->path[0] == '\0') {
            return false;
    }
    
    const ProcMapEntry *ProcMapsFindByAddr(const ProcMaps *self, u64 addr) {
        if (!self)
            return NULL;
Last updated on