Elf interface for new unwinder.

This cl includes the code to read arm unwind information from a shared
library.

Bug: 23762183

Test: Passes all unit tests. I can dump the arm unwind information
Test: for an arm shared library.
Change-Id: I43501ea2eab843b81de8bd5128401dd1971af8d3
diff --git a/libunwindstack/Memory.h b/libunwindstack/Memory.h
index 5ab031d..c5316a1 100644
--- a/libunwindstack/Memory.h
+++ b/libunwindstack/Memory.h
@@ -22,10 +22,7 @@
 #include <unistd.h>
 
 #include <string>
-
-#include <android-base/unique_fd.h>
-
-constexpr bool kMemoryStatsEnabled = true;
+#include <vector>
 
 class Memory {
  public:
@@ -50,15 +47,34 @@
   }
 };
 
+class MemoryBuffer : public Memory {
+ public:
+  MemoryBuffer() = default;
+  virtual ~MemoryBuffer() = default;
+
+  bool Read(uint64_t addr, void* dst, size_t size) override;
+
+  uint8_t* GetPtr(size_t offset);
+
+  void Resize(size_t size) { raw_.resize(size); }
+
+  uint64_t Size() { return raw_.size(); }
+
+ private:
+  std::vector<uint8_t> raw_;
+};
+
 class MemoryFileAtOffset : public Memory {
  public:
   MemoryFileAtOffset() = default;
   virtual ~MemoryFileAtOffset();
 
-  bool Init(const std::string& file, uint64_t offset);
+  bool Init(const std::string& file, uint64_t offset, uint64_t size = UINT64_MAX);
 
   bool Read(uint64_t addr, void* dst, size_t size) override;
 
+  void Clear();
+
  protected:
   size_t size_ = 0;
   size_t offset_ = 0;