diff options
author | Casey Dahlin <sadmac@google.com> | 2019-03-12 17:50:52 -0700 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2019-06-11 12:09:18 -0700 |
commit | 6b95a0e9993ac6563476b0489c1ef982f8412f21 (patch) | |
tree | 4a1b2a73b520c3c2051640c887c69f1486dfc6c9 /libbacktrace/UnwindStackMap.cpp | |
parent | 1d7f3b4f4e4bda94cc1a9b6e4291b414b97a3180 (diff) |
Internalize subclasses of Memory
There are many subclasses of the Memory class and the overwhelming
majority of them don't need to be exposed externally. We move all of
them to internal headers except MemoryOfflineBuffer, which moves to a
separate header. This dramatically reduces the exposed API surface and
makes the code more modular.
Also, remove the Offline code from libbacktrace. It's not used any where.
Test: Unit tests pass, clean tree still builds
Change-Id: I55dacdf080daba0bfe65c1ad53a4b326bb482e83
Diffstat (limited to 'libbacktrace/UnwindStackMap.cpp')
-rw-r--r-- | libbacktrace/UnwindStackMap.cpp | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/libbacktrace/UnwindStackMap.cpp b/libbacktrace/UnwindStackMap.cpp index 4518891c3..aa0b17c99 100644 --- a/libbacktrace/UnwindStackMap.cpp +++ b/libbacktrace/UnwindStackMap.cpp @@ -132,43 +132,6 @@ std::shared_ptr<unwindstack::Memory> UnwindStackMap::GetProcessMemory() { return process_memory_; } -UnwindStackOfflineMap::UnwindStackOfflineMap(pid_t pid) : UnwindStackMap(pid) {} - -bool UnwindStackOfflineMap::Build() { - return false; -} - -bool UnwindStackOfflineMap::Build(const std::vector<backtrace_map_t>& backtrace_maps) { - for (const backtrace_map_t& map : backtrace_maps) { - maps_.push_back(map); - } - - std::sort(maps_.begin(), maps_.end(), - [](const backtrace_map_t& a, const backtrace_map_t& b) { return a.start < b.start; }); - - unwindstack::Maps* maps = new unwindstack::Maps; - stack_maps_.reset(maps); - for (const backtrace_map_t& map : maps_) { - maps->Add(map.start, map.end, map.offset, map.flags, map.name, map.load_bias); - } - return true; -} - -bool UnwindStackOfflineMap::CreateProcessMemory(const backtrace_stackinfo_t& stack) { - if (stack.start >= stack.end) { - return false; - } - - // Create the process memory from the stack data. - if (memory_ == nullptr) { - memory_ = new unwindstack::MemoryOfflineBuffer(stack.data, stack.start, stack.end); - process_memory_.reset(memory_); - } else { - memory_->Reset(stack.data, stack.start, stack.end); - } - return true; -} - //------------------------------------------------------------------------- // BacktraceMap create function. //------------------------------------------------------------------------- @@ -189,15 +152,3 @@ BacktraceMap* BacktraceMap::Create(pid_t pid, bool uncached) { } return map; } - -//------------------------------------------------------------------------- -// BacktraceMap create offline function. -//------------------------------------------------------------------------- -BacktraceMap* BacktraceMap::CreateOffline(pid_t pid, const std::vector<backtrace_map_t>& maps) { - UnwindStackOfflineMap* map = new UnwindStackOfflineMap(pid); - if (!map->Build(maps)) { - delete map; - return nullptr; - } - return map; -} |