summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-09-02 04:03:59 +0000
committerGreg Clayton <gclayton@apple.com>2011-09-02 04:03:59 +0000
commit9e315589e9724495ec21c2519e54b0c6c82ca53a (patch)
tree8d5d5e813d452928085dbe7958e37cde8063891d /lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
parenteea56f785e2377d4c95eb22e79d4539191589ca4 (diff)
downloadbcm5719-llvm-9e315589e9724495ec21c2519e54b0c6c82ca53a.tar.gz
bcm5719-llvm-9e315589e9724495ec21c2519e54b0c6c82ca53a.zip
Added alpha .debug_names and .debug_types support in the DWARF parser.
llvm-svn: 138996
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp45
1 files changed, 28 insertions, 17 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
index 6eb249bfc34..3ee478ebc56 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
@@ -38,16 +38,23 @@ HashedNameToDIE::HashedNameToDIE (SymbolFileDWARF *dwarf, const DataExtractor &d
m_data (data),
m_header ()
{
+}
+
+void
+HashedNameToDIE::Initialize()
+{
uint32_t offset = 0;
m_header.version = m_data.GetU16(&offset);
- m_header.hash_type = m_data.GetU8(&offset);
- m_header.hash_index_bitsize = m_data.GetU8(&offset);
- m_header.num_buckets = m_data.GetU32(&offset);
- m_header.num_hashes = m_data.GetU32(&offset);
- m_header.die_offset_base = m_data.GetU32(&offset);
+ if (m_header.version)
+ {
+ m_header.hash_type = m_data.GetU8(&offset);
+ m_header.hash_index_bitsize = m_data.GetU8(&offset);
+ m_header.num_buckets = m_data.GetU32(&offset);
+ m_header.num_hashes = m_data.GetU32(&offset);
+ m_header.die_offset_base = m_data.GetU32(&offset);
+ }
}
-
size_t
HashedNameToDIE::Find (const ConstString &name, DIEArray &die_ofsets) const
{
@@ -62,7 +69,7 @@ HashedNameToDIE::Find (const ConstString &name, DIEArray &die_ofsets) const
const uint32_t bucket_idx = name_hash % m_header.num_buckets;
// Calculate the offset for the bucket entry for the bucket index
- uint32_t offset = GetOffsetForBucket (bucket_idx);
+ uint32_t offset = GetOffsetOfBucketEntry (bucket_idx);
// Extract the bucket entry.
const uint32_t bucket_entry = m_data.GetU32 (&offset);
@@ -77,7 +84,7 @@ HashedNameToDIE::Find (const ConstString &name, DIEArray &die_ofsets) const
const uint32_t hash_count = bucket_entry >> m_header.hash_index_bitsize;
const uint32_t hash_end_idx = hash_idx + hash_count;
// Figure out the offset to the hash value by index
- uint32_t hash_offset = GetOffsetForHash (hash_idx);
+ uint32_t hash_offset = GetOffsetOfHashValue (hash_idx);
for (uint32_t idx = hash_idx; idx < hash_end_idx; ++idx)
{
// Extract the hash value and see if it matches our string
@@ -87,20 +94,24 @@ HashedNameToDIE::Find (const ConstString &name, DIEArray &die_ofsets) const
// The hash matches, but we still need to verify that the
// C string matches in case we have a hash collision. Figure
// out the offset for the data associated with this hash entry
- offset = GetOffsetForOffset (hash_idx);
+ offset = GetOffsetOfHashDataOffset (idx);
// Extract the first 32 bit value which is the .debug_str offset
// of the string we need
- const uint32_t str_offset = m_data.GetU32 (&offset);
+ uint32_t hash_data_offset = m_data.GetU32 (&offset);
+ const uint32_t str_offset = m_data.GetU32 (&hash_data_offset);
// Extract the C string and comapare it
const char *cstr_name = m_dwarf->get_debug_str_data().PeekCStr(str_offset);
- if (strcmp(name_cstr, cstr_name) == 0)
+ if (cstr_name)
{
- // We have a match, now extract the DIE count
- const uint32_t die_count = m_data.GetU32 (&offset);
- // Now extract "die_count" DIE offsets and put them into the
- // results
- for (uint32_t die_idx = 0; die_idx < die_count; ++die_idx)
- die_ofsets.push_back(m_data.GetU32 (&offset));
+ if (strcmp(name_cstr, cstr_name) == 0)
+ {
+ // We have a match, now extract the DIE count
+ const uint32_t die_count = m_data.GetU32 (&hash_data_offset);
+ // Now extract "die_count" DIE offsets and put them into the
+ // results
+ for (uint32_t die_idx = 0; die_idx < die_count; ++die_idx)
+ die_ofsets.push_back(m_data.GetU32 (&hash_data_offset));
+ }
}
}
}
OpenPOWER on IntegriCloud