-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[llvm-gsymutil] Option --symtab-file to specify a separate binary #79898
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-debuginfo Author: kusmour (kusmour) ChangesSummary: NOTE: Not supporting this flag for Test Plan:
Patch is 67.58 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/79898.diff 4 Files Affected:
diff --git a/llvm/test/tools/llvm-gsymutil/X86/elf-dwarf-only.yaml b/llvm/test/tools/llvm-gsymutil/X86/elf-dwarf-only.yaml
new file mode 100644
index 000000000000000..31d6ce4183aabc9
--- /dev/null
+++ b/llvm/test/tools/llvm-gsymutil/X86/elf-dwarf-only.yaml
@@ -0,0 +1,689 @@
+## Test loading ELF files with only DWARF.
+## First we make the ELF file from yaml,
+## then we convert the ELF file to GSYM,
+## then we do lookups on the newly created .gsym
+
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-gsymutil --convert %t -o %t.gsym 2>&1 | FileCheck %s --check-prefix=CONVERT
+# RUN: llvm-gsymutil --address 0x00000000004011e0 %t.gsym | FileCheck %s --check-prefix=LOOKUP
+
+# CONVERT: Input file: {{.*\.yaml\.tmp}}
+# CONVERT: Output file (x86_64): {{.*\.yaml\.tmp\.gsym}}
+# CONVERT: Loaded 2 functions from DWARF.
+# CONVERT: Loaded 0 functions from symbol table.
+# CONVERT: Pruned 0 functions, ended with 2 total
+
+# LOOKUP: Looking up addresses in "{{.*\.yaml\.tmp\.gsym}}":
+# LOOKUP: 0x00000000004011e0: main @ /tmp/test_gsymutil/main.cpp
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_EXEC
+ Machine: EM_X86_64
+ Entry: 0x4010B0
+ProgramHeaders:
+ - Type: PT_PHDR
+ Flags: [ PF_R ]
+ VAddr: 0x400040
+ Align: 0x8
+ - Type: PT_INTERP
+ Flags: [ PF_R ]
+ FirstSec: .interp
+ LastSec: .interp
+ VAddr: 0x400318
+ - Type: PT_LOAD
+ Flags: [ PF_R ]
+ FirstSec: .interp
+ LastSec: .rela.plt
+ VAddr: 0x400000
+ Align: 0x1000
+ - Type: PT_LOAD
+ Flags: [ PF_X, PF_R ]
+ FirstSec: .init
+ LastSec: .fini
+ VAddr: 0x401000
+ Align: 0x1000
+ - Type: PT_LOAD
+ Flags: [ PF_R ]
+ FirstSec: .rodata
+ LastSec: .eh_frame
+ VAddr: 0x402000
+ Align: 0x1000
+ - Type: PT_LOAD
+ Flags: [ PF_W, PF_R ]
+ FirstSec: .init_array
+ LastSec: .bss
+ VAddr: 0x403DA8
+ Align: 0x1000
+ - Type: PT_DYNAMIC
+ Flags: [ PF_W, PF_R ]
+ FirstSec: .dynamic
+ LastSec: .dynamic
+ VAddr: 0x403DC0
+ Align: 0x8
+ - Type: PT_NOTE
+ Flags: [ PF_R ]
+ FirstSec: .note.gnu.property
+ LastSec: .note.gnu.property
+ VAddr: 0x400338
+ Align: 0x8
+ - Type: PT_NOTE
+ Flags: [ PF_R ]
+ FirstSec: .note.gnu.build-id
+ LastSec: .note.ABI-tag
+ VAddr: 0x400358
+ Align: 0x4
+ - Type: PT_GNU_PROPERTY
+ Flags: [ PF_R ]
+ FirstSec: .note.gnu.property
+ LastSec: .note.gnu.property
+ VAddr: 0x400338
+ Align: 0x8
+ - Type: PT_GNU_EH_FRAME
+ Flags: [ PF_R ]
+ FirstSec: .eh_frame_hdr
+ LastSec: .eh_frame_hdr
+ VAddr: 0x402034
+ Align: 0x4
+ - Type: PT_GNU_STACK
+ Flags: [ PF_W, PF_R ]
+ Align: 0x10
+ - Type: PT_GNU_RELRO
+ Flags: [ PF_R ]
+ FirstSec: .init_array
+ LastSec: .got
+ VAddr: 0x403DA8
+Sections:
+ - Name: .interp
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ Address: 0x400318
+ AddressAlign: 0x1
+ Content: 2F6C696236342F6C642D6C696E75782D7838362D36342E736F2E3200
+ - Name: .note.gnu.property
+ Type: SHT_NOTE
+ Flags: [ SHF_ALLOC ]
+ Address: 0x400338
+ AddressAlign: 0x8
+ Notes:
+ - Name: GNU
+ Desc: 028000C0040000000300000000000000
+ Type: NT_GNU_PROPERTY_TYPE_0
+ - Name: .note.gnu.build-id
+ Type: SHT_NOTE
+ Flags: [ SHF_ALLOC ]
+ Address: 0x400358
+ AddressAlign: 0x4
+ Notes:
+ - Name: GNU
+ Desc: 6E3474EA595AB65F323A92D034BA2EA01E807B91
+ Type: NT_PRPSINFO
+ - Name: .note.ABI-tag
+ Type: SHT_NOTE
+ Flags: [ SHF_ALLOC ]
+ Address: 0x40037C
+ AddressAlign: 0x4
+ Notes:
+ - Name: GNU
+ Desc: '00000000030000000200000000000000'
+ Type: NT_VERSION
+ - Name: .gnu.hash
+ Type: SHT_GNU_HASH
+ Flags: [ SHF_ALLOC ]
+ Address: 0x4003A0
+ Link: .dynsym
+ AddressAlign: 0x8
+ Header:
+ SymNdx: 0xA
+ Shift2: 0x6
+ BloomFilter: [ 0x10000100100000 ]
+ HashBuckets: [ 0xA, 0x0 ]
+ HashValues: [ 0x9F4FD20, 0x430C9815 ]
+ - Name: .dynsym
+ Type: SHT_DYNSYM
+ Flags: [ SHF_ALLOC ]
+ Address: 0x4003C8
+ Link: .dynstr
+ AddressAlign: 0x8
+ - Name: .dynstr
+ Type: SHT_STRTAB
+ Flags: [ SHF_ALLOC ]
+ Address: 0x4004E8
+ AddressAlign: 0x1
+ - Name: .gnu.version
+ Type: SHT_GNU_versym
+ Flags: [ SHF_ALLOC ]
+ Address: 0x400660
+ Link: .dynsym
+ AddressAlign: 0x2
+ Entries: [ 0, 3, 4, 2, 2, 2, 1, 1, 1, 2, 2, 2 ]
+ - Name: .gnu.version_r
+ Type: SHT_GNU_verneed
+ Flags: [ SHF_ALLOC ]
+ Address: 0x400678
+ Link: .dynstr
+ AddressAlign: 0x8
+ Dependencies:
+ - Version: 1
+ File: libc.so.6
+ Entries:
+ - Name: GLIBC_2.2.5
+ Hash: 157882997
+ Flags: 0
+ Other: 4
+ - Name: GLIBC_2.34
+ Hash: 110530996
+ Flags: 0
+ Other: 3
+ - Version: 1
+ File: 'libstdc++.so.6'
+ Entries:
+ - Name: GLIBCXX_3.4
+ Hash: 143796596
+ Flags: 0
+ Other: 2
+ - Name: .rela.dyn
+ Type: SHT_RELA
+ Flags: [ SHF_ALLOC ]
+ Address: 0x4006C8
+ Link: .dynsym
+ AddressAlign: 0x8
+ Relocations:
+ - Offset: 0x403FC0
+ Symbol: __libc_start_main
+ Type: R_X86_64_GLOB_DAT
+ - Offset: 0x403FC8
+ Symbol: _ITM_deregisterTMCloneTable
+ Type: R_X86_64_GLOB_DAT
+ - Offset: 0x403FD0
+ Symbol: __gmon_start__
+ Type: R_X86_64_GLOB_DAT
+ - Offset: 0x403FD8
+ Symbol: _ITM_registerTMCloneTable
+ Type: R_X86_64_GLOB_DAT
+ - Offset: 0x403FE0
+ Symbol: _ZNSt8ios_base4InitD1Ev
+ Type: R_X86_64_GLOB_DAT
+ - Offset: 0x404040
+ Symbol: _ZSt4cout
+ Type: R_X86_64_COPY
+ - Name: .rela.plt
+ Type: SHT_RELA
+ Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
+ Address: 0x400758
+ Link: .dynsym
+ AddressAlign: 0x8
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x404000
+ Symbol: _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
+ Type: R_X86_64_JUMP_SLOT
+ - Offset: 0x404008
+ Symbol: __cxa_atexit
+ Type: R_X86_64_JUMP_SLOT
+ - Offset: 0x404010
+ Symbol: _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
+ Type: R_X86_64_JUMP_SLOT
+ - Offset: 0x404018
+ Symbol: _ZNSolsEPFRSoS_E
+ Type: R_X86_64_JUMP_SLOT
+ - Offset: 0x404020
+ Symbol: _ZNSt8ios_base4InitC1Ev
+ Type: R_X86_64_JUMP_SLOT
+ - Name: .init
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x401000
+ AddressAlign: 0x4
+ Offset: 0x1000
+ Content: F30F1EFA4883EC08488B05C12F00004885C07402FFD04883C408C3
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x401020
+ AddressAlign: 0x10
+ EntSize: 0x10
+ Content: FF35CA2F0000FF25CC2F00000F1F4000FF25CA2F00006800000000E9E0FFFFFFFF25C22F00006801000000E9D0FFFFFFFF25BA2F00006802000000E9C0FFFFFFFF25B22F00006803000000E9B0FFFFFFFF25AA2F00006804000000E9A0FFFFFF
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x401080
+ AddressAlign: 0x10
+ Content: F30F1EFA53488D1DC53000004889DFE8DCFFFFFF488B3D452F00004889DE5B488D15620F0000E995FFFFFF0F1F440000F30F1EFA31ED4989D15E4889E24883E4F050544531C031C948C7C7E0114000FF15EB2E0000F4662E0F1F840000000000F30F1EFAC3662E0F1F84000000000090488D3D392F0000488D05322F00004839F87415488B05BE2E00004885C07409FFE00F1F8000000000C30F1F8000000000488D3D092F0000488D35022F00004829FE4889F048C1EE3F48C1F8034801C648D1FE7414488B058D2E00004885C07408FFE0660F1F440000C30F1F8000000000F30F1EFA803DE52F0000007513554889E5E87AFFFFFFC605D32F0000015DC390C366662E0F1F8400000000000F1F4000F30F1EFAEB8A662E0F1F840000000000554889E548BF404040000000000048BE1020400000000000E893FEFFFF4889C748BE3010400000000000E891FEFFFF5DC36666666666662E0F1F840000000000554889E54883EC10C745FC0000000048BF404040000000000048BE1C20400000000000E848FEFFFF4889C748BE3010400000000000E846FEFFFFE881FFFFFF48BF404040000000000048BE2820400000000000E818FEFFFF4889C748BE3010400000000000E816FEFFFF31C04883C4105DC3662E0F1F8400000000000F1F4000F30F1EFAC3
+ - Name: .fini
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x401268
+ AddressAlign: 0x4
+ Content: F30F1EFA4883EC084883C408C3
+ - Name: .rodata
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ Address: 0x402000
+ AddressAlign: 0x8
+ Offset: 0x2000
+ Content: 010002000000000000000000000000005468697320697320666F6F0068656C6C6F20776F726C6400616674657220666F6F00
+ - Name: .eh_frame_hdr
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ Address: 0x402034
+ AddressAlign: 0x4
+ Content: 011B033B4000000007000000ECEFFFFF840000004CF0FFFF000100007CF0FFFF5C000000ACF0FFFF700000006CF1FFFFAC000000ACF1FFFFCC0000002CF2FFFFEC000000
+ - Name: .eh_frame
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ Address: 0x402078
+ AddressAlign: 0x8
+ Content: 1400000000000000017A5200017810011B0C070890010000100000001C00000018F0FFFF2600000000440710100000003000000034F0FFFF0500000000000000240000004400000060EFFFFF60000000000E10460E184A0F0B770880003F1A3B2A332422000000001C0000006C000000B8F0FFFF3100000000410E108602430D066C0C07080000001C0000008C000000D8F0FFFF7200000000410E108602430D06026D0C0708000010000000AC00000038F1FFFF050000000000000018000000C000000044EFFFFF2B00000000450E1083025A0E0800000000000000
+ - Name: .init_array
+ Type: SHT_INIT_ARRAY
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x403DA8
+ AddressAlign: 0x8
+ EntSize: 0x8
+ Offset: 0x2DA8
+ Content: '80104000000000009011400000000000'
+ - Name: .fini_array
+ Type: SHT_FINI_ARRAY
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x403DB8
+ AddressAlign: 0x8
+ EntSize: 0x8
+ Content: '6011400000000000'
+ - Name: .dynamic
+ Type: SHT_DYNAMIC
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x403DC0
+ Link: .dynstr
+ AddressAlign: 0x8
+ Entries:
+ - Tag: DT_NEEDED
+ Value: 0x123
+ - Tag: DT_NEEDED
+ Value: 0x132
+ - Tag: DT_NEEDED
+ Value: 0x13C
+ - Tag: DT_NEEDED
+ Value: 0x14A
+ - Tag: DT_INIT
+ Value: 0x401000
+ - Tag: DT_FINI
+ Value: 0x401268
+ - Tag: DT_INIT_ARRAY
+ Value: 0x403DA8
+ - Tag: DT_INIT_ARRAYSZ
+ Value: 0x10
+ - Tag: DT_FINI_ARRAY
+ Value: 0x403DB8
+ - Tag: DT_FINI_ARRAYSZ
+ Value: 0x8
+ - Tag: DT_GNU_HASH
+ Value: 0x4003A0
+ - Tag: DT_STRTAB
+ Value: 0x4004E8
+ - Tag: DT_SYMTAB
+ Value: 0x4003C8
+ - Tag: DT_STRSZ
+ Value: 0x177
+ - Tag: DT_SYMENT
+ Value: 0x18
+ - Tag: DT_DEBUG
+ Value: 0x0
+ - Tag: DT_PLTGOT
+ Value: 0x403FE8
+ - Tag: DT_PLTRELSZ
+ Value: 0x78
+ - Tag: DT_PLTREL
+ Value: 0x7
+ - Tag: DT_JMPREL
+ Value: 0x400758
+ - Tag: DT_RELA
+ Value: 0x4006C8
+ - Tag: DT_RELASZ
+ Value: 0x90
+ - Tag: DT_RELAENT
+ Value: 0x18
+ - Tag: DT_VERNEED
+ Value: 0x400678
+ - Tag: DT_VERNEEDNUM
+ Value: 0x2
+ - Tag: DT_VERSYM
+ Value: 0x400660
+ - Tag: DT_NULL
+ Value: 0x0
+ - Tag: DT_NULL
+ Value: 0x0
+ - Tag: DT_NULL
+ Value: 0x0
+ - Tag: DT_NULL
+ Value: 0x0
+ - Tag: DT_NULL
+ Value: 0x0
+ - Tag: DT_NULL
+ Value: 0x0
+ - Name: .got
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x403FC0
+ AddressAlign: 0x8
+ EntSize: 0x8
+ Content: '00000000000000000000000000000000000000000000000000000000000000000000000000000000'
+ - Name: .got.plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x403FE8
+ AddressAlign: 0x8
+ EntSize: 0x8
+ Content: C03D4000000000000000000000000000000000000000000036104000000000004610400000000000561040000000000066104000000000007610400000000000
+ - Name: .data
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x404028
+ AddressAlign: 0x1
+ Content: '00000000'
+ - Name: .bss
+ Type: SHT_NOBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Address: 0x404040
+ AddressAlign: 0x40
+ Offset: 0x302C
+ Size: 0x118
+ - Name: .comment
+ Type: SHT_PROGBITS
+ Flags: [ SHF_MERGE, SHF_STRINGS ]
+ AddressAlign: 0x1
+ EntSize: 0x1
+ Content: 4743433A2028474E55292031312E342E312032303233303630352028526564204861742031312E342E312D3229004743433A2028474E55292031332E322E312032303233313131302028526564204861742031332E322E312D352900636C616E672076657273696F6E2031372E302E31202843656E744F532031372E302E312D322E656C392900
+ - Name: .gnu.build.attributes
+ Type: SHT_NOTE
+ Address: 0x406158
+ AddressAlign: 0x4
+ Notes:
+ - Name: "GA$\x013a1"
+ Desc: B010400000000000D610400000000000
+ Type: NT_GNU_BUILD_ATTRIBUTE_OPEN
+ - Name: "GA$\x013a1"
+ Desc: E510400000000000E510400000000000
+ Type: NT_GNU_BUILD_ATTRIBUTE_OPEN
+ - Name: "GA$\x013a1"
+ Desc: '00104000000000001610400000000000'
+ Type: NT_GNU_BUILD_ATTRIBUTE_OPEN
+ - Name: "GA$\x013a1"
+ Desc: '68124000000000007012400000000000'
+ Type: NT_GNU_BUILD_ATTRIBUTE_OPEN
+ - Name: "GA$\x013a1"
+ Desc: F0104000000000009611400000000000
+ Type: NT_GNU_BUILD_ATTRIBUTE_OPEN
+ - Name: "GA$\x013a1"
+ Desc: '65124000000000006512400000000000'
+ Type: NT_GNU_BUILD_ATTRIBUTE_OPEN
+ - Name: "GA$\x013a1"
+ Desc: '65124000000000006512400000000000'
+ Type: NT_GNU_BUILD_ATTRIBUTE_OPEN
+ - Name: "GA$\x013a1"
+ Desc: 16104000000000001B10400000000000
+ Type: NT_GNU_BUILD_ATTRIBUTE_OPEN
+ - Name: "GA$\x013a1"
+ Desc: '70124000000000007512400000000000'
+ Type: NT_GNU_BUILD_ATTRIBUTE_OPEN
+ - Name: .debug_info
+ Type: SHT_PROGBITS
+ AddressAlign: 0x1
+ Content: 1219000004000000000008010000000021002B0000000000000034000000A011400000000000B2000000023B000000010509031020400000000000034700000004530000000C00054C0000000602060000060107470000000807023B000000010909031C20400000000000027C000000010B09032820400000000000034700000004530000000A0008A011400000000000310000000156B2070000BA070000010409E011400000000000720000000156BE0700000108CC0600000A5B0000000B04407A0600000B048DE60600000B048FF10600000B0490030700000B04912A0700000B04925C0700000B0493730700000B0494990700000B0495B00700000B0496C80700000B0497E40700000B0498F60700000B0499020800000B049A440800000B049B650800000B049C810800000B049DAC0800000B049EC30800000B04A0D50800000B04A2F20800000B04A30E0900000B04A4250900000B04A6770900000B04A9970900000B04ACB80900000B04AED80900000B04B0EF0900000B04B20A0A00000B04B3300A00000B04B4460A00000B04B55C0A00000B04B6720A00000B04B7880A00000B04B89E0A00000B04B9D30A00000B04BAE40A00000B04BBFF0A00000B04BC1A0B00000B04BD350B00000B04BE600B00000B04BF760B00000B04C19E0B00000B04C3BC0B00000B04C4D70B00000B04C5FA0B00000B04C6160C00000B04C7310C00000B04C8430C00000B04C95F0C00000B04CA7B0C00000B04CB970C00000B04CCB30C00000B04CDC60C00000B04CEDD0C00000B04CFF30C00000B04D0090D00000B04D11F0D00000B04D2350D00000C040B01E90D00000C040C01070E00000C040D012A0E00000C041B019E0B00000C041E01770900000C042101B80900000C042401EF0900000C042801E90D00000C042901070E00000C042A012A0E00000A160300000D180300000B0955D40200000E74030000A803000009E60F4D0E00000F4D0E000000000B0942AA02000010260300006203000009510FAA020000000B09F3B60200000B0A35520E00000B0A36570E00000B0A376D0E00000B0D407D0E00000B0D418E0E00000B0D429F0E00000B0D43B00E00000B0D44C10E00000B0D45D20E00000B0D46E30E00000B0D47F40E00000B0D48050F00000B0D49160F00000B0D4A270F00000B0D4B380F00000B0D4C490F00000B0D575A0F000011450400000B1034780F00000B11838A0F00000B1184960F00000B1186BF0F00000B1188C70F00000B118ADE0F00000B118DF60F00000B1190081000000B1191191000000B11922A1000000B11933B1000000B1194881000000B11959F1000000B1196B61000000B1197C41000000B1198D21000000B1199E41000000B119AF61000000B119B0D1100000B119D1F1100000B119E361100000B119F521100000B11A16E1100000B11A48B1100000B11A7991100000B11A8A51100000B11A9BC1100000B11AACA1100000B11ABEA1100000B11AC051200000B11AD201200000B11AF321200000B11B04E1200000B11F4651200000B11F68E1200000B11F89C1200000B11F9AB0D00000B11FAAE1200000B11FCC51200000B11FD0C1300000B11FED61200000B11FFF11200000C110001221300000B1362381300000B1363431300000B13655E1300000B1366711300000B1367821300000B1368941300000B1369A61300000B136AB71300000B136BC91300000B136CEF1300000B136D0B1400000B136E211400000B136F391400000B1370501400000B1371671400000B13728D1400000B1373A91400000B1374C51400000B1375E11400000B1376021500000B1377141500000B13783A1500000B13794C1500000B...
[truncated]
|
Summary: There are cases where separate debuginfo file only contains DWARF and symbol table exists in the executable. Offer a flag to specify a separate file for llvm-gsymutil to extract symbol table from. NOTE: Not supporting this flag for `MachOUniversalBinary` yet, as dSYM usually contains both Test Plan: Added FileCheck tests ``` ./bin/llvm-lit -sv llvm/test/tools/llvm-gsymutil/X86/elf-dwarf-only.yaml ./bin/llvm-lit -sv llvm/test/tools/llvm-gsymutil/X86/elf-symtab.yaml ```
0393fd7
to
0b0570e
Compare
@@ -35,3 +35,6 @@ defm address : Eq<"address", "Lookup an address in a GSYM file">; | |||
def addresses_from_stdin : | |||
FF<"addresses-from-stdin", | |||
"Lookup addresses in a GSYM file that are read from stdin\nEach input line is expected to be of the following format: <addr> <gsym-path>">; | |||
defm symtab_file : | |||
Eq<"symtab-file", | |||
"Specify a separate file for symbol table to GSYM conversion.\nIn case the symbol table and debug info are not in the same binary. Does not support universal binary.">; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a test that will return an error for the dSYM case where we try to specify it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right I will add that :D
Thanks
"needed) " | ||
"with option --out-file option to convert to GSYM format.\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge these lines so the line wrap doesn't happen in the middle.
@@ -358,7 +363,38 @@ static llvm::Error handleObjectFile(ObjectFile &Obj, | |||
return Err; | |||
|
|||
// Get the UUID and convert symbol table to GSYM. | |||
if (auto Err = ObjectFileTransformer::convert(Obj, LogOS, Gsym)) | |||
// Use a separate file for symbol table if specified | |||
std::string SymtabFile = SymbolTableFilename; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to make a copy of SymbolTableFilename
, just use the global
@@ -92,6 +92,7 @@ static uint64_t SegmentSize; | |||
static bool Quiet; | |||
static std::vector<uint64_t> LookupAddresses; | |||
static bool LookupAddressesFromStdin; | |||
static std::string SymbolTableFilename; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make optional?:
static std::optional<std::string> SymbolTableFilename;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just trying to keep it the same as other global string types (eg. OutputFilename is also an optional flag).
It will default to empty string if we didn't use that.
std::string SymtabFile = SymbolTableFilename; | ||
ErrorOr<std::unique_ptr<MemoryBuffer>> SymtabBuffOrErr = nullptr; | ||
std::unique_ptr<MemoryBuffer> SymtabBuffer = nullptr; | ||
if (!SymtabFile.empty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (SymbolTableFilename.has_value()) {
ErrorOr<std::unique_ptr<MemoryBuffer>> SymtabBuffOrErr = nullptr; | ||
std::unique_ptr<MemoryBuffer> SymtabBuffer = nullptr; | ||
if (!SymtabFile.empty()) { | ||
outs() << "Using symbol table file: " << SymbolTableFilename << "\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outs() << "Using symbol table file: " << *SymbolTableFilename << "\n";
std::unique_ptr<MemoryBuffer> SymtabBuffer = nullptr; | ||
if (!SymtabFile.empty()) { | ||
outs() << "Using symbol table file: " << SymbolTableFilename << "\n"; | ||
SymtabBuffOrErr = MemoryBuffer::getFileOrSTDIN(SymtabFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the optional:
s/SymtabFile/*SymbolTableFilename/
if (!SymtabFile.empty()) | ||
return createStringError(std::errc::invalid_argument, | ||
"--symtab-file is not accepted for " | ||
"universal binary conversion"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make a test for this
Summary:
There are cases where separate debuginfo file only contains DWARF and symbol table exists in the executable. Offer a flag to specify a separate file for llvm-gsymutil to extract symbol table from.
NOTE: Not supporting this flag for
MachOUniversalBinary
yet, as dSYM usually contains bothTest Plan:
Added FileCheck tests