1- // ===-- LVELFReader .cpp -- -------------------------------------------------===//
1+ // ===-- LVDWARFReader .cpp -------------------------------------------------===//
22//
33// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44// See https://llvm.org/LICENSE.txt for license information.
55// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66//
77// ===----------------------------------------------------------------------===//
88//
9- // This implements the LVELFReader class.
9+ // This implements the LVDWARFReader class.
1010// It supports ELF, Mach-O and Wasm binary formats.
1111//
1212// ===----------------------------------------------------------------------===//
1313
14- #include " llvm/DebugInfo/LogicalView/Readers/LVELFReader .h"
14+ #include " llvm/DebugInfo/LogicalView/Readers/LVDWARFReader .h"
1515#include " llvm/DebugInfo/DIContext.h"
1616#include " llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
1717#include " llvm/DebugInfo/DWARF/DWARFExpression.h"
@@ -27,9 +27,9 @@ using namespace llvm;
2727using namespace llvm ::object;
2828using namespace llvm ::logicalview;
2929
30- #define DEBUG_TYPE " ElfReader "
30+ #define DEBUG_TYPE " DWARFReader "
3131
32- LVElement *LVELFReader ::createElement (dwarf::Tag Tag) {
32+ LVElement *LVDWARFReader ::createElement (dwarf::Tag Tag) {
3333 CurrentScope = nullptr ;
3434 CurrentSymbol = nullptr ;
3535 CurrentType = nullptr ;
@@ -243,8 +243,9 @@ LVElement *LVELFReader::createElement(dwarf::Tag Tag) {
243243 return nullptr ;
244244}
245245
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) {
248249 uint64_t OffsetOnEntry = *OffsetPtr;
249250 DWARFUnit *U = Die.getDwarfUnit ();
250251 const DWARFFormValue &FormValue =
@@ -515,8 +516,8 @@ void LVELFReader::processOneAttribute(const DWARFDie &Die, LVOffset *OffsetPtr,
515516 }
516517}
517518
518- LVScope *LVELFReader ::processOneDie (const DWARFDie &InputDIE, LVScope *Parent,
519- DWARFDie &SkeletonDie) {
519+ LVScope *LVDWARFReader ::processOneDie (const DWARFDie &InputDIE, LVScope *Parent,
520+ DWARFDie &SkeletonDie) {
520521 // If the input DIE corresponds to the compile unit, it can be:
521522 // a) Simple DWARF: a standard DIE. Ignore the skeleton DIE (is empty).
522523 // 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,
688689 return CurrentScope;
689690}
690691
691- void LVELFReader ::traverseDieAndChildren (DWARFDie &DIE, LVScope *Parent,
692- DWARFDie &SkeletonDie) {
692+ void LVDWARFReader ::traverseDieAndChildren (DWARFDie &DIE, LVScope *Parent,
693+ DWARFDie &SkeletonDie) {
693694 // Process the current DIE.
694695 LVScope *Scope = processOneDie (DIE, Parent, SkeletonDie);
695696 if (Scope) {
@@ -709,13 +710,13 @@ void LVELFReader::traverseDieAndChildren(DWARFDie &DIE, LVScope *Parent,
709710 }
710711}
711712
712- void LVELFReader ::processLocationGaps () {
713+ void LVDWARFReader ::processLocationGaps () {
713714 if (options ().getAttributeAnyLocation ())
714715 for (LVSymbol *Symbol : SymbolsWithLocations)
715716 Symbol->fillLocationGaps ();
716717}
717718
718- void LVELFReader ::createLineAndFileRecords (
719+ void LVDWARFReader ::createLineAndFileRecords (
719720 const DWARFDebugLine::LineTable *Lines) {
720721 if (!Lines)
721722 return ;
@@ -772,8 +773,8 @@ void LVELFReader::createLineAndFileRecords(
772773 }
773774}
774775
775- std::string LVELFReader ::getRegisterName (LVSmall Opcode,
776- ArrayRef<uint64_t > Operands) {
776+ std::string LVDWARFReader ::getRegisterName (LVSmall Opcode,
777+ ArrayRef<uint64_t > Operands) {
777778 // The 'prettyPrintRegisterOp' function uses the DWARFUnit to support
778779 // DW_OP_regval_type. At this point we are operating on a logical view
779780 // item, with no access to the underlying DWARF data used by LLVM.
@@ -800,7 +801,7 @@ std::string LVELFReader::getRegisterName(LVSmall Opcode,
800801 return Stream.str ();
801802}
802803
803- Error LVELFReader ::createScopes () {
804+ Error LVDWARFReader ::createScopes () {
804805 LLVM_DEBUG ({
805806 W.startLine () << " \n " ;
806807 W.printString (" File" , Obj.getFileName ().str ());
@@ -980,11 +981,11 @@ Error LVELFReader::createScopes() {
980981}
981982
982983// 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) {
988989
989990 auto ProcessLocationExpression = [&](const DWARFExpression &Expression) {
990991 for (const DWARFExpression::Operation &Op : Expression)
@@ -1061,10 +1062,10 @@ void LVELFReader::processLocationList(dwarf::Attribute Attr,
10611062 }
10621063}
10631064
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) {
10681069 // Check if the value is an integer constant.
10691070 if (FormValue.isFormClass (DWARFFormValue::FC_Constant))
10701071 // Add a record to hold a constant as location.
@@ -1076,8 +1077,8 @@ void LVELFReader::processLocationMember(dwarf::Attribute Attr,
10761077}
10771078
10781079// 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) {
10811082 // FIXME: We are assuming that at most one Reference (DW_AT_specification,
10821083 // DW_AT_abstract_origin, ...) and at most one Type (DW_AT_import, DW_AT_type)
10831084 // appear in any single DIE, but this may not be true.
@@ -1129,8 +1130,8 @@ void LVELFReader::updateReference(dwarf::Attribute Attr,
11291130}
11301131
11311132// 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) {
11341135 auto Iter = ElementTable.try_emplace (Offset).first ;
11351136 // Update the element and all the references pointing to this element.
11361137 LVElementEntry &Entry = Iter->second ;
@@ -1143,7 +1144,7 @@ LVElement *LVELFReader::getElementForOffset(LVOffset Offset, LVElement *Element,
11431144 return Entry.Element ;
11441145}
11451146
1146- Error LVELFReader ::loadTargetInfo (const ObjectFile &Obj) {
1147+ Error LVDWARFReader ::loadTargetInfo (const ObjectFile &Obj) {
11471148 // Detect the architecture from the object file. We usually don't need OS
11481149 // info to lookup a target and create register info.
11491150 Triple TT;
@@ -1162,7 +1163,7 @@ Error LVELFReader::loadTargetInfo(const ObjectFile &Obj) {
11621163 return loadGenericTargetInfo (TT.str (), FeaturesValue.getString ());
11631164}
11641165
1165- void LVELFReader ::mapRangeAddress (const ObjectFile &Obj) {
1166+ void LVDWARFReader ::mapRangeAddress (const ObjectFile &Obj) {
11661167 for (auto Iter = Obj.symbol_begin (); Iter != Obj.symbol_end (); ++Iter) {
11671168 const SymbolRef &Symbol = *Iter;
11681169
@@ -1238,9 +1239,9 @@ void LVELFReader::mapRangeAddress(const ObjectFile &Obj) {
12381239 }
12391240}
12401241
1241- void LVELFReader ::sortScopes () { Root->sort (); }
1242+ void LVDWARFReader ::sortScopes () { Root->sort (); }
12421243
1243- void LVELFReader ::print (raw_ostream &OS) const {
1244+ void LVDWARFReader ::print (raw_ostream &OS) const {
12441245 OS << " LVType\n " ;
12451246 LLVM_DEBUG (dbgs () << " CreateReaders\n " );
12461247}
0 commit comments