MCPcopy Create free account
hub / github.com/apache/brpc / CacheMemoryRegions

Method CacheMemoryRegions

src/butil/debug/stack_trace_posix.cc:609–625  ·  view source on GitHub ↗

Parses /proc/self/maps in order to compile a list of all object file names for the modules that are loaded in the current process. Returns true on success.

Source from the content-addressed store, hash-verified

607 // for the modules that are loaded in the current process.
608 // Returns true on success.
609 bool CacheMemoryRegions() {
610 // Reads /proc/self/maps.
611 std::string contents;
612 if (!ReadProcMaps(&contents)) {
613 LOG(ERROR) << "Failed to read /proc/self/maps";
614 return false;
615 }
616
617 // Parses /proc/self/maps.
618 if (!ParseProcMaps(contents, &regions_)) {
619 LOG(ERROR) << "Failed to parse the contents of /proc/self/maps";
620 return false;
621 }
622
623 is_initialized_ = true;
624 return true;
625 }
626
627 // FIXME(gejun): Missing O_CLOEXEC from our linux headers. The flag should
628 // work on majority machines which installed 2.6.23 or newer kernels. But

Callers

nothing calls this directly

Calls 2

ReadProcMapsFunction · 0.85
ParseProcMapsFunction · 0.85

Tested by

no test coverage detected