summaryrefslogtreecommitdiffstats
path: root/libunwindstack/include/unwindstack/Memory.h
diff options
context:
space:
mode:
Diffstat (limited to 'libunwindstack/include/unwindstack/Memory.h')
-rw-r--r--libunwindstack/include/unwindstack/Memory.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/libunwindstack/include/unwindstack/Memory.h b/libunwindstack/include/unwindstack/Memory.h
index 0c0526616..183b8993a 100644
--- a/libunwindstack/include/unwindstack/Memory.h
+++ b/libunwindstack/include/unwindstack/Memory.h
@@ -21,6 +21,7 @@
#include <sys/types.h>
#include <unistd.h>
+#include <memory>
#include <string>
#include <vector>
@@ -31,6 +32,8 @@ class Memory {
Memory() = default;
virtual ~Memory() = default;
+ static std::shared_ptr<Memory> CreateProcessMemory(pid_t pid);
+
virtual bool ReadString(uint64_t addr, std::string* string, uint64_t max_read = UINT64_MAX);
virtual bool Read(uint64_t addr, void* dst, size_t size) = 0;
@@ -125,13 +128,13 @@ class MemoryLocal : public Memory {
class MemoryRange : public Memory {
public:
- MemoryRange(Memory* memory, uint64_t begin, uint64_t end);
- virtual ~MemoryRange() { delete memory_; }
+ MemoryRange(const std::shared_ptr<Memory>& memory, uint64_t begin, uint64_t end);
+ virtual ~MemoryRange() = default;
bool Read(uint64_t addr, void* dst, size_t size) override;
private:
- Memory* memory_;
+ std::shared_ptr<Memory> memory_;
uint64_t begin_;
uint64_t length_;
};