/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/ELF/DWARF.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===- DWARF.h -----------------------------------------------*- C++ -*-===// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //===-------------------------------------------------------------------===// |
8 | | |
9 | | #ifndef LLD_ELF_DWARF_H |
10 | | #define LLD_ELF_DWARF_H |
11 | | |
12 | | #include "InputFiles.h" |
13 | | #include "llvm/ADT/STLExtras.h" |
14 | | #include "llvm/DebugInfo/DWARF/DWARFContext.h" |
15 | | #include "llvm/Object/ELF.h" |
16 | | |
17 | | namespace lld { |
18 | | namespace elf { |
19 | | |
20 | | class InputSection; |
21 | | |
22 | | struct LLDDWARFSection final : public llvm::DWARFSection { |
23 | | InputSectionBase *sec = nullptr; |
24 | | }; |
25 | | |
26 | | template <class ELFT> class LLDDwarfObj final : public llvm::DWARFObject { |
27 | | public: |
28 | | explicit LLDDwarfObj(ObjFile<ELFT> *obj); |
29 | | |
30 | | void forEachInfoSections( |
31 | 254 | llvm::function_ref<void(const llvm::DWARFSection &)> f) const override { |
32 | 254 | f(infoSection); |
33 | 254 | } lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::forEachInfoSections(llvm::function_ref<void (llvm::DWARFSection const&)>) const Line | Count | Source | 31 | 22 | llvm::function_ref<void(const llvm::DWARFSection &)> f) const override { | 32 | 22 | f(infoSection); | 33 | 22 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::forEachInfoSections(llvm::function_ref<void (llvm::DWARFSection const&)>) const Line | Count | Source | 31 | 2 | llvm::function_ref<void(const llvm::DWARFSection &)> f) const override { | 32 | 2 | f(infoSection); | 33 | 2 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::forEachInfoSections(llvm::function_ref<void (llvm::DWARFSection const&)>) const Line | Count | Source | 31 | 221 | llvm::function_ref<void(const llvm::DWARFSection &)> f) const override { | 32 | 221 | f(infoSection); | 33 | 221 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::forEachInfoSections(llvm::function_ref<void (llvm::DWARFSection const&)>) const Line | Count | Source | 31 | 9 | llvm::function_ref<void(const llvm::DWARFSection &)> f) const override { | 32 | 9 | f(infoSection); | 33 | 9 | } |
|
34 | | |
35 | 254 | const llvm::DWARFSection &getRangeSection() const override { |
36 | 254 | return rangeSection; |
37 | 254 | } lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getRangeSection() const Line | Count | Source | 35 | 22 | const llvm::DWARFSection &getRangeSection() const override { | 36 | 22 | return rangeSection; | 37 | 22 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getRangeSection() const Line | Count | Source | 35 | 2 | const llvm::DWARFSection &getRangeSection() const override { | 36 | 2 | return rangeSection; | 37 | 2 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getRangeSection() const Line | Count | Source | 35 | 221 | const llvm::DWARFSection &getRangeSection() const override { | 36 | 221 | return rangeSection; | 37 | 221 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getRangeSection() const Line | Count | Source | 35 | 9 | const llvm::DWARFSection &getRangeSection() const override { | 36 | 9 | return rangeSection; | 37 | 9 | } |
|
38 | | |
39 | 4 | const llvm::DWARFSection &getRnglistsSection() const override { |
40 | 4 | return rngListsSection; |
41 | 4 | } Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getRnglistsSection() const Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getRnglistsSection() const lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getRnglistsSection() const Line | Count | Source | 39 | 4 | const llvm::DWARFSection &getRnglistsSection() const override { | 40 | 4 | return rngListsSection; | 41 | 4 | } |
Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getRnglistsSection() const |
42 | | |
43 | 254 | const llvm::DWARFSection &getLineSection() const override { |
44 | 254 | return lineSection; |
45 | 254 | } lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getLineSection() const Line | Count | Source | 43 | 22 | const llvm::DWARFSection &getLineSection() const override { | 44 | 22 | return lineSection; | 45 | 22 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getLineSection() const Line | Count | Source | 43 | 2 | const llvm::DWARFSection &getLineSection() const override { | 44 | 2 | return lineSection; | 45 | 2 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getLineSection() const Line | Count | Source | 43 | 221 | const llvm::DWARFSection &getLineSection() const override { | 44 | 221 | return lineSection; | 45 | 221 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getLineSection() const Line | Count | Source | 43 | 9 | const llvm::DWARFSection &getLineSection() const override { | 44 | 9 | return lineSection; | 45 | 9 | } |
|
46 | | |
47 | 254 | const llvm::DWARFSection &getAddrSection() const override { |
48 | 254 | return addrSection; |
49 | 254 | } lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getAddrSection() const Line | Count | Source | 47 | 22 | const llvm::DWARFSection &getAddrSection() const override { | 48 | 22 | return addrSection; | 49 | 22 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getAddrSection() const Line | Count | Source | 47 | 2 | const llvm::DWARFSection &getAddrSection() const override { | 48 | 2 | return addrSection; | 49 | 2 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getAddrSection() const Line | Count | Source | 47 | 221 | const llvm::DWARFSection &getAddrSection() const override { | 48 | 221 | return addrSection; | 49 | 221 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getAddrSection() const Line | Count | Source | 47 | 9 | const llvm::DWARFSection &getAddrSection() const override { | 48 | 9 | return addrSection; | 49 | 9 | } |
|
50 | | |
51 | 21 | const llvm::DWARFSection &getGnuPubNamesSection() const override { |
52 | 21 | return gnuPubNamesSection; |
53 | 21 | } lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getGnuPubNamesSection() const Line | Count | Source | 51 | 1 | const llvm::DWARFSection &getGnuPubNamesSection() const override { | 52 | 1 | return gnuPubNamesSection; | 53 | 1 | } |
Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getGnuPubNamesSection() const lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getGnuPubNamesSection() const Line | Count | Source | 51 | 20 | const llvm::DWARFSection &getGnuPubNamesSection() const override { | 52 | 20 | return gnuPubNamesSection; | 53 | 20 | } |
Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getGnuPubNamesSection() const |
54 | | |
55 | 21 | const llvm::DWARFSection &getGnuPubTypesSection() const override { |
56 | 21 | return gnuPubTypesSection; |
57 | 21 | } lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getGnuPubTypesSection() const Line | Count | Source | 55 | 1 | const llvm::DWARFSection &getGnuPubTypesSection() const override { | 56 | 1 | return gnuPubTypesSection; | 57 | 1 | } |
Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getGnuPubTypesSection() const lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getGnuPubTypesSection() const Line | Count | Source | 55 | 20 | const llvm::DWARFSection &getGnuPubTypesSection() const override { | 56 | 20 | return gnuPubTypesSection; | 57 | 20 | } |
Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getGnuPubTypesSection() const |
58 | | |
59 | 0 | StringRef getFileName() const override { return ""; } Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getFileName() const Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getFileName() const Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getFileName() const Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getFileName() const |
60 | 253 | StringRef getAbbrevSection() const override { return abbrevSection; } lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getAbbrevSection() const Line | Count | Source | 60 | 21 | StringRef getAbbrevSection() const override { return abbrevSection; } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getAbbrevSection() const Line | Count | Source | 60 | 2 | StringRef getAbbrevSection() const override { return abbrevSection; } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getAbbrevSection() const Line | Count | Source | 60 | 221 | StringRef getAbbrevSection() const override { return abbrevSection; } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getAbbrevSection() const Line | Count | Source | 60 | 9 | StringRef getAbbrevSection() const override { return abbrevSection; } |
|
61 | 254 | StringRef getStringSection() const override { return strSection; } lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getStringSection() const Line | Count | Source | 61 | 22 | StringRef getStringSection() const override { return strSection; } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getStringSection() const Line | Count | Source | 61 | 2 | StringRef getStringSection() const override { return strSection; } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getStringSection() const Line | Count | Source | 61 | 221 | StringRef getStringSection() const override { return strSection; } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getStringSection() const Line | Count | Source | 61 | 9 | StringRef getStringSection() const override { return strSection; } |
|
62 | 6 | StringRef getLineStringSection() const override { return lineStringSection; } Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::getLineStringSection() const Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::getLineStringSection() const lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::getLineStringSection() const Line | Count | Source | 62 | 6 | StringRef getLineStringSection() const override { return lineStringSection; } |
Unexecuted instantiation: lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::getLineStringSection() const |
63 | | |
64 | 541 | bool isLittleEndian() const override { |
65 | 541 | return ELFT::TargetEndianness == llvm::support::little; |
66 | 541 | } lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, false> >::isLittleEndian() const Line | Count | Source | 64 | 45 | bool isLittleEndian() const override { | 65 | 45 | return ELFT::TargetEndianness == llvm::support::little; | 66 | 45 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, false> >::isLittleEndian() const Line | Count | Source | 64 | 4 | bool isLittleEndian() const override { | 65 | 4 | return ELFT::TargetEndianness == llvm::support::little; | 66 | 4 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)1, true> >::isLittleEndian() const Line | Count | Source | 64 | 474 | bool isLittleEndian() const override { | 65 | 474 | return ELFT::TargetEndianness == llvm::support::little; | 66 | 474 | } |
lld::elf::LLDDwarfObj<llvm::object::ELFType<(llvm::support::endianness)0, true> >::isLittleEndian() const Line | Count | Source | 64 | 18 | bool isLittleEndian() const override { | 65 | 18 | return ELFT::TargetEndianness == llvm::support::little; | 66 | 18 | } |
|
67 | | |
68 | | llvm::Optional<llvm::RelocAddrEntry> find(const llvm::DWARFSection &sec, |
69 | | uint64_t pos) const override; |
70 | | |
71 | | private: |
72 | | template <class RelTy> |
73 | | llvm::Optional<llvm::RelocAddrEntry> findAux(const InputSectionBase &sec, |
74 | | uint64_t pos, |
75 | | ArrayRef<RelTy> rels) const; |
76 | | |
77 | | LLDDWARFSection gnuPubNamesSection; |
78 | | LLDDWARFSection gnuPubTypesSection; |
79 | | LLDDWARFSection infoSection; |
80 | | LLDDWARFSection rangeSection; |
81 | | LLDDWARFSection rngListsSection; |
82 | | LLDDWARFSection lineSection; |
83 | | LLDDWARFSection addrSection; |
84 | | StringRef abbrevSection; |
85 | | StringRef strSection; |
86 | | StringRef lineStringSection; |
87 | | }; |
88 | | |
89 | | } // namespace elf |
90 | | } // namespace lld |
91 | | |
92 | | #endif |