Skip to content

Commit e676f08

Browse files
author
Kevin Frei
committed
Getting all 5 variations documented and tests
1 parent 51d691f commit e676f08

14 files changed

+226
-287
lines changed

lldb/test/Shell/Debuginfod/Inputs/main-full.yaml renamed to lldb/test/Shell/Debuginfod/Inputs/bin-normal.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Sections:
5959
AddressAlign: 0x4
6060
Notes:
6161
- Name: GNU
62-
Desc: B4927EA09A08EE63313299CF347043010D03CC5E
62+
Desc: 725D47B7EE964F615C841A04712D6F43175F9D8D
6363
Type: NT_PRPSINFO
6464
- Name: .text
6565
Type: SHT_PROGBITS
@@ -94,7 +94,7 @@ Sections:
9494
Flags: [ SHF_MERGE, SHF_STRINGS ]
9595
AddressAlign: 0x1
9696
EntSize: 0x1
97-
Content: 46616365626F6F6B20636C616E672076657273696F6E2031352E302E302028676974406769746875622E636F6D3A6B6576696E667265692F6C6C766D2E67697420393336636262353533363366386363363236643061303336666138343065383737313335373264392900
97+
Content: 46616365626F6F6B20636C616E672076657273696F6E2031352E302E302028676974406769746875622E636F6D3A6B6576696E667265692F6C6C766D2E67697420663262383163623536396430363332613065623066643531373232643732356162313931616637322900
9898
- Name: .debug_info
9999
Type: SHT_PROGBITS
100100
AddressAlign: 0x1
@@ -106,7 +106,7 @@ Sections:
106106
- Name: .debug_line
107107
Type: SHT_PROGBITS
108108
AddressAlign: 0x1
109-
Content: 7B0000000500080037000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E013D000000004F0B089C0626CBD8AB443134CFE6DD950400000902001040000000000003C30001050B0AAD0510063C05183C0526E405153C05030B3C050006A1050F0ABE050BBB0503065806770210000101
109+
Content: 7B0000000500080037000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E013D00000000AA7BC59AF617547916B47B73E78D55160400000902001040000000000003C30001050B0AAD0510063C05183C0526E405153C05030B3C050006A1050F0ABE050BBB0503065806770210000101
110110
- Name: .debug_line_str
111111
Type: SHT_PROGBITS
112112
Flags: [ SHF_MERGE, SHF_STRINGS ]
@@ -191,7 +191,7 @@ Symbols:
191191
Value: 0x404000
192192
DWARF:
193193
debug_str:
194-
- 'Facebook clang version 15.0.0 ([email protected]:kevinfrei/llvm.git 936cbb55363f8cc626d0a036fa840e87713572d9)'
194+
- 'Facebook clang version 15.0.0 ([email protected]:kevinfrei/llvm.git f2b81cb569d0632a0eb0fd51722d725ab191af72)'
195195
- main.c
196196
- '/home/freik/llvm-sand/llvm/lldb/test/Shell/Debuginfod/Inputs'
197197
- char

lldb/test/Shell/Debuginfod/Inputs/main-dwp.yaml renamed to lldb/test/Shell/Debuginfod/Inputs/bin-split-dwp.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Sections:
2121
Flags: [ SHF_EXCLUDE, SHF_MERGE, SHF_STRINGS ]
2222
AddressAlign: 0x1
2323
EntSize: 0x1
24-
Content: 63686172005F5F41525241595F53495A455F545950455F5F0066756E6300696E74005F7374617274006172676300617267760046616365626F6F6B20636C616E672076657273696F6E2031352E302E302028676974406769746875622E636F6D3A6B6576696E667265692F6C6C766D2E676974203933366362623535333633663863633632366430613033366661383430653837373133353732643929006D61696E2E630067656E2F6D61696E2D73706C69742E64776F00
24+
Content: 63686172005F5F41525241595F53495A455F545950455F5F0066756E6300696E74005F7374617274006172676300617267760046616365626F6F6B20636C616E672076657273696F6E2031352E302E302028676974406769746875622E636F6D3A6B6576696E667265692F6C6C766D2E676974206632623831636235363964303633326130656230666435313732326437323561623139316166373229006D61696E2E630067656E2F62696E2D73706C69742E64776F00
2525
- Name: .debug_str_offsets.dwo
2626
Type: SHT_PROGBITS
2727
Flags: [ SHF_EXCLUDE ]

lldb/test/Shell/Debuginfod/Inputs/main-split-nodbg.yaml renamed to lldb/test/Shell/Debuginfod/Inputs/bin-split-stripped.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Sections:
5959
AddressAlign: 0x4
6060
Notes:
6161
- Name: GNU
62-
Desc: 8B5B6416F61ADC140AE457E208F1699F89BFDA86
62+
Desc: 82B2C35129DAB19AD58F3DD0F426BDB0CC8AA094
6363
Type: NT_PRPSINFO
6464
- Name: .text
6565
Type: SHT_PROGBITS
@@ -94,7 +94,7 @@ Sections:
9494
Flags: [ SHF_MERGE, SHF_STRINGS ]
9595
AddressAlign: 0x1
9696
EntSize: 0x1
97-
Content: 46616365626F6F6B20636C616E672076657273696F6E2031352E302E302028676974406769746875622E636F6D3A6B6576696E667265692F6C6C766D2E67697420393336636262353533363366386363363236643061303336666138343065383737313335373264392900
97+
Content: 46616365626F6F6B20636C616E672076657273696F6E2031352E302E302028676974406769746875622E636F6D3A6B6576696E667265692F6C6C766D2E67697420663262383163623536396430363332613065623066643531373232643732356162313931616637322900
9898
Symbols:
9999
- Name: .note.gnu.build-id
100100
Type: STT_SECTION

lldb/test/Shell/Debuginfod/Inputs/main-split.yaml renamed to lldb/test/Shell/Debuginfod/Inputs/bin-split.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Sections:
5959
AddressAlign: 0x4
6060
Notes:
6161
- Name: GNU
62-
Desc: 8B5B6416F61ADC140AE457E208F1699F89BFDA86
62+
Desc: 82B2C35129DAB19AD58F3DD0F426BDB0CC8AA094
6363
Type: NT_PRPSINFO
6464
- Name: .text
6565
Type: SHT_PROGBITS
@@ -94,7 +94,7 @@ Sections:
9494
Flags: [ SHF_MERGE, SHF_STRINGS ]
9595
AddressAlign: 0x1
9696
EntSize: 0x1
97-
Content: 46616365626F6F6B20636C616E672076657273696F6E2031352E302E302028676974406769746875622E636F6D3A6B6576696E667265692F6C6C766D2E67697420393336636262353533363366386363363236643061303336666138343065383737313335373264392900
97+
Content: 46616365626F6F6B20636C616E672076657273696F6E2031352E302E302028676974406769746875622E636F6D3A6B6576696E667265692F6C6C766D2E67697420663262383163623536396430363332613065623066643531373232643732356162313931616637322900
9898
- Name: .debug_info
9999
Type: SHT_PROGBITS
100100
AddressAlign: 0x1
@@ -106,7 +106,7 @@ Sections:
106106
- Name: .debug_line
107107
Type: SHT_PROGBITS
108108
AddressAlign: 0x1
109-
Content: 7B0000000500080037000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E013D000000004F0B089C0626CBD8AB443134CFE6DD950400000902001040000000000003C30001050B0AAD0510063C05183C0526E405153C05030B3C050006A1050F0ABE050BBB0503065806770210000101
109+
Content: 7B0000000500080037000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E013D00000000AA7BC59AF617547916B47B73E78D55160400000902001040000000000003C30001050B0AAD0510063C05183C0526E405153C05030B3C050006A1050F0ABE050BBB0503065806770210000101
110110
- Name: .debug_line_str
111111
Type: SHT_PROGBITS
112112
Flags: [ SHF_MERGE, SHF_STRINGS ]
@@ -206,7 +206,7 @@ Symbols:
206206
DWARF:
207207
debug_str:
208208
- '/home/freik/llvm-sand/llvm/lldb/test/Shell/Debuginfod/Inputs'
209-
- 'gen/main-split.dwo'
209+
- 'gen/bin-split.dwo'
210210
debug_addr:
211211
- Length: 0x14
212212
Version: 0x5

lldb/test/Shell/Debuginfod/Inputs/main-stripped.yaml renamed to lldb/test/Shell/Debuginfod/Inputs/bin-stripped.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Sections:
5959
AddressAlign: 0x4
6060
Notes:
6161
- Name: GNU
62-
Desc: B4927EA09A08EE63313299CF347043010D03CC5E
62+
Desc: 725D47B7EE964F615C841A04712D6F43175F9D8D
6363
Type: NT_PRPSINFO
6464
- Name: .text
6565
Type: SHT_PROGBITS
@@ -94,7 +94,7 @@ Sections:
9494
Flags: [ SHF_MERGE, SHF_STRINGS ]
9595
AddressAlign: 0x1
9696
EntSize: 0x1
97-
Content: 46616365626F6F6B20636C616E672076657273696F6E2031352E302E302028676974406769746875622E636F6D3A6B6576696E667265692F6C6C766D2E67697420393336636262353533363366386363363236643061303336666138343065383737313335373264392900
97+
Content: 46616365626F6F6B20636C616E672076657273696F6E2031352E302E302028676974406769746875622E636F6D3A6B6576696E667265692F6C6C766D2E67697420663262383163623536396430363332613065623066643531373232643732356162313931616637322900
9898
Symbols:
9999
- Name: .note.gnu.build-id
100100
Type: STT_SECTION

lldb/test/Shell/Debuginfod/Inputs/main-nodbg.yaml

Lines changed: 0 additions & 146 deletions
This file was deleted.

lldb/test/Shell/Debuginfod/Inputs/mk

Lines changed: 77 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,86 @@
11
#!/bin/sh
22

3-
# I need 4 different scenarios:
3+
# I need 5 different scenarios:
44
# 1 - A stripped binary with it's corresponding unstripped binary:
5-
# 2 - A stripped binary with a corresponding -only-keep-debug symbols file
5+
# 2 - A stripped binary with a corresponding --only-keep-debug symbols file
66
# 3 - A split binary with it's corresponding DWP file
77
# 4 - A stripped, split binary with an unstripped binary and a DWP file
8+
# 5 - A stripped, split binary with an --only-keep-debug symbols file and a DWP file
89

910
mkdir -p gen
1011
mkdir -p run
1112

12-
# First, compile & link the binary itself
13-
${builddir}/bin/clang -g -o gen/main-full.o -O0 -c main.c
14-
ld -nostdlib gen/main-full.o --build-id=sha1 -o gen/main-full
15-
${builddir}/bin/clang -g -gsplit-dwarf -o gen/main-split.o -O0 -c main.c
16-
ld -nostdlib gen/main-split.o --build-id=sha1 -o gen/main-split
17-
${builddir}/bin/llvm-dwp -e gen/main-split -o gen/main-split.dwp
18-
19-
# Scenario 1: main-strip -> main-full (both executable and debuginfo)
20-
${builddir}/bin/llvm-objcopy --strip-debug gen/main-full gen/main-stripped
21-
${builddir}/bin/obj2yaml gen/main-full > main-full.yaml
22-
${builddir}/bin/obj2yaml gen/main-stripped > main-stripped.yaml
23-
# MAKE: ${builddir}/bin/yaml2obj main-full.yaml > run/main-full
24-
# MAKE: ${builddir}/bin/yaml2obj main-stripped.yaml > run/main-stripped
25-
26-
# Scenario 2: main-nodbg -> main-dbg (debuginfo)
27-
${builddir}/bin/llvm-objcopy --only-keep-debug gen/main-full gen/main-dbg
28-
${builddir}/bin/llvm-objcopy --strip-debug gen/main-full gen/main-nodbg
29-
${builddir}/bin/obj2yaml gen/main-nodbg > main-nodbg.yaml
30-
${builddir}/bin/obj2yaml gen/main-dbg > main-dbg.yaml
31-
# MAKE: ${builddir}/bin/yaml2obj main-nodbg.yaml > gen/main-nodbg.tmp
32-
# MAKE: ${builddir}/bin/yaml2obj main-dbg.yaml > run/main-dbg
33-
# MAKE: ${builddir}/bin/llvm-objcopy gen/main-nodbg.tmp --add-gnu-debuglink=run/main-dbg run/main-nodbg
34-
35-
# Scenario 3: main-split, main-split.dwp (debuginfo)
36-
${builddir}/bin/obj2yaml gen/main-split > main-split.yaml
37-
${builddir}/bin/obj2yaml gen/main-split.dwp > main-dwp.yaml
38-
# MAKE: ${builddir}/bin/yaml2obj main-split.yaml > run/main-split
39-
# MAKE: ${builddir}/bin/yaml2obj main-dwp.yaml > run/main-split.dwp
40-
41-
# Scenario 4: main-split-nodbg, main-split-dbg (executable), main-split.dwp (debuginfo)
42-
${builddir}/bin/llvm-objcopy --only-keep-debug gen/main-split gen/main-split-dbg
43-
${builddir}/bin/llvm-objcopy --strip-debug gen/main-split gen/main-split-nodbg
44-
${builddir}/bin/obj2yaml gen/main-split-nodbg > main-split-nodbg.yaml
45-
${builddir}/bin/obj2yaml gen/main-split-dbg > main-split-dbg.yaml
46-
# MAKE: ${builddir}/bin/yaml2obj main-split-nodbg.yaml > gen/main-split-nodbg.tmp
47-
# MAKE: ${builddir}/bin/yaml2obj main-split-dbg.yaml > run/main-split-dbg
48-
# MAKE: ${builddir}/bin/llvm-objcopy gen/main-split-nodbg.tmp --add-gnu-debuglink=run/main-split-dbg run/main-split-nodbg
49-
# the main-dwp.yaml should be the same, I believe
50-
51-
# MAKE: chmod a+x run/*
13+
# First, compile & link the binaries (normal and split)
14+
15+
${builddir}/bin/clang -g -o gen/bin-normal.o -O0 -c main.c
16+
ld -nostdlib gen/bin-normal.o --build-id=sha1 -o gen/bin-normal
17+
${builddir}/bin/clang -g -gsplit-dwarf -o gen/bin-split.o -O0 -c main.c
18+
ld -nostdlib gen/bin-split.o --build-id=sha1 -o gen/bin-split
19+
20+
# Next, create the file variations we need
21+
22+
# Variation 1: -g, stripped
23+
${builddir}/bin/llvm-objcopy --strip-debug gen/bin-normal gen/bin-stripped
24+
# Variation 2: -g, stripped, --only-keep-debug symbols
25+
${builddir}/bin/llvm-objcopy --only-keep-debug gen/bin-normal gen/sym-stripped
26+
# Variation 3: -gsplit-dwarf: .dwp
27+
${builddir}/bin/llvm-dwp -e gen/bin-split -o gen/bin-split.dwp
28+
# Variation 4: -gsplit-dwarf: stripped, .dwp
29+
${builddir}/bin/llvm-objcopy --strip-debug gen/bin-split gen/bin-split-stripped
30+
# Variation 5: -gsplit-dwarf: stripped, --only-keep-debug + .dwp
31+
${builddir}/bin/llvm-objcopy --only-keep-debug gen/bin-split gen/sym-split
32+
33+
# Finally, produce the .yaml files for testing
34+
35+
# Scenario 1:
36+
# target: bin-stripped
37+
# Scenario 1a:
38+
# symbols: bin-normal (hosted as debuginfo)
39+
# Scenario 1b:
40+
# symbols: bin-normal (hosted as executable)
41+
${builddir}/bin/obj2yaml gen/bin-stripped -o bin-stripped.yaml
42+
${builddir}/bin/obj2yaml gen/bin-normal -o bin-normal.yaml
43+
# @ testing time: yaml2obj bin-stripped.yaml -o ${out}/bin-stripped
44+
# @ testing time: yaml2obj bin-normal.yaml -o ${out}/bin-normal
45+
46+
47+
# Scenario 2:
48+
# target: bin-stripped-okd
49+
# Scenario 2a:
50+
# symbols: sym-stripped (hosted as debuginfo)
51+
# Scenario 2b:
52+
# symbols: sym-stripped (hosted as executable)
53+
${builddir}/bin/obj2yaml gen/sym-stripped -o sym-stripped.yaml
54+
# To produce a correct .gnu.debuglink, you have to do it at test generation time.
55+
# The section includes a CRC that yaml2obj doesn't properly produce.
56+
# @ testing time: yaml2obj sym-stripped.yaml -o ${out}/sym-stripped
57+
# @ testing time: llvm-objcopy bin-stripped --add-gnu-debuglink=${out}/sym-stripped ${out}/bin-stripped-okd
58+
59+
# Scenario 3:
60+
# target: bin-split
61+
# DWP: bin-split.dwp (hosted as debuginfo)
62+
${builddir}/bin/obj2yaml gen/bin-split -o bin-split.yaml
63+
${builddir}/bin/obj2yaml gen/bin-split.dwp -o bin-split-dwp.yaml
64+
# @ testing time: yaml2obj bin-split.yaml -o ${out}/bin-split
65+
# @ testing time: yaml2obj bin-split-dwp.yaml -o ${out}/bin-split.dwp
66+
67+
# Scenario 4:
68+
# target: bin-split-stripped
69+
# symbols: bin-split (hosted as executable)
70+
# DWP bin-split.dwp (hosted as debuginfo)
71+
# This doesn't work from a file system "as is".
72+
# I believe you can set the symbol file manually to the bin-split file.
73+
# TODO: Need to check for the -no-locator test to see what the name of
74+
# the .dwp is expected to be.
75+
${builddir}/bin/obj2yaml gen/bin-split-stripped -o bin-split-stripped.yaml
76+
# bin-split and bin-split.dwp already generated in Scenario 3
77+
# @ testing time: yaml2obj bin-split-stripped.yaml -o ${out}/bin-split-stripped
78+
79+
# Scenario 5:
80+
# target: bin-split-stripped-okd
81+
# symbols: sym-split (hosted as executable)
82+
# DWP: bin-split.dwp (hosted as debuginfo)
83+
${builddir}/bin/obj2yaml gen/sym-split -o sym-split.yaml
84+
# @ testing time: yaml2obj main-split-nodbg.yaml -o gen/main-split-nodbg.tmp
85+
# @ testing time: yaml2obj main-split-dbg.yaml -o run/main-split-dbg
86+
# @ testing time: llvm-objcopy gen/main-split-nodbg.tmp --add-gnu-debuglink=run/main-split-dbg run/main-split-nodbg

0 commit comments

Comments
 (0)