1
- // ===-- LVELFReader .cpp -- -------------------------------------------------===//
1
+ // ===-- LVDWARFReader .cpp -------------------------------------------------===//
2
2
//
3
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
4
// See https://llvm.org/LICENSE.txt for license information.
5
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
//
9
- // This implements the LVELFReader class.
9
+ // This implements the LVDWARFReader class.
10
10
// It supports ELF, Mach-O and Wasm binary formats.
11
11
//
12
12
// ===----------------------------------------------------------------------===//
13
13
14
- #include " llvm/DebugInfo/LogicalView/Readers/LVELFReader .h"
14
+ #include " llvm/DebugInfo/LogicalView/Readers/LVDWARFReader .h"
15
15
#include " llvm/DebugInfo/DIContext.h"
16
16
#include " llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
17
17
#include " llvm/DebugInfo/DWARF/DWARFExpression.h"
@@ -27,9 +27,9 @@ using namespace llvm;
27
27
using namespace llvm ::object;
28
28
using namespace llvm ::logicalview;
29
29
30
- #define DEBUG_TYPE " ElfReader "
30
+ #define DEBUG_TYPE " DWARFReader "
31
31
32
- LVElement *LVELFReader ::createElement (dwarf::Tag Tag) {
32
+ LVElement *LVDWARFReader ::createElement (dwarf::Tag Tag) {
33
33
CurrentScope = nullptr ;
34
34
CurrentSymbol = nullptr ;
35
35
CurrentType = nullptr ;
@@ -243,8 +243,9 @@ LVElement *LVELFReader::createElement(dwarf::Tag Tag) {
243
243
return nullptr ;
244
244
}
245
245
246
- void LVELFReader::processOneAttribute (const DWARFDie &Die, LVOffset *OffsetPtr,
247
- const AttributeSpec &AttrSpec) {
246
+ void LVDWARFReader::processOneAttribute (const DWARFDie &Die,
247
+ LVOffset *OffsetPtr,
248
+ const AttributeSpec &AttrSpec) {
248
249
uint64_t OffsetOnEntry = *OffsetPtr;
249
250
DWARFUnit *U = Die.getDwarfUnit ();
250
251
const DWARFFormValue &FormValue =
@@ -515,8 +516,8 @@ void LVELFReader::processOneAttribute(const DWARFDie &Die, LVOffset *OffsetPtr,
515
516
}
516
517
}
517
518
518
- LVScope *LVELFReader ::processOneDie (const DWARFDie &InputDIE, LVScope *Parent,
519
- DWARFDie &SkeletonDie) {
519
+ LVScope *LVDWARFReader ::processOneDie (const DWARFDie &InputDIE, LVScope *Parent,
520
+ DWARFDie &SkeletonDie) {
520
521
// If the input DIE corresponds to the compile unit, it can be:
521
522
// a) Simple DWARF: a standard DIE. Ignore the skeleton DIE (is empty).
522
523
// b) Split DWARF: the DIE for the split DWARF. The skeleton is the DIE
@@ -688,8 +689,8 @@ LVScope *LVELFReader::processOneDie(const DWARFDie &InputDIE, LVScope *Parent,
688
689
return CurrentScope;
689
690
}
690
691
691
- void LVELFReader ::traverseDieAndChildren (DWARFDie &DIE, LVScope *Parent,
692
- DWARFDie &SkeletonDie) {
692
+ void LVDWARFReader ::traverseDieAndChildren (DWARFDie &DIE, LVScope *Parent,
693
+ DWARFDie &SkeletonDie) {
693
694
// Process the current DIE.
694
695
LVScope *Scope = processOneDie (DIE, Parent, SkeletonDie);
695
696
if (Scope) {
@@ -709,13 +710,13 @@ void LVELFReader::traverseDieAndChildren(DWARFDie &DIE, LVScope *Parent,
709
710
}
710
711
}
711
712
712
- void LVELFReader ::processLocationGaps () {
713
+ void LVDWARFReader ::processLocationGaps () {
713
714
if (options ().getAttributeAnyLocation ())
714
715
for (LVSymbol *Symbol : SymbolsWithLocations)
715
716
Symbol->fillLocationGaps ();
716
717
}
717
718
718
- void LVELFReader ::createLineAndFileRecords (
719
+ void LVDWARFReader ::createLineAndFileRecords (
719
720
const DWARFDebugLine::LineTable *Lines) {
720
721
if (!Lines)
721
722
return ;
@@ -772,8 +773,8 @@ void LVELFReader::createLineAndFileRecords(
772
773
}
773
774
}
774
775
775
- std::string LVELFReader ::getRegisterName (LVSmall Opcode,
776
- ArrayRef<uint64_t > Operands) {
776
+ std::string LVDWARFReader ::getRegisterName (LVSmall Opcode,
777
+ ArrayRef<uint64_t > Operands) {
777
778
// The 'prettyPrintRegisterOp' function uses the DWARFUnit to support
778
779
// DW_OP_regval_type. At this point we are operating on a logical view
779
780
// item, with no access to the underlying DWARF data used by LLVM.
@@ -800,7 +801,7 @@ std::string LVELFReader::getRegisterName(LVSmall Opcode,
800
801
return Stream.str ();
801
802
}
802
803
803
- Error LVELFReader ::createScopes () {
804
+ Error LVDWARFReader ::createScopes () {
804
805
LLVM_DEBUG ({
805
806
W.startLine () << " \n " ;
806
807
W.printString (" File" , Obj.getFileName ().str ());
@@ -980,11 +981,11 @@ Error LVELFReader::createScopes() {
980
981
}
981
982
982
983
// Get the location information for the associated attribute.
983
- void LVELFReader ::processLocationList (dwarf::Attribute Attr,
984
- const DWARFFormValue &FormValue,
985
- const DWARFDie &Die,
986
- uint64_t OffsetOnEntry,
987
- bool CallSiteLocation) {
984
+ void LVDWARFReader ::processLocationList (dwarf::Attribute Attr,
985
+ const DWARFFormValue &FormValue,
986
+ const DWARFDie &Die,
987
+ uint64_t OffsetOnEntry,
988
+ bool CallSiteLocation) {
988
989
989
990
auto ProcessLocationExpression = [&](const DWARFExpression &Expression) {
990
991
for (const DWARFExpression::Operation &Op : Expression)
@@ -1061,10 +1062,10 @@ void LVELFReader::processLocationList(dwarf::Attribute Attr,
1061
1062
}
1062
1063
}
1063
1064
1064
- void LVELFReader ::processLocationMember (dwarf::Attribute Attr,
1065
- const DWARFFormValue &FormValue,
1066
- const DWARFDie &Die,
1067
- uint64_t OffsetOnEntry) {
1065
+ void LVDWARFReader ::processLocationMember (dwarf::Attribute Attr,
1066
+ const DWARFFormValue &FormValue,
1067
+ const DWARFDie &Die,
1068
+ uint64_t OffsetOnEntry) {
1068
1069
// Check if the value is an integer constant.
1069
1070
if (FormValue.isFormClass (DWARFFormValue::FC_Constant))
1070
1071
// Add a record to hold a constant as location.
@@ -1076,8 +1077,8 @@ void LVELFReader::processLocationMember(dwarf::Attribute Attr,
1076
1077
}
1077
1078
1078
1079
// Update the current element with the reference.
1079
- void LVELFReader ::updateReference (dwarf::Attribute Attr,
1080
- const DWARFFormValue &FormValue) {
1080
+ void LVDWARFReader ::updateReference (dwarf::Attribute Attr,
1081
+ const DWARFFormValue &FormValue) {
1081
1082
// FIXME: We are assuming that at most one Reference (DW_AT_specification,
1082
1083
// DW_AT_abstract_origin, ...) and at most one Type (DW_AT_import, DW_AT_type)
1083
1084
// appear in any single DIE, but this may not be true.
@@ -1129,8 +1130,8 @@ void LVELFReader::updateReference(dwarf::Attribute Attr,
1129
1130
}
1130
1131
1131
1132
// Get an element given the DIE offset.
1132
- LVElement *LVELFReader ::getElementForOffset (LVOffset Offset, LVElement *Element ,
1133
- bool IsType) {
1133
+ LVElement *LVDWARFReader ::getElementForOffset (LVOffset Offset,
1134
+ LVElement *Element, bool IsType) {
1134
1135
auto Iter = ElementTable.try_emplace (Offset).first ;
1135
1136
// Update the element and all the references pointing to this element.
1136
1137
LVElementEntry &Entry = Iter->second ;
@@ -1143,7 +1144,7 @@ LVElement *LVELFReader::getElementForOffset(LVOffset Offset, LVElement *Element,
1143
1144
return Entry.Element ;
1144
1145
}
1145
1146
1146
- Error LVELFReader ::loadTargetInfo (const ObjectFile &Obj) {
1147
+ Error LVDWARFReader ::loadTargetInfo (const ObjectFile &Obj) {
1147
1148
// Detect the architecture from the object file. We usually don't need OS
1148
1149
// info to lookup a target and create register info.
1149
1150
Triple TT;
@@ -1162,7 +1163,7 @@ Error LVELFReader::loadTargetInfo(const ObjectFile &Obj) {
1162
1163
return loadGenericTargetInfo (TT.str (), FeaturesValue.getString ());
1163
1164
}
1164
1165
1165
- void LVELFReader ::mapRangeAddress (const ObjectFile &Obj) {
1166
+ void LVDWARFReader ::mapRangeAddress (const ObjectFile &Obj) {
1166
1167
for (auto Iter = Obj.symbol_begin (); Iter != Obj.symbol_end (); ++Iter) {
1167
1168
const SymbolRef &Symbol = *Iter;
1168
1169
@@ -1238,9 +1239,9 @@ void LVELFReader::mapRangeAddress(const ObjectFile &Obj) {
1238
1239
}
1239
1240
}
1240
1241
1241
- void LVELFReader ::sortScopes () { Root->sort (); }
1242
+ void LVDWARFReader ::sortScopes () { Root->sort (); }
1242
1243
1243
- void LVELFReader ::print (raw_ostream &OS) const {
1244
+ void LVDWARFReader ::print (raw_ostream &OS) const {
1244
1245
OS << " LVType\n " ;
1245
1246
LLVM_DEBUG (dbgs () << " CreateReaders\n " );
1246
1247
}
0 commit comments