Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Unified Diff: base/android/linker/crazy_linker/src/crazy_linker_proc_maps.h

Issue 23717023: Android: Add chrome-specific dynamic linker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename library Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/android/linker/crazy_linker/src/crazy_linker_proc_maps.h
diff --git a/base/android/linker/crazy_linker/src/crazy_linker_proc_maps.h b/base/android/linker/crazy_linker/src/crazy_linker_proc_maps.h
new file mode 100644
index 0000000000000000000000000000000000000000..8fde718d112fcb5a71e6d860dcccd0cf382c771d
--- /dev/null
+++ b/base/android/linker/crazy_linker/src/crazy_linker_proc_maps.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CRAZY_LINKER_PROC_MAPS_H
+#define CRAZY_LINKER_PROC_MAPS_H
+
+// Helper classes and functions to extract useful information out of
+// /proc/self/maps.
+
+#include <stdint.h>
+#include <sys/mman.h> // for PROT_READ etc...
+
+namespace crazy {
+
+// Find which loaded ELF binary contains |address|.
+// On success, returns true and sets |*load_address| to its load address,
+// and fills |path_buffer| with the path to the corresponding file.
+bool FindElfBinaryForAddress(void* address,
+ uintptr_t* load_address,
+ char* path_buffer,
+ size_t path_buffer_len);
+
+// Returns the current protection bit flags for the page holding a given
+// |address|. On success, returns true and sets |*prot_flags|.
+bool FindProtectionFlagsForAddress(void* address, int* prot_flags);
+
+// Return the load address of a given ELF binary.
+// If |file_name| contains a slash, this will try to perform an
+// exact match with the content of /proc/self/maps. Otherwise,
+// it will be taken as a base name, and the load address of the first
+// matching entry will be returned.
+// On success, returns true and sets |*load_address| to the load address,
+// and |*load_offset| to the load offset.
+bool FindLoadAddressForFile(const char* file_name,
+ uintptr_t* load_address,
+ uintptr_t* load_offset);
+
+} // namespace crazy
+
+#endif // CRAZY_LINKER_PROC_MAPS_H

Powered by Google App Engine
This is Rietveld 408576698