Bug 1484828 - Rename some fields in EHABIStackWalk.cpp. r=jld

Depends on D3834

Differential Revision: https://phabricator.services.mozilla.com/D3835

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Markus Stange 2018-10-03 02:23:09 +00:00
Родитель 9dd717b2b6
Коммит bf842f3db8
1 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -107,7 +107,7 @@ bool operator<(const EHEntryHandle &lhs, const EHEntryHandle &rhs) {
class EHTable { class EHTable {
uint32_t mStartPC; uint32_t mStartPC;
uint32_t mEndPC; uint32_t mEndPC;
uint32_t mLoadOffset; uint32_t mBaseAddress;
#ifdef HAVE_UNSORTED_EXIDX #ifdef HAVE_UNSORTED_EXIDX
// In principle we should be able to binary-search the index section in // In principle we should be able to binary-search the index section in
// place, but the ICS toolchain's linker is noncompliant and produces // place, but the ICS toolchain's linker is noncompliant and produces
@ -134,7 +134,7 @@ public:
const std::string &name() const { return mName; } const std::string &name() const { return mName; }
uint32_t startPC() const { return mStartPC; } uint32_t startPC() const { return mStartPC; }
uint32_t endPC() const { return mEndPC; } uint32_t endPC() const { return mEndPC; }
uint32_t loadOffset() const { return mLoadOffset; } uint32_t baseAddress() const { return mBaseAddress; }
}; };
class EHAddrSpace { class EHAddrSpace {
@ -548,12 +548,12 @@ EHTable::EHTable(const void *aELF, size_t aSize, const std::string &aName)
#endif #endif
mName(aName) mName(aName)
{ {
const uint32_t base = reinterpret_cast<uint32_t>(aELF); const uint32_t fileHeaderAddr = reinterpret_cast<uint32_t>(aELF);
if (aSize < sizeof(Elf32_Ehdr)) if (aSize < sizeof(Elf32_Ehdr))
return; return;
const Elf32_Ehdr &file = *(reinterpret_cast<Elf32_Ehdr *>(base)); const Elf32_Ehdr &file = *(reinterpret_cast<Elf32_Ehdr *>(fileHeaderAddr));
if (memcmp(&file.e_ident[EI_MAG0], ELFMAG, SELFMAG) != 0 || if (memcmp(&file.e_ident[EI_MAG0], ELFMAG, SELFMAG) != 0 ||
file.e_ident[EI_CLASS] != ELFCLASS32 || file.e_ident[EI_CLASS] != ELFCLASS32 ||
file.e_ident[EI_DATA] != hostEndian || file.e_ident[EI_DATA] != hostEndian ||
@ -571,7 +571,7 @@ EHTable::EHTable(const void *aELF, size_t aSize, const std::string &aName)
const Elf32_Phdr *exidxHdr = 0, *zeroHdr = 0; const Elf32_Phdr *exidxHdr = 0, *zeroHdr = 0;
for (unsigned i = 0; i < file.e_phnum; ++i) { for (unsigned i = 0; i < file.e_phnum; ++i) {
const Elf32_Phdr &phdr = const Elf32_Phdr &phdr =
*(reinterpret_cast<Elf32_Phdr *>(base + file.e_phoff *(reinterpret_cast<Elf32_Phdr *>(fileHeaderAddr + file.e_phoff
+ i * file.e_phentsize)); + i * file.e_phentsize));
if (phdr.p_type == PT_ARM_EXIDX) { if (phdr.p_type == PT_ARM_EXIDX) {
exidxHdr = &phdr; exidxHdr = &phdr;
@ -589,15 +589,15 @@ EHTable::EHTable(const void *aELF, size_t aSize, const std::string &aName)
return; return;
if (!zeroHdr) if (!zeroHdr)
return; return;
mLoadOffset = base - zeroHdr->p_vaddr; mBaseAddress = fileHeaderAddr - zeroHdr->p_vaddr;
mStartPC += mLoadOffset; mStartPC += mBaseAddress;
mEndPC += mLoadOffset; mEndPC += mBaseAddress;
// Create a sorted index of the index to work around linker bugs. // Create a sorted index of the index to work around linker bugs.
const EHEntry *startTable = const EHEntry *startTable =
reinterpret_cast<const EHEntry *>(mLoadOffset + exidxHdr->p_vaddr); reinterpret_cast<const EHEntry *>(mBaseAddress + exidxHdr->p_vaddr);
const EHEntry *endTable = const EHEntry *endTable =
reinterpret_cast<const EHEntry *>(mLoadOffset + exidxHdr->p_vaddr reinterpret_cast<const EHEntry *>(mBaseAddress + exidxHdr->p_vaddr
+ exidxHdr->p_memsz); + exidxHdr->p_memsz);
#ifdef HAVE_UNSORTED_EXIDX #ifdef HAVE_UNSORTED_EXIDX
mEntries.reserve(endTable - startTable); mEntries.reserve(endTable - startTable);