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) {} }; 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 @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -240,6 +241,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. + std::map VariableDieMap; + std::set RootsParsedForVariables; + using die_iterator_range = iterator_range::iterator>; @@ -322,6 +328,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 +445,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/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 @@ -1264,8 +1264,17 @@ DILineInfo Result; DWARFCompileUnit *CU = getCompileUnitForAddress(Address.Address); - if (!CU) + if (!CU) { + // Fallback to walking the .debug_info, looking for DW_TAG_variables. + for (const auto &CU : normal_units()) { + DWARFDie Die = CU->getVariableForAddress(Address.Address); + if (Die.isValid()) { + Result.FileName = Die.getDeclFile(FileLineInfoKind::AbsoluteFilePath); + Result.Line = Die.getDeclLine(); + } + } return Result; + } getFunctionNameAndStartLineForAddress( CU, Address.Address, Spec.FNKind, Spec.FLIKind, Result.FunctionName, 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,52 @@ return R->second.second; } +void DWARFUnit::updateVariableDieMap(DWARFDie Die) { + for (DWARFDie Child = Die.getFirstChild(); Child; Child = Child.getSibling()) + updateVariableDieMap(Child); + + if (Die.getTag() != DW_TAG_variable) + return; + + Expected Locations = + Die.getLocations(DW_AT_location); + if (!Locations) + 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(); + + if (RootsParsedForVariables.count(RootDie.getOffset()) == 0) { + updateVariableDieMap(RootDie); + RootsParsedForVariables.insert(RootDie.getOffset()); + } + + if (!VariableDieMap.count(Address)) + return DWARFDie(); + return VariableDieMap[Address]; +} + void DWARFUnit::getInlinedChainForAddress(uint64_t Address, SmallVectorImpl &InlinedChain) { 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->getLineInfoForAddress(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,528 @@ +## 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 0x38ec" "DATA 0x38a8" "DATA 0x4e8" "DATA 0x38e8" \ +# RUN: --obj=%t.so | FileCheck %s + +# CHECK: x +# CHECK-NEXT: 14572 4 +# CHECK-NEXT: /tmp/file.c:1 +# CHECK-EMPTY: +# CHECK-NEXT: y +# CHECK-NEXT: 14504 4 +# CHECK-NEXT: /tmp/file.c:2 +# CHECK-EMPTY: +# CHECK: /tmp/file.c:3 +# CHECK-EMPTY: +# CHECK-NEXT: f.y +# CHECK-NEXT: 14568 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 x; +## 2: int y = 2; +## 3: const char* string = "123456"; +## 4: void f() { +## 5: static int y; +## 6: } +## 7: +## ... then, one can get the offsets using `nm`, like `nm out.so | grep x`. +################################################################################ + +--- !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: 0x1550 + Align: 0x1000 + - Type: PT_LOAD + Flags: [ PF_W, PF_R ] + FirstSec: .ctors + LastSec: .got + VAddr: 0x2710 + Align: 0x1000 + - Type: PT_LOAD + Flags: [ PF_W, PF_R ] + FirstSec: .data + LastSec: .bss + VAddr: 0x38A0 + Align: 0x1000 + - Type: PT_DYNAMIC + Flags: [ PF_W, PF_R ] + FirstSec: .dynamic + LastSec: .dynamic + VAddr: 0x2730 + Align: 0x8 + - Type: PT_GNU_RELRO + Flags: [ PF_R ] + FirstSec: .ctors + LastSec: .got + VAddr: 0x2710 + - Type: PT_GNU_EH_FRAME + Flags: [ PF_R ] + FirstSec: .eh_frame_hdr + LastSec: .eh_frame_hdr + VAddr: 0x4F0 + 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: [ 0x1000000060000881 ] + HashBuckets: [ 0x5 ] + HashValues: [ 0x2B60A, 0x2B61E, 0x1C93AFFC, 0x2B61D ] + - Name: .hash + Type: SHT_HASH + Flags: [ SHF_ALLOC ] + Address: 0x374 + Link: .dynsym + AddressAlign: 0x4 + Bucket: [ 0, 0, 4, 8, 6, 0, 7, 0, 0 ] + Chain: [ 0, 0, 0, 2, 0, 0, 3, 1, 5 ] + - Name: .dynstr + Type: SHT_STRTAB + Flags: [ SHF_ALLOC ] + Address: 0x3C4 + AddressAlign: 0x1 + - Name: .rela.dyn + Type: SHT_RELA + Flags: [ SHF_ALLOC ] + Address: 0x440 + Link: .dynsym + AddressAlign: 0x8 + Relocations: + - Offset: 0x38A0 + Type: R_X86_64_RELATIVE + Addend: 14496 + - Offset: 0x38B0 + Type: R_X86_64_RELATIVE + Addend: 1256 + - Offset: 0x2880 + Symbol: __gmon_start__ + Type: R_X86_64_GLOB_DAT + - Offset: 0x2888 + Symbol: _ITM_deregisterTMCloneTable + Type: R_X86_64_GLOB_DAT + - Offset: 0x2890 + Symbol: _ITM_registerTMCloneTable + Type: R_X86_64_GLOB_DAT + - Offset: 0x2898 + Symbol: __cxa_finalize + Type: R_X86_64_GLOB_DAT + - Name: .rela.plt + Type: SHT_RELA + Flags: [ SHF_ALLOC, SHF_INFO_LINK ] + Address: 0x4D0 + Link: .dynsym + AddressAlign: 0x8 + Info: .got.plt + Relocations: + - Offset: 0x38D0 + Symbol: __cxa_finalize + Type: R_X86_64_JUMP_SLOT + - Name: .rodata + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ] + Address: 0x4E8 + AddressAlign: 0x1 + EntSize: 0x1 + Content: '31323334353600' + - Name: .eh_frame_hdr + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x4F0 + AddressAlign: 0x4 + Content: 011B033B14000000010000007011000030000000 + - Name: .eh_frame + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Address: 0x508 + AddressAlign: 0x8 + Content: 1400000000000000017A5200017810011B0C0708900100001C0000001C000000381100000600000000410E108602430D06410C070800000000000000 + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x1550 + AddressAlign: 0x10 + Content: 488D3D61230000488D055A2300004839F87415488B051E1300004885C07409FFE00F1F8000000000C30F1F8000000000488D3D31230000488D352A2300004829FE4889F048C1EE3F48C1F8034801C648D1FE7414488B05E51200004885C07408FFE0660F1F440000C30F1F8000000000F30F1EFA803D0D23000000757B5548833DC2120000004889E5415453740C488B3DBB220000E816010000488D052F110000488D1D301100004829C34989C4488B05DB22000048C1FB034883EB014839D87321660F1F4400004883C001488905BD22000041FF14C4488B05B22200004839D872E5E818FFFFFF5B415CC60596220000015DC30F1F4000C30F1F8000000000F30F1EFAE927FFFFFFCCCCCCCCCCCCCC554889E55DC3CCCCCCCCCCCCCCCCCCCCF30F1EFA488B05951000004883F8FF742F554889E553488D1D831000004883EC080F1F8000000000FFD0488B43F84883EB084883F8FF75F0488B5DF8C9C36690C3 + - Name: .init + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x16B4 + AddressAlign: 0x4 + Content: 4883EC08488B05C11100004885C07402FFD0E885FFFFFFE8A0FFFFFF4883C408C3 + - Name: .fini + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x16D8 + AddressAlign: 0x4 + Content: 4883EC08E8DFFEFFFF4883C408C3 + - Name: .plt + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Address: 0x16F0 + AddressAlign: 0x10 + Content: FF35CA210000FF25CC2100000F1F4000FF25CA2100006800000000E9E0FFFFFF + - Name: .ctors + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x2710 + AddressAlign: 0x8 + Content: FFFFFFFFFFFFFFFF0000000000000000 + - Name: .dtors + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x2720 + AddressAlign: 0x8 + Content: FFFFFFFFFFFFFFFF0000000000000000 + - Name: .dynamic + Type: SHT_DYNAMIC + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x2730 + Link: .dynstr + AddressAlign: 0x8 + Entries: + - Tag: DT_NEEDED + Value: 0x62 + - Tag: DT_RELA + Value: 0x440 + - Tag: DT_RELASZ + Value: 0x90 + - Tag: DT_RELAENT + Value: 0x18 + - Tag: DT_RELACOUNT + Value: 0x2 + - Tag: DT_JMPREL + Value: 0x4D0 + - Tag: DT_PLTRELSZ + Value: 0x18 + - Tag: DT_PLTGOT + Value: 0x38B8 + - Tag: DT_PLTREL + Value: 0x7 + - Tag: DT_SYMTAB + Value: 0x238 + - Tag: DT_SYMENT + Value: 0x18 + - Tag: DT_STRTAB + Value: 0x3C4 + - Tag: DT_STRSZ + Value: 0x78 + - Tag: DT_GNU_HASH + Value: 0x348 + - Tag: DT_HASH + Value: 0x374 + - Tag: DT_INIT + Value: 0x16B4 + - Tag: DT_FINI + Value: 0x16D8 + - 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: 0x2880 + AddressAlign: 0x8 + Content: '0000000000000000000000000000000000000000000000000000000000000000' + - Name: .data + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x38A0 + AddressAlign: 0x8 + Content: '000000000000000002000000000000000000000000000000' + - Name: .tm_clone_table + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x38B8 + AddressAlign: 0x8 + - Name: .got.plt + Type: SHT_PROGBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x38B8 + AddressAlign: 0x8 + Content: '3027000000000000000000000000000000000000000000000617000000000000' + - Name: .bss + Type: SHT_NOBITS + Flags: [ SHF_WRITE, SHF_ALLOC ] + Address: 0x38D8 + AddressAlign: 0x8 + Size: 0x18 + - Name: .comment + Type: SHT_PROGBITS + Flags: [ SHF_MERGE, SHF_STRINGS ] + AddressAlign: 0x1 + EntSize: 0x1 + Content: 636C616E672076657273696F6E2031352E302E30202868747470733A2F2F6769746875622E636F6D2F6C6C766D2F6C6C766D2D70726F6A6563742E676974206533333134643061353631643165393863343232643332323138373131636434323236373466323829004C696E6B65723A204C4C442031352E302E30004743433A202844656269616E2031312E322E302D3136292031312E322E300000 + - Name: .debug_abbrev + Type: SHT_PROGBITS + AddressAlign: 0x1 + Content: 011101252513050325721710171B25111B120673170000023400032549133F193A0B3B0B0218000003240003253E0B0B0B0000043400032549133A0B3B0B02186E25000005120003250B0B0000060F004913000007260049130000082E01111B1206401803253A0B3B0B3F190000093400032549133A0B3B0B0218000000 + - Name: .debug_info + Type: SHT_PROGBITS + AddressAlign: 0x1 + Content: 79000000050001080000000001000C000108000000000000000205060000000800000002032E000000000202A1000304050404053E000000000302A1010505050002064C000000000302A1020651000000075600000003070601080506000000015609000409032E000000000502A1030002082E000000000102A10400 + - Name: .debug_str_offsets + Type: SHT_PROGBITS + AddressAlign: 0x1 + Content: 2C00000005000000000000006B0000007D0000007700000079000000AA000000B4000000AF000000BB00000069000000 + - Name: .debug_line + Type: SHT_PROGBITS + AddressAlign: 0x1 + Content: 560000000500080037000000010101FB0E0D00010101010000000100000101011F010C00000003011F020F051E010000000000EF7E7F7123D685D941A6ACF81EF9FF19040000090260160000000000001505010A4C0202000101 + - 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: 0x2710 + - Name: __DTOR_LIST__ + Type: STT_OBJECT + Section: .dtors + Value: 0x2720 + - Name: __TMC_LIST__ + Type: STT_OBJECT + Section: .tm_clone_table + Value: 0x38B8 + - Name: deregister_tm_clones + Type: STT_FUNC + Section: .text + Value: 0x1550 + - Name: register_tm_clones + Type: STT_FUNC + Section: .text + Value: 0x1580 + - Name: __do_global_dtors_aux + Type: STT_FUNC + Section: .text + Value: 0x15C0 + - Name: completed.1 + Type: STT_OBJECT + Section: .bss + Value: 0x38D8 + Size: 0x1 + - Name: dtor_idx.0 + Type: STT_OBJECT + Section: .bss + Value: 0x38E0 + Size: 0x8 + - Name: frame_dummy + Type: STT_FUNC + Section: .text + Value: 0x1650 + - Name: __dso_handle + Type: STT_OBJECT + Section: .data + Value: 0x38A0 + Other: [ STV_HIDDEN ] + - Name: file.c + Type: STT_FILE + Index: SHN_ABS + - Name: f.y + Type: STT_OBJECT + Section: .bss + Value: 0x38E8 + Size: 0x4 + - Name: 'crtstuff.c (1)' + Type: STT_FILE + Index: SHN_ABS + - Name: __CTOR_END__ + Type: STT_OBJECT + Section: .ctors + Value: 0x2718 + - Name: __FRAME_END__ + Type: STT_OBJECT + Section: .eh_frame + Value: 0x508 + - Name: __do_global_ctors_aux + Type: STT_FUNC + Section: .text + Value: 0x1670 + - Name: __TMC_END__ + Type: STT_OBJECT + Section: .tm_clone_table + Value: 0x38B8 + Other: [ STV_HIDDEN ] + - Name: __DTOR_END__ + Type: STT_OBJECT + Section: .dtors + Value: 0x2728 + Other: [ STV_HIDDEN ] + - Name: _init + Type: STT_FUNC + Section: .init + Value: 0x16B4 + Other: [ STV_HIDDEN ] + - Name: _fini + Type: STT_FUNC + Section: .fini + Value: 0x16D8 + Other: [ STV_HIDDEN ] + - Name: _GLOBAL_OFFSET_TABLE_ + Section: .got.plt + Value: 0x38B8 + Other: [ STV_HIDDEN ] + - Name: _DYNAMIC + Section: .dynamic + Value: 0x2730 + 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: 0x1660 + Size: 0x6 + - Name: y + Type: STT_OBJECT + Section: .data + Binding: STB_GLOBAL + Value: 0x38A8 + Size: 0x4 + - Name: string + Type: STT_OBJECT + Section: .data + Binding: STB_GLOBAL + Value: 0x38B0 + Size: 0x8 + - Name: x + Type: STT_OBJECT + Section: .bss + Binding: STB_GLOBAL + Value: 0x38EC + 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: 0x1660 + Size: 0x6 + - Name: y + Type: STT_OBJECT + Section: .data + Binding: STB_GLOBAL + Value: 0x38A8 + Size: 0x4 + - Name: string + Type: STT_OBJECT + Section: .data + Binding: STB_GLOBAL + Value: 0x38B0 + Size: 0x8 + - Name: x + Type: STT_OBJECT + Section: .bss + Binding: STB_GLOBAL + Value: 0x38EC + Size: 0x4 +DWARF: + debug_str: + - 'clang version 15.0.0 (https://github.com/llvm/llvm-project.git e3314d0a561d1e98c422d32218711cd422674f28)' + - f + - '/tmp/file.c' + - y + - int + - '/usr/local/google/home/mitchp/llvm-build/opt' + - .str + - char + - string + - x + debug_addr: + - Length: 0x34 + Version: 0x5 + AddressSize: 0x8 + Entries: + - Address: 0x38A8 + - Address: 0x4E8 + - Address: 0x38B0 + - Address: 0x38E8 + - Address: 0x38EC + - Address: 0x1660 +... 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