MCPcopy Create free account
hub / github.com/chromium/crashpad / ProcessMemoryLinux

Method ProcessMemoryLinux

util/process/process_memory_linux.cc:34–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32namespace crashpad {
33
34ProcessMemoryLinux::ProcessMemoryLinux(PtraceConnection* connection)
35 : ProcessMemory(), mem_fd_(), ignore_top_byte_(false) {
36#if defined(ARCH_CPU_ARM_FAMILY)
37 if (connection->Is64Bit()) {
38 ignore_top_byte_ = true;
39 }
40#endif // ARCH_CPU_ARM_FAMILY
41
42 char path[32];
43 snprintf(path, sizeof(path), "/proc/%d/mem", connection->GetProcessID());
44 mem_fd_.reset(HANDLE_EINTR(open(path, O_RDONLY | O_NOCTTY | O_CLOEXEC)));
45 if (mem_fd_.is_valid()) {
46 read_up_to_ = [this](VMAddress address, size_t size, void* buffer) {
47 ssize_t bytes_read =
48 HANDLE_EINTR(pread64(mem_fd_.get(), buffer, size, address));
49 if (bytes_read < 0) {
50 PLOG(ERROR) << "pread64";
51 }
52 return bytes_read;
53 };
54 return;
55 }
56
57 read_up_to_ = std::bind(&PtraceConnection::ReadUpTo,
58 connection,
59 std::placeholders::_1,
60 std::placeholders::_2,
61 std::placeholders::_3);
62}
63
64ProcessMemoryLinux::~ProcessMemoryLinux() {}
65

Callers

nothing calls this directly

Calls 5

Is64BitMethod · 0.45
GetProcessIDMethod · 0.45
resetMethod · 0.45
is_validMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected