003 File Manager
Current Path:
/usr/src/contrib/llvm-project/lldb/source/Plugins/SymbolFile/DWARF
usr
/
src
/
contrib
/
llvm-project
/
lldb
/
source
/
Plugins
/
SymbolFile
/
DWARF
/
📁
..
📄
AppleDWARFIndex.cpp
(7.64 KB)
📄
AppleDWARFIndex.h
(3.23 KB)
📄
DIERef.cpp
(768 B)
📄
DIERef.h
(2.46 KB)
📄
DWARFASTParser.h
(2.01 KB)
📄
DWARFASTParserClang.cpp
(138.9 KB)
📄
DWARFASTParserClang.h
(10.29 KB)
📄
DWARFAbbreviationDeclaration.cpp
(2.96 KB)
📄
DWARFAbbreviationDeclaration.h
(2.6 KB)
📄
DWARFAttribute.cpp
(1.86 KB)
📄
DWARFAttribute.h
(2.69 KB)
📄
DWARFBaseDIE.cpp
(3.4 KB)
📄
DWARFBaseDIE.h
(3.76 KB)
📄
DWARFCompileUnit.cpp
(3.88 KB)
📄
DWARFCompileUnit.h
(1.32 KB)
📄
DWARFContext.cpp
(5.27 KB)
📄
DWARFContext.h
(2.84 KB)
📄
DWARFDIE.cpp
(11.88 KB)
📄
DWARFDIE.h
(2.8 KB)
📄
DWARFDataExtractor.cpp
(980 B)
📄
DWARFDataExtractor.h
(1.25 KB)
📄
DWARFDebugAbbrev.cpp
(4.6 KB)
📄
DWARFDebugAbbrev.h
(2.92 KB)
📄
DWARFDebugArangeSet.cpp
(5.4 KB)
📄
DWARFDebugArangeSet.h
(2.35 KB)
📄
DWARFDebugAranges.cpp
(2.89 KB)
📄
DWARFDebugAranges.h
(1.6 KB)
📄
DWARFDebugInfo.cpp
(6.65 KB)
📄
DWARFDebugInfo.h
(2.84 KB)
📄
DWARFDebugInfoEntry.cpp
(28.41 KB)
📄
DWARFDebugInfoEntry.h
(7.26 KB)
📄
DWARFDebugMacro.cpp
(4.35 KB)
📄
DWARFDebugMacro.h
(1.74 KB)
📄
DWARFDebugRanges.cpp
(4.12 KB)
📄
DWARFDebugRanges.h
(1.41 KB)
📄
DWARFDeclContext.cpp
(3.13 KB)
📄
DWARFDeclContext.h
(2.53 KB)
📄
DWARFDefines.cpp
(2.6 KB)
📄
DWARFDefines.h
(1.09 KB)
📄
DWARFFormValue.cpp
(16.48 KB)
📄
DWARFFormValue.h
(3.27 KB)
📄
DWARFIndex.cpp
(3.17 KB)
📄
DWARFIndex.h
(3.76 KB)
📄
DWARFTypeUnit.cpp
(857 B)
📄
DWARFTypeUnit.h
(1.31 KB)
📄
DWARFUnit.cpp
(32.71 KB)
📄
DWARFUnit.h
(12.09 KB)
📄
DebugNamesDWARFIndex.cpp
(9.7 KB)
📄
DebugNamesDWARFIndex.h
(3.98 KB)
📄
HashedNameToDIE.cpp
(19.9 KB)
📄
HashedNameToDIE.h
(6.8 KB)
📄
LogChannelDWARF.cpp
(1.13 KB)
📄
LogChannelDWARF.h
(1.16 KB)
📄
ManualDWARFIndex.cpp
(16.36 KB)
📄
ManualDWARFIndex.h
(3.26 KB)
📄
NameToDIE.cpp
(2.7 KB)
📄
NameToDIE.h
(1.5 KB)
📄
SymbolFileDWARF.cpp
(143.94 KB)
📄
SymbolFileDWARF.h
(17.92 KB)
📄
SymbolFileDWARFDebugMap.cpp
(54.3 KB)
📄
SymbolFileDWARFDebugMap.h
(14.08 KB)
📄
SymbolFileDWARFDwo.cpp
(4.41 KB)
📄
SymbolFileDWARFDwo.h
(2.33 KB)
📄
SymbolFileDWARFProperties.td
(285 B)
📄
UniqueDWARFASTType.cpp
(2.84 KB)
📄
UniqueDWARFASTType.h
(3.04 KB)
Editing: DWARFDebugArangeSet.cpp
//===-- DWARFDebugArangeSet.cpp -------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "DWARFDebugArangeSet.h" #include "DWARFDataExtractor.h" #include "llvm/Object/Error.h" #include <cassert> using namespace lldb_private; DWARFDebugArangeSet::DWARFDebugArangeSet() : m_offset(DW_INVALID_OFFSET), m_header(), m_arange_descriptors() { m_header.length = 0; m_header.version = 0; m_header.cu_offset = 0; m_header.addr_size = 0; m_header.seg_size = 0; } void DWARFDebugArangeSet::Clear() { m_offset = DW_INVALID_OFFSET; m_header.length = 0; m_header.version = 0; m_header.cu_offset = 0; m_header.addr_size = 0; m_header.seg_size = 0; m_arange_descriptors.clear(); } llvm::Error DWARFDebugArangeSet::extract(const DWARFDataExtractor &data, lldb::offset_t *offset_ptr) { assert(data.ValidOffset(*offset_ptr)); m_arange_descriptors.clear(); m_offset = *offset_ptr; // 7.20 Address Range Table // // Each set of entries in the table of address ranges contained in the // .debug_aranges section begins with a header consisting of: a 4-byte // length containing the length of the set of entries for this compilation // unit, not including the length field itself; a 2-byte version identifier // containing the value 2 for DWARF Version 2; a 4-byte offset into // the.debug_infosection; a 1-byte unsigned integer containing the size in // bytes of an address (or the offset portion of an address for segmented // addressing) on the target system; and a 1-byte unsigned integer // containing the size in bytes of a segment descriptor on the target // system. This header is followed by a series of tuples. Each tuple // consists of an address and a length, each in the size appropriate for an // address on the target architecture. m_header.length = data.GetDWARFInitialLength(offset_ptr); m_header.version = data.GetU16(offset_ptr); m_header.cu_offset = data.GetDWARFOffset(offset_ptr); m_header.addr_size = data.GetU8(offset_ptr); m_header.seg_size = data.GetU8(offset_ptr); // Try to avoid reading invalid arange sets by making sure: // 1 - the version looks good // 2 - the address byte size looks plausible // 3 - the length seems to make sense // 4 - size looks plausible // 5 - the arange tuples do not contain a segment field if (m_header.version < 2 || m_header.version > 5) return llvm::make_error<llvm::object::GenericBinaryError>( "Invalid arange header version"); if (m_header.addr_size != 4 && m_header.addr_size != 8) return llvm::make_error<llvm::object::GenericBinaryError>( "Invalid arange header address size"); if (m_header.length == 0) return llvm::make_error<llvm::object::GenericBinaryError>( "Invalid arange header length"); if (!data.ValidOffset(m_offset + sizeof(m_header.length) + m_header.length - 1)) return llvm::make_error<llvm::object::GenericBinaryError>( "Invalid arange header length"); if (m_header.seg_size) return llvm::make_error<llvm::object::GenericBinaryError>( "segmented arange entries are not supported"); // The first tuple following the header in each set begins at an offset // that is a multiple of the size of a single tuple (that is, twice the // size of an address). The header is padded, if necessary, to the // appropriate boundary. const uint32_t header_size = *offset_ptr - m_offset; const uint32_t tuple_size = m_header.addr_size << 1; uint32_t first_tuple_offset = 0; while (first_tuple_offset < header_size) first_tuple_offset += tuple_size; *offset_ptr = m_offset + first_tuple_offset; Descriptor arangeDescriptor; static_assert(sizeof(arangeDescriptor.address) == sizeof(arangeDescriptor.length), "DWARFDebugArangeSet::Descriptor.address and " "DWARFDebugArangeSet::Descriptor.length must have same size"); while (data.ValidOffset(*offset_ptr)) { arangeDescriptor.address = data.GetMaxU64(offset_ptr, m_header.addr_size); arangeDescriptor.length = data.GetMaxU64(offset_ptr, m_header.addr_size); // Each set of tuples is terminated by a 0 for the address and 0 for // the length. if (!arangeDescriptor.address && !arangeDescriptor.length) return llvm::ErrorSuccess(); m_arange_descriptors.push_back(arangeDescriptor); } return llvm::make_error<llvm::object::GenericBinaryError>( "arange descriptors not terminated by null entry"); } class DescriptorContainsAddress { public: DescriptorContainsAddress(dw_addr_t address) : m_address(address) {} bool operator()(const DWARFDebugArangeSet::Descriptor &desc) const { return (m_address >= desc.address) && (m_address < (desc.address + desc.length)); } private: const dw_addr_t m_address; }; dw_offset_t DWARFDebugArangeSet::FindAddress(dw_addr_t address) const { DescriptorConstIter end = m_arange_descriptors.end(); DescriptorConstIter pos = std::find_if(m_arange_descriptors.begin(), end, // Range DescriptorContainsAddress(address)); // Predicate if (pos != end) return m_header.cu_offset; return DW_INVALID_OFFSET; }
Upload File
Create Folder