aboutsummaryrefslogtreecommitdiffstats
path: root/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp')
-rw-r--r--source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp67
1 files changed, 34 insertions, 33 deletions
diff --git a/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp b/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
index 62b0ad37a9fc..88a29f4a2672 100644
--- a/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
+++ b/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
@@ -125,7 +125,7 @@ DWARFMappedHash::Prologue::Prologue(dw_offset_t _die_base_offset)
: die_base_offset(_die_base_offset), atoms(), atom_mask(0),
min_hash_data_byte_size(0), hash_data_has_fixed_byte_size(true) {
// Define an array of DIE offsets by first defining an array, and then define
- // the atom type for the array, in this case we have an array of DIE offsets
+ // the atom type for the array, in this case we have an array of DIE offsets.
AppendAtom(eAtomTypeDIEOffset, DW_FORM_data4);
}
@@ -208,9 +208,10 @@ DWARFMappedHash::Prologue::Read(const lldb_private::DataExtractor &data,
const uint32_t atom_count = data.GetU32(&offset);
if (atom_count == 0x00060003u) {
- // Old format, deal with contents of old pre-release format
- while (data.GetU32(&offset))
+ // Old format, deal with contents of old pre-release format.
+ while (data.GetU32(&offset)) {
/* do nothing */;
+ }
// Hardcode to the only known value for now.
AppendAtom(eAtomTypeDIEOffset, DW_FORM_data4);
@@ -226,7 +227,7 @@ DWARFMappedHash::Prologue::Read(const lldb_private::DataExtractor &data,
size_t DWARFMappedHash::Prologue::GetByteSize() const {
// Add an extra count to the atoms size for the zero termination Atom that
- // gets written to disk
+ // gets written to disk.
return sizeof(die_base_offset) + sizeof(uint32_t) +
atoms.size() * sizeof(Atom);
}
@@ -286,7 +287,7 @@ bool DWARFMappedHash::Header::Read(const lldb_private::DWARFDataExtractor &data,
break;
default:
- // We can always skip atoms we don't know about
+ // We can always skip atoms we don't know about.
break;
}
}
@@ -308,8 +309,8 @@ DWARFMappedHash::MemoryTable::GetStringForKeyType(KeyType key) const {
bool DWARFMappedHash::MemoryTable::ReadHashData(uint32_t hash_data_offset,
HashData &hash_data) const {
lldb::offset_t offset = hash_data_offset;
- offset += 4; // Skip string table offset that contains offset of hash name in
- // .debug_str
+ // Skip string table offset that contains offset of hash name in .debug_str.
+ offset += 4;
const uint32_t count = m_data.GetU32(&offset);
if (count > 0) {
hash_data.resize(count);
@@ -335,7 +336,7 @@ DWARFMappedHash::MemoryTable::GetHashDataForName(
return eResultEndOfHashData;
// There definitely should be a string for this string offset, if there
- // isn't, there is something wrong, return and error
+ // isn't, there is something wrong, return and error.
const char *strp_cstr = m_string_table.PeekCStr(pair.key);
if (strp_cstr == nullptr) {
*hash_data_offset_ptr = UINT32_MAX;
@@ -345,9 +346,8 @@ DWARFMappedHash::MemoryTable::GetHashDataForName(
const uint32_t count = m_data.GetU32(hash_data_offset_ptr);
const size_t min_total_hash_data_size =
count * m_header.header_data.GetMinimumHashDataByteSize();
- if (count > 0 &&
- m_data.ValidOffsetForDataOfSize(*hash_data_offset_ptr,
- min_total_hash_data_size)) {
+ if (count > 0 && m_data.ValidOffsetForDataOfSize(*hash_data_offset_ptr,
+ min_total_hash_data_size)) {
// We have at least one HashData entry, and we have enough data to parse at
// least "count" HashData entries.
@@ -370,21 +370,22 @@ DWARFMappedHash::MemoryTable::GetHashDataForName(
if (match)
pair.value.push_back(die_info);
} else {
- // Something went wrong while reading the data
+ // Something went wrong while reading the data.
*hash_data_offset_ptr = UINT32_MAX;
return eResultError;
}
}
}
// Return the correct response depending on if the string matched or not...
- if (match)
- return eResultKeyMatch; // The key (cstring) matches and we have lookup
- // results!
- else
- return eResultKeyMismatch; // The key doesn't match, this function will
- // get called
- // again for the next key/value or the key terminator which in our case is
- // a zero .debug_str offset.
+ if (match) {
+ // The key (cstring) matches and we have lookup results!
+ return eResultKeyMatch;
+ } else {
+ // The key doesn't match, this function will get called again for the
+ // next key/value or the key terminator which in our case is a zero
+ // .debug_str offset.
+ return eResultKeyMismatch;
+ }
} else {
*hash_data_offset_ptr = UINT32_MAX;
return eResultError;
@@ -402,7 +403,7 @@ DWARFMappedHash::MemoryTable::AppendHashDataForRegularExpression(
return eResultEndOfHashData;
// There definitely should be a string for this string offset, if there
- // isn't, there is something wrong, return and error
+ // isn't, there is something wrong, return and error.
const char *strp_cstr = m_string_table.PeekCStr(pair.key);
if (strp_cstr == nullptr)
return eResultError;
@@ -410,9 +411,8 @@ DWARFMappedHash::MemoryTable::AppendHashDataForRegularExpression(
const uint32_t count = m_data.GetU32(hash_data_offset_ptr);
const size_t min_total_hash_data_size =
count * m_header.header_data.GetMinimumHashDataByteSize();
- if (count > 0 &&
- m_data.ValidOffsetForDataOfSize(*hash_data_offset_ptr,
- min_total_hash_data_size)) {
+ if (count > 0 && m_data.ValidOffsetForDataOfSize(*hash_data_offset_ptr,
+ min_total_hash_data_size)) {
const bool match = regex.Execute(llvm::StringRef(strp_cstr));
if (!match && m_header.header_data.HashDataHasFixedByteSize()) {
@@ -438,14 +438,15 @@ DWARFMappedHash::MemoryTable::AppendHashDataForRegularExpression(
}
}
// Return the correct response depending on if the string matched or not...
- if (match)
- return eResultKeyMatch; // The key (cstring) matches and we have lookup
- // results!
- else
- return eResultKeyMismatch; // The key doesn't match, this function will
- // get called
- // again for the next key/value or the key terminator which in our case is
- // a zero .debug_str offset.
+ if (match) {
+ // The key (cstring) matches and we have lookup results!
+ return eResultKeyMatch;
+ } else {
+ // The key doesn't match, this function will get called again for the
+ // next key/value or the key terminator which in our case is a zero
+ // .debug_str offset.
+ return eResultKeyMismatch;
+ }
} else {
*hash_data_offset_ptr = UINT32_MAX;
return eResultError;
@@ -466,7 +467,7 @@ size_t DWARFMappedHash::MemoryTable::AppendAllDIEsThatMatchingRegex(
if (prev_hash_data_offset == hash_data_offset)
break;
- // Check the result of getting our hash data
+ // Check the result of getting our hash data.
switch (hash_result) {
case eResultKeyMatch:
case eResultKeyMismatch: