diff --git a/llvm/include/llvm/DebugInfo/DIContext.h b/llvm/include/llvm/DebugInfo/DIContext.h --- a/llvm/include/llvm/DebugInfo/DIContext.h +++ b/llvm/include/llvm/DebugInfo/DIContext.h @@ -114,6 +114,8 @@ std::string Name; uint64_t Start = 0; uint64_t Size = 0; + std::string DeclFile; + uint64_t DeclLine = 0; DIGlobal() : Name(DILineInfo::BadString) {} }; @@ -239,6 +241,8 @@ virtual DILineInfo getLineInfoForAddress( object::SectionedAddress Address, DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0; + virtual DILineInfo + getLineInfoForDataAddress(object::SectionedAddress Address) = 0; virtual DILineInfoTable getLineInfoForAddressRange( object::SectionedAddress Address, uint64_t Size, DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0; diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h @@ -360,6 +360,8 @@ DILineInfo getLineInfoForAddress( object::SectionedAddress Address, DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; + DILineInfo + getLineInfoForDataAddress(object::SectionedAddress Address) override; DILineInfoTable getLineInfoForAddressRange( object::SectionedAddress Address, uint64_t Size, DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h @@ -9,6 +9,8 @@ #ifndef LLVM_DEBUGINFO_DWARF_DWARFUNIT_H #define LLVM_DEBUGINFO_DWARF_DWARFUNIT_H +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" @@ -27,6 +29,7 @@ #include #include #include +#include #include #include @@ -240,6 +243,11 @@ /// std::map::upper_bound for address range lookup. std::map> AddrDieMap; + /// Map from the location (interpreted DW_AT_location) of a DW_TAG_variable, + /// to the DIE. + DenseMap VariableDieMap; + DenseSet RootsParsedForVariables; + using die_iterator_range = iterator_range::iterator>; @@ -322,6 +330,9 @@ /// Recursively update address to Die map. void updateAddressDieMap(DWARFDie Die); + /// Recursively update address to variable Die map. + void updateVariableDieMap(DWARFDie Die); + void setRangesSection(const DWARFSection *RS, uint64_t Base) { RangeSection = RS; RangeSectionBase = Base; @@ -436,6 +447,10 @@ /// cleared. DWARFDie getSubroutineForAddress(uint64_t Address); + /// Returns variable DIE for the address provided. The pointer is alive as + /// long as parsed compile unit DIEs are not cleared. + DWARFDie getVariableForAddress(uint64_t Address); + /// getInlinedChainForAddress - fetches inlined chain for a given address. /// Returns empty chain if there is no subprogram containing address. The /// chain is valid as long as parsed compile unit DIEs are not cleared. diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBContext.h b/llvm/include/llvm/DebugInfo/PDB/PDBContext.h --- a/llvm/include/llvm/DebugInfo/PDB/PDBContext.h +++ b/llvm/include/llvm/DebugInfo/PDB/PDBContext.h @@ -45,6 +45,8 @@ DILineInfo getLineInfoForAddress( object::SectionedAddress Address, DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; + DILineInfo + getLineInfoForDataAddress(object::SectionedAddress Address) override; DILineInfoTable getLineInfoForAddressRange( object::SectionedAddress Address, uint64_t Size, DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -1033,7 +1033,19 @@ // First, get the offset of the compile unit. uint64_t CUOffset = getDebugAranges()->findAddress(Address); // Retrieve the compile unit. - return getCompileUnitForOffset(CUOffset); + DWARFCompileUnit *OffsetCU = getCompileUnitForOffset(CUOffset); + if (OffsetCU) + return OffsetCU; + + // Unfortunately, debug_aranges by default don't inclue global variables. If + // we failed to find the CU using aranges, try and search for variables as + // well. + for (std::unique_ptr &CU : compile_units()) { + if (DWARFDie Die = CU->getVariableForAddress(Address)) { + return static_cast(CU.get()); + } + } + return nullptr; } DWARFContext::DIEsForAddress DWARFContext::getDIEsForAddress(uint64_t Address) { @@ -1262,7 +1274,6 @@ DILineInfo DWARFContext::getLineInfoForAddress(object::SectionedAddress Address, DILineInfoSpecifier Spec) { DILineInfo Result; - DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); if (!CU) return Result; @@ -1277,6 +1288,22 @@ Spec.FLIKind, Result); } } + + return Result; +} + +DILineInfo +DWARFContext::getLineInfoForDataAddress(object::SectionedAddress Address) { + DILineInfo Result; + DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); + if (!CU) + return Result; + + if (DWARFDie Die = CU->getVariableForAddress(Address.Address)) { + Result.FileName = Die.getDeclFile(FileLineInfoKind::AbsoluteFilePath); + Result.Line = Die.getDeclLine(); + } + return Result; } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -23,6 +23,7 @@ #include "llvm/DebugInfo/DWARF/DWARFObject.h" #include "llvm/DebugInfo/DWARF/DWARFSection.h" #include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h" +#include "llvm/Object/ObjectFile.h" #include "llvm/Support/DataExtractor.h" #include "llvm/Support/Errc.h" #include "llvm/Support/Path.h" @@ -739,6 +740,58 @@ return R->second.second; } +void DWARFUnit::updateVariableDieMap(DWARFDie Die) { + for (DWARFDie Child : Die) { + if (isType(Child.getTag())) + continue; + updateVariableDieMap(Child); + } + + if (Die.getTag() != DW_TAG_variable) + return; + + Expected Locations = + Die.getLocations(DW_AT_location); + if (!Locations) { + // Missing DW_AT_location is fine here. + consumeError(Locations.takeError()); + return; + } + + for (const DWARFLocationExpression &Location : *Locations) { + DataExtractor Data(Location.Expr, /*IsLittleEndian=*/true, 8); + uint64_t DataOffset = 0; + uint8_t Operation = Data.getU8(&DataOffset); + if (Operation == dwarf::DW_OP_addr) { + uint64_t Pointer = Data.getAddress(&DataOffset); + VariableDieMap[Pointer] = Die; + return; + } + if (Operation == dwarf::DW_OP_addrx) { + uint64_t DebugAddrOffset = Data.getULEB128(&DataOffset); + Optional Pointer = + getAddrOffsetSectionItem(DebugAddrOffset); + if (Pointer) + VariableDieMap[Pointer->Address] = Die; + } + } +} + +DWARFDie DWARFUnit::getVariableForAddress(uint64_t Address) { + extractDIEsIfNeeded(false); + + auto RootDie = getUnitDIE(); + + auto RootLookup = RootsParsedForVariables.insert(RootDie.getOffset()); + if (RootLookup.second) + updateVariableDieMap(RootDie); + + auto it = VariableDieMap.find(Address); + if (it == VariableDieMap.end()) + return DWARFDie(); + return it->second; +} + void DWARFUnit::getInlinedChainForAddress(uint64_t Address, SmallVectorImpl &InlinedChain) { diff --git a/llvm/lib/DebugInfo/PDB/PDBContext.cpp b/llvm/lib/DebugInfo/PDB/PDBContext.cpp --- a/llvm/lib/DebugInfo/PDB/PDBContext.cpp +++ b/llvm/lib/DebugInfo/PDB/PDBContext.cpp @@ -64,6 +64,12 @@ return Result; } +DILineInfo +PDBContext::getLineInfoForDataAddress(object::SectionedAddress Address) { + // Unimplemented. + return DILineInfo(); +} + DILineInfoTable PDBContext::getLineInfoForAddressRange(object::SectionedAddress Address, uint64_t Size, diff --git a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp --- a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp +++ b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp @@ -206,6 +206,10 @@ Name = DILineInfo::Addr2LineBadString; OS << Name << "\n"; OS << Global.Start << " " << Global.Size << "\n"; + if (Global.DeclFile.empty()) + OS << "??:?\n"; + else + OS << Global.DeclFile << ":" << Global.DeclLine << "\n"; printFooter(); } diff --git a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp --- a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp +++ b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp @@ -327,6 +327,14 @@ std::string FileName; getNameFromSymbolTable(ModuleOffset.Address, Res.Name, Res.Start, Res.Size, FileName); + Res.DeclFile = FileName; + + // Try and get a better filename:lineno pair from the debuginfo, if present. + DILineInfo DL = DebugInfoContext->getLineInfoForDataAddress(ModuleOffset); + if (DL.Line != 0) { + Res.DeclFile = DL.FileName; + Res.DeclLine = DL.Line; + } return Res; } diff --git a/llvm/test/DebugInfo/Symbolize/ELF/data-command-symtab.yaml b/llvm/test/DebugInfo/Symbolize/ELF/data-command-symtab.yaml --- a/llvm/test/DebugInfo/Symbolize/ELF/data-command-symtab.yaml +++ b/llvm/test/DebugInfo/Symbolize/ELF/data-command-symtab.yaml @@ -7,12 +7,15 @@ # CHECK: func # CHECK-NEXT: 4096 1 +# CHECK-NEXT: ??:? # CHECK-EMPTY: # CHECK-NEXT: data # CHECK-NEXT: 8192 2 +# CHECK-NEXT: ??:? # CHECK-EMPTY: # CHECK-NEXT: notype # CHECK-NEXT: 8194 3 +# CHECK-NEXT: ??:? # CHECK-EMPTY: --- !ELF diff --git a/llvm/test/tools/llvm-symbolizer/data-location.s b/llvm/test/tools/llvm-symbolizer/data-location.s new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-symbolizer/data-location.s @@ -0,0 +1,539 @@ +## Show that when "DATA" is used with an address, it forces the found location +## to be symbolized as data, including the source information. + +# RUN: yaml2obj %s -o %t.so + +# RUN: llvm-symbolizer "DATA 0x38fc" "DATA 0x38b8" "DATA 0x4f8" "DATA 0x38f8" \ +# RUN: --obj=%t.so | FileCheck %s + +# CHECK: bss_global +# CHECK-NEXT: {{[0-9]+}} 4 +# CHECK-NEXT: /tmp/file.c:1 +# CHECK-EMPTY: +# CHECK-NEXT: data_global +# CHECK-NEXT: {{[0-9]+}} 4 +# CHECK-NEXT: /tmp/file.c:2 +# CHECK-EMPTY: +# CHECK-NEXT: ?? +# CHECK-NEXT: 0 0 +# CHECK: /tmp/file.c:3 +# CHECK-EMPTY: +# CHECK-NEXT: f.function_global +# CHECK-NEXT: {{[0-9]+}} 4 +# CHECK-NEXT: /tmp/file.c:5 +# CHECK-EMPTY: + +################################################################################ +## File below was generated using: +## $ clang -g -fuse-ld=lld -shared /tmp/file.c -o out.so && obj2yaml out.so +## ... with /tmp/file.c: +## 1: int bss_global; +## 2: int data_global = 2; +## 3: const char* string = "123456"; +## 4: void f() { +## 5: static int function_global; +## 6: } +## 7: +## ... then, one can get the offsets using `nm`, like: +## $ nm out.so | grep bss_global +## 00000000000038fc B bss_global +## For the address of the constant string, you need to find the relocation: +## $ nm out.so | grep string +## 00000000000038c0 D string +## $ llvm-objdump -R out.so | grep 38c0 +## 00000000000038c0 R_X86_64_RELATIVE *ABS*+0x4f8 # <-- 0x4f8 +################################################################################ + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_DYN + Machine: EM_X86_64 +ProgramHeaders: + - Type: PT_PHDR + Flags: [ PF_R ] + VAddr: 0x40 + Align: 0x8 + - Type: PT_LOAD + Flags: [ PF_R ] + FirstSec: .dynsym + LastSec: .eh_frame + Align: 0x1000 + - Type: PT_LOAD + Flags: [ PF_X, PF_R ] + FirstSec: .text + LastSec: .plt + VAddr: 0x1560 + Align: 0x1000 + - Type: PT_LOAD + Flags: [ PF_W, PF_R ] + FirstSec: .ctors + LastSec: .got + VAddr: 0x2720 + Align: 0x1000 + - Type: PT_LOAD + Flags: [ PF_W, PF_R ] + FirstSec: .data + LastSec: .bss + VAddr: 0x38B0 + Align: 0x1000 + - Type: PT_DYNAMIC + Flags: [ PF_W, PF_R ] + FirstSec: .dynamic + LastSec: .dynamic + VAddr: 0x2740 + Align: 0x8 + - Type: PT_GNU_RELRO + Flags: [ PF_R ] + FirstSec: .ctors + LastSec: .got + VAddr: 0x2720 + - Type: PT_GNU_EH_FRAME + Flags: [ PF_R ] + FirstSec: .eh_frame_hdr + LastSec: .eh_frame_hdr + VAddr: 0x500 + Align: 0x4 + - Type: PT_GNU_STACK + Flags: [ PF_W, PF_R ] + Align: 0x0 +Sections: + - Name: .dynsym + Type: SHT_DYNSYM + Flags: [ SHF_ALLOC ] + Address: 0x238 + Link: .dynstr + AddressAlign: 0x8 + - Name: .gnu.version + Type: SHT_GNU_versym + Flags: [ SHF_ALLOC ] + Address: 0x310 + Link: .dynsym + AddressAlign: 0x2 + Entries: [ 0, 1, 1, 1, 2, 1, 1, 1, 1 ] + - Name: .gnu.version_r + Type: SHT_GNU_verneed + Flags: [ SHF_ALLOC ] + Address: 0x324 + Link: .dynstr + AddressAlign: 0x4 + Dependencies: + - Version: 1 + File: libc.so.6 + Entries: + - Name: GLIBC_2.2.5 + Hash: 157882997 + Flags: 0 + Other: 2 + - Name: .gnu.hash + Type: SHT_GNU_HASH + Flags: [ SHF_ALLOC ] + Address: 0x348 + Link: .dynsym + AddressAlign: 0x8 + Header: + SymNdx: 0x5 + Shift2: 0x1A + BloomFilter: [ 0x1001800021000881 ] + HashBuckets: [ 0x5 ] + HashValues: [ 0x2B60A, 0x61F7372E, 0x1C93AFFC, 0xC033991D ] + - Name: .hash + Type: SHT_HASH + Flags: [ SHF_ALLOC ] + Address: 0x374 + Link: .dynsym + AddressAlign: 0x4 + Bucket: [ 0, 8, 4, 5, 3, 6, 7, 0, 0 ] + Chain: [ 0, 0, 0, 2, 0, 0, 0, 1, 0 ] + - Name: .dynstr + Type: SHT_STRTAB + Flags: [ SHF_ALLOC ] + Address: 0x3C4 + AddressAlign: 0x1 + - Name: .rela.dyn + Type: SHT_RELA + Flags: [ SHF_ALLOC ] + Address: 0x450 + Link: .dynsym + AddressAlign: 0x8 + Relocations: + - Offset: 0x38B0 + Type: R_X86_64_RELATIVE + Addend: 14512 + - Offset: 0x38C0 + Type: R_X86_64_RELATIVE + Addend: 1272 + - Offset: 0x2890 + Symbol: __gmon_start__ + Type: R_X86_64_GLOB_DAT + - Offset: 0x2898 + Symbol: _ITM_deregisterTMCloneTable + Type: R_X86_64_GLOB_DAT + - Offset: 0x28A0 + Symbol: _ITM_registerTMCloneTable + Type: R_X86_64_GLOB_DAT + - Offset: 0x28A8 + Symbol: __cxa_finalize + Type: R_X86_64_GLOB_DAT + - Name: .rela.plt + Type: SHT_RELA + Flags: [ SHF_ALLOC, SHF_INFO_LINK ] + Address: 0x4E0 + Link: .dynsym + AddressAlign: 0x8 + Info: .got.plt + Relocations: + - Offset: 0x38E0 + Symbol: __cxa_finalize + Type: R_X86_64_JUMP_SLOT + - Name: .rodata + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ] + Address: 0x4F8 + AddressAlign: 0x1 + EntSize: 0x1 + Content: '31323334353600' + - Name: .eh_frame_hdr + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x500 + AddressAlign: 0x4 + Content: 011B033B14000000010000007011000030000000 + - Name: .eh_frame + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x518 + AddressAlign: 0x8 + Content: 1400000000000000017A5200017810011B0C0708900100001C0000001C000000381100000600000000410E108602430D06410C070800000000000000 + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x1560 + AddressAlign: 0x10 + Content: 488D3D61230000488D055A2300004839F87415488B051E1300004885C07409FFE00F1F8000000000C30F1F8000000000488D3D31230000488D352A2300004829FE4889F048C1EE3F48C1F8034801C648D1FE7414488B05E51200004885C07408FFE0660F1F440000C30F1F8000000000F30F1EFA803D0D23000000757B5548833DC2120000004889E5415453740C488B3DBB220000E816010000488D052F110000488D1D301100004829C34989C4488B05DB22000048C1FB034883EB014839D87321660F1F4400004883C001488905BD22000041FF14C4488B05B22200004839D872E5E818FFFFFF5B415CC60596220000015DC30F1F4000C30F1F8000000000F30F1EFAE927FFFFFFCCCCCCCCCCCCCC554889E55DC3CCCCCCCCCCCCCCCCCCCCF30F1EFA488B05951000004883F8FF742F554889E553488D1D831000004883EC080F1F8000000000FFD0488B43F84883EB084883F8FF75F0488B5DF8C9C36690C3 + - Name: .init + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x16C4 + AddressAlign: 0x4 + Content: 4883EC08488B05C11100004885C07402FFD0E885FFFFFFE8A0FFFFFF4883C408C3 + - Name: .fini + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x16E8 + AddressAlign: 0x4 + Content: 4883EC08E8DFFEFFFF4883C408C3 + - Name: .plt + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x1700 + AddressAlign: 0x10 + Content: FF35CA210000FF25CC2100000F1F4000FF25CA2100006800000000E9E0FFFFFF + - Name: .ctors + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x2720 + AddressAlign: 0x8 + Content: FFFFFFFFFFFFFFFF0000000000000000 + - Name: .dtors + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x2730 + AddressAlign: 0x8 + Content: FFFFFFFFFFFFFFFF0000000000000000 + - Name: .dynamic + Type: SHT_DYNAMIC + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x2740 + Link: .dynstr + AddressAlign: 0x8 + Entries: + - Tag: DT_NEEDED + Value: 0x75 + - Tag: DT_RELA + Value: 0x450 + - Tag: DT_RELASZ + Value: 0x90 + - Tag: DT_RELAENT + Value: 0x18 + - Tag: DT_RELACOUNT + Value: 0x2 + - Tag: DT_JMPREL + Value: 0x4E0 + - Tag: DT_PLTRELSZ + Value: 0x18 + - Tag: DT_PLTGOT + Value: 0x38C8 + - Tag: DT_PLTREL + Value: 0x7 + - Tag: DT_SYMTAB + Value: 0x238 + - Tag: DT_SYMENT + Value: 0x18 + - Tag: DT_STRTAB + Value: 0x3C4 + - Tag: DT_STRSZ + Value: 0x8B + - Tag: DT_GNU_HASH + Value: 0x348 + - Tag: DT_HASH + Value: 0x374 + - Tag: DT_INIT + Value: 0x16C4 + - Tag: DT_FINI + Value: 0x16E8 + - Tag: DT_VERSYM + Value: 0x310 + - Tag: DT_VERNEED + Value: 0x324 + - Tag: DT_VERNEEDNUM + Value: 0x1 + - Tag: DT_NULL + Value: 0x0 + - Name: .got + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x2890 + AddressAlign: 0x8 + Content: '0000000000000000000000000000000000000000000000000000000000000000' + - Name: .data + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x38B0 + AddressAlign: 0x8 + Content: '000000000000000002000000000000000000000000000000' + - Name: .tm_clone_table + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x38C8 + AddressAlign: 0x8 + - Name: .got.plt + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x38C8 + AddressAlign: 0x8 + Content: '4027000000000000000000000000000000000000000000001617000000000000' + - Name: .bss + Type: SHT_NOBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x38E8 + AddressAlign: 0x8 + Size: 0x18 + - Name: .comment + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x1 + EntSize: 0x1 + Content: 4C696E6B65723A204C4C442031352E302E30004743433A202844656269616E2031312E322E302D3136292031312E322E3000636C616E672076657273696F6E2031352E302E30202868747470733A2F2F6769746875622E636F6D2F6C6C766D2F6C6C766D2D70726F6A6563742E6769742035393765646631323134653439366637646133623739343963366365613637366461373935613136290000 + - Name: .debug_abbrev + Type: SHT_PROGBITS + AddressAlign: 0x1 + Content: 011101252513050325721710171B25111B120673170000023400032549133F193A0B3B0B0218000003240003253E0B0B0B0000043400032549133A0B3B0B02186E25000005120003250B0B0000060F004913000007260049130000082E01111B1206401803253A0B3B0B3F190000093400032549133A0B3B0B0218000000 + - Name: .debug_info + Type: SHT_PROGBITS + AddressAlign: 0x1 + Content: 79000000050001080000000001000C000108000000000000000205060000000800000002032E000000000202A1000304050404053E000000000302A1010505050002064C000000000302A102065100000007560000000307060108050600000001560A000409082E000000000502A1030002092E000000000102A10400 + - Name: .debug_str_offsets + Type: SHT_PROGBITS + AddressAlign: 0x1 + Content: 300000000500000067000000020000001E0000000E0000001A0000004B0000006000000050000000D00000005500000000000000 + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x1 + Content: 560000000500080037000000010101FB0E0D00010101010000000100000101011F010C00000003011F020F051E0100000000005C255051B5CC180C68FB36EF08C909AF040000090270160000000000001505010A4C0202000101 + - Name: .debug_line_str + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x1 + EntSize: 0x1 + Content: 2F746D702F66696C652E63002F7573722F6C6F63616C2F676F6F676C652F686F6D652F6D69746368702F6C6C766D2D6275696C642F6F707400 +Symbols: + - Name: crtstuff.c + Type: STT_FILE + Index: SHN_ABS + - Name: __CTOR_LIST__ + Type: STT_OBJECT + Section: .ctors + Value: 0x2720 + - Name: __DTOR_LIST__ + Type: STT_OBJECT + Section: .dtors + Value: 0x2730 + - Name: __TMC_LIST__ + Type: STT_OBJECT + Section: .tm_clone_table + Value: 0x38C8 + - Name: deregister_tm_clones + Type: STT_FUNC + Section: .text + Value: 0x1560 + - Name: register_tm_clones + Type: STT_FUNC + Section: .text + Value: 0x1590 + - Name: __do_global_dtors_aux + Type: STT_FUNC + Section: .text + Value: 0x15D0 + - Name: completed.1 + Type: STT_OBJECT + Section: .bss + Value: 0x38E8 + Size: 0x1 + - Name: dtor_idx.0 + Type: STT_OBJECT + Section: .bss + Value: 0x38F0 + Size: 0x8 + - Name: frame_dummy + Type: STT_FUNC + Section: .text + Value: 0x1660 + - Name: __dso_handle + Type: STT_OBJECT + Section: .data + Value: 0x38B0 + Other: [ STV_HIDDEN ] + - Name: file.c + Type: STT_FILE + Index: SHN_ABS + - Name: f.function_global + Type: STT_OBJECT + Section: .bss + Value: 0x38F8 + Size: 0x4 + - Name: 'crtstuff.c (1)' + Type: STT_FILE + Index: SHN_ABS + - Name: __CTOR_END__ + Type: STT_OBJECT + Section: .ctors + Value: 0x2728 + - Name: __FRAME_END__ + Type: STT_OBJECT + Section: .eh_frame + Value: 0x518 + - Name: __do_global_ctors_aux + Type: STT_FUNC + Section: .text + Value: 0x1680 + - Name: __TMC_END__ + Type: STT_OBJECT + Section: .tm_clone_table + Value: 0x38C8 + Other: [ STV_HIDDEN ] + - Name: __DTOR_END__ + Type: STT_OBJECT + Section: .dtors + Value: 0x2738 + Other: [ STV_HIDDEN ] + - Name: _init + Type: STT_FUNC + Section: .init + Value: 0x16C4 + Other: [ STV_HIDDEN ] + - Name: _fini + Type: STT_FUNC + Section: .fini + Value: 0x16E8 + Other: [ STV_HIDDEN ] + - Name: _GLOBAL_OFFSET_TABLE_ + Section: .got.plt + Value: 0x38C8 + Other: [ STV_HIDDEN ] + - Name: _DYNAMIC + Section: .dynamic + Value: 0x2740 + Other: [ STV_HIDDEN ] + - Name: __gmon_start__ + Binding: STB_WEAK + - Name: _ITM_deregisterTMCloneTable + Binding: STB_WEAK + - Name: _ITM_registerTMCloneTable + Binding: STB_WEAK + - Name: __cxa_finalize + Type: STT_FUNC + Binding: STB_WEAK + - Name: f + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + Value: 0x1670 + Size: 0x6 + - Name: data_global + Type: STT_OBJECT + Section: .data + Binding: STB_GLOBAL + Value: 0x38B8 + Size: 0x4 + - Name: string + Type: STT_OBJECT + Section: .data + Binding: STB_GLOBAL + Value: 0x38C0 + Size: 0x8 + - Name: bss_global + Type: STT_OBJECT + Section: .bss + Binding: STB_GLOBAL + Value: 0x38FC + Size: 0x4 +DynamicSymbols: + - Name: __gmon_start__ + Binding: STB_WEAK + - Name: _ITM_deregisterTMCloneTable + Binding: STB_WEAK + - Name: _ITM_registerTMCloneTable + Binding: STB_WEAK + - Name: __cxa_finalize + Type: STT_FUNC + Binding: STB_WEAK + - Name: f + Type: STT_FUNC + Section: .text + Binding: STB_GLOBAL + Value: 0x1670 + Size: 0x6 + - Name: data_global + Type: STT_OBJECT + Section: .data + Binding: STB_GLOBAL + Value: 0x38B8 + Size: 0x4 + - Name: string + Type: STT_OBJECT + Section: .data + Binding: STB_GLOBAL + Value: 0x38C0 + Size: 0x8 + - Name: bss_global + Type: STT_OBJECT + Section: .bss + Binding: STB_GLOBAL + Value: 0x38FC + Size: 0x4 +DWARF: + debug_str: + - f + - '/tmp/file.c' + - data_global + - int + - '/usr/local/google/home/mitchp/llvm-build/opt' + - .str + - char + - bss_global + - string + - 'clang version 15.0.0 (https://github.com/llvm/llvm-project.git 597edf1214e496f7da3b7949c6cea676da795a16)' + - function_global + debug_addr: + - Length: 0x34 + Version: 0x5 + AddressSize: 0x8 + Entries: + - Address: 0x38B8 + - Address: 0x4F8 + - Address: 0x38C0 + - Address: 0x38F8 + - Address: 0x38FC + - Address: 0x1670 diff --git a/llvm/test/tools/llvm-symbolizer/data.s b/llvm/test/tools/llvm-symbolizer/data.s --- a/llvm/test/tools/llvm-symbolizer/data.s +++ b/llvm/test/tools/llvm-symbolizer/data.s @@ -7,9 +7,12 @@ # CHECK: d1 # CHECK-NEXT: 0 8 +# CHECK-NEXT: ??:? # CHECK-EMPTY: # CHECK-NEXT: d2 # CHECK-NEXT: 8 4 +# CHECK-NEXT: ??:? +# CHECK-EMPTY: d1: .quad 0x1122334455667788