diff options
author | David Srbecky <dsrbecky@google.com> | 2021-05-13 00:32:19 +0100 |
---|---|---|
committer | David Srbecky <dsrbecky@google.com> | 2021-05-13 01:04:57 +0100 |
commit | 01372e33617b21f71b45dc843e6af0dd56df8a54 (patch) | |
tree | 5689c81858d587a016b3b6fe4cabcb0f81fee753 /libunwindstack/Elf.cpp | |
parent | 3c58094d66fa45b41d73e5d023c3a786842cdd2b (diff) | |
download | unwinding-01372e33617b21f71b45dc843e6af0dd56df8a54.tar.gz |
MapInfo: Add get accessors for the fields
Test: libunwindstack_unit_test
Change-Id: I070f81301763abd36d0eb704e4ec319a3d80c394
Diffstat (limited to 'libunwindstack/Elf.cpp')
-rw-r--r-- | libunwindstack/Elf.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/libunwindstack/Elf.cpp b/libunwindstack/Elf.cpp index 47373fd..4dec11e 100644 --- a/libunwindstack/Elf.cpp +++ b/libunwindstack/Elf.cpp @@ -102,7 +102,7 @@ std::string Elf::GetSoname() { } uint64_t Elf::GetRelPc(uint64_t pc, const MapInfo* map_info) { - return pc - map_info->start_ + load_bias_ + map_info->elf_offset_; + return pc - map_info->start() + load_bias_ + map_info->elf_offset(); } bool Elf::GetFunctionName(uint64_t addr, SharedString* name, uint64_t* func_offset) { @@ -376,24 +376,24 @@ void Elf::CacheAdd(MapInfo* info) { // where each reference the entire boot.odex, the cache will properly // use the same cached elf object. - if (info->offset_ == 0 || info->elf_offset_ != 0) { - (*cache_)[info->name_] = std::make_pair(info->elf_, true); + if (info->offset() == 0 || info->elf_offset() != 0) { + (*cache_)[info->name()] = std::make_pair(info->elf(), true); } - if (info->offset_ != 0) { + if (info->offset() != 0) { // The second element in the pair indicates whether elf_offset should // be set to offset when getting out of the cache. - std::string key = std::string(info->name_) + ':' + std::to_string(info->offset_); - (*cache_)[key] = std::make_pair(info->elf_, info->elf_offset_ != 0); + std::string key = std::string(info->name()) + ':' + std::to_string(info->offset()); + (*cache_)[key] = std::make_pair(info->elf(), info->elf_offset() != 0); } } bool Elf::CacheAfterCreateMemory(MapInfo* info) { - if (info->name_.empty() || info->offset_ == 0 || info->elf_offset_ == 0) { + if (info->name().empty() || info->offset() == 0 || info->elf_offset() == 0) { return false; } - auto entry = cache_->find(info->name_); + auto entry = cache_->find(info->name()); if (entry == cache_->end()) { return false; } @@ -402,21 +402,21 @@ bool Elf::CacheAfterCreateMemory(MapInfo* info) { // been cached. Add an entry at name:offset to get this directly out // of the cache next time. info->elf_ = entry->second.first; - std::string key = std::string(info->name_) + ':' + std::to_string(info->offset_); - (*cache_)[key] = std::make_pair(info->elf_, true); + std::string key = std::string(info->name()) + ':' + std::to_string(info->offset()); + (*cache_)[key] = std::make_pair(info->elf(), true); return true; } bool Elf::CacheGet(MapInfo* info) { - std::string name(info->name_); - if (info->offset_ != 0) { - name += ':' + std::to_string(info->offset_); + std::string name(info->name()); + if (info->offset() != 0) { + name += ':' + std::to_string(info->offset()); } auto entry = cache_->find(name); if (entry != cache_->end()) { info->elf_ = entry->second.first; if (entry->second.second) { - info->elf_offset_ = info->offset_; + info->elf_offset_ = info->offset(); } return true; } |