Commit 776a7cee authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[platform] Properly account for the library offset.

When looking at /proc/self/maps, we need to take into account the offset
in addition to the start and end addresses, otherwise --prof get's
confused with binaries produced by lld.

Change-Id: If6b484a8080a0393e91174c114dafe9a11964e8d
Reviewed-on: https://chromium-review.googlesource.com/720371Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48574}
parent 21821447
......@@ -203,11 +203,15 @@ std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
// This loop will terminate once the scanning hits an EOF.
while (true) {
uintptr_t start, end;
uintptr_t start, end, offset;
char attr_r, attr_w, attr_x, attr_p;
// Parse the addresses and permission bits at the beginning of the line.
if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break;
if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break;
if (fscanf(fp, "%" V8PRIxPTR, &offset) != 1) break;
// Adjust {start} based on {offset}.
start -= offset;
int c;
if (attr_r == 'r' && attr_w != 'w' && attr_x == 'x') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment