xref: /llvm-project/llvm/test/tools/llvm-objcopy/COFF/debug-entry-no-payload.test (revision 16ebb7ab5c462518388527b6ebee2f0e1080b777)
1## Check that llvm-objcopy does not produce an error for debug directory
2## entries without a payload (e.g. IMAGE_DEBUG_TYPE_REPRO,
3## IMAGE_DEBUG_TYPE_UNKNOWN) when patching entries that may have moved during
4## a requested operation. Also check that the such debug entries are present
5## in the output.
6
7## The code to patch debug entries is executed even when no operation is
8## requested. Hence the RUN line below invokes llvm-objcopy without any
9## arguments.
10
11# RUN: yaml2obj %s -o %t.in.exe
12# RUN: llvm-objcopy %t.in.exe %t.out.exe
13# RUN: llvm-readobj --coff-debug-directory %t.out.exe | FileCheck %s
14
15# CHECK: Type: Repro (0x10)
16# CHECK: Type: Unknown (0x0)
17
18--- !COFF
19OptionalHeader:
20  AddressOfEntryPoint: 4096
21  ImageBase:       1073741824
22  SectionAlignment: 4096
23  FileAlignment:   512
24  MajorOperatingSystemVersion: 6
25  MinorOperatingSystemVersion: 0
26  MajorImageVersion: 0
27  MinorImageVersion: 0
28  MajorSubsystemVersion: 6
29  MinorSubsystemVersion: 0
30  Subsystem:       IMAGE_SUBSYSTEM_WINDOWS_CUI
31  DLLCharacteristics: [  ]
32  SizeOfStackReserve: 1048576
33  SizeOfStackCommit: 4096
34  SizeOfHeapReserve: 1048576
35  SizeOfHeapCommit: 4096
36  Debug:
37    RelativeVirtualAddress: 8192
38    Size:            56
39header:
40  Machine:         IMAGE_FILE_MACHINE_AMD64
41  Characteristics: [  ]
42sections:
43  - Name:            .text
44    Characteristics: [  ]
45    VirtualAddress:  4096
46    VirtualSize:     3
47    SectionData:     31C0C3
48  - Name:            .rdata
49    Characteristics: [  ]
50    VirtualAddress:  8192
51    VirtualSize:     56
52    ## '10' in SectionData below indicates the Repro type for the first debug
53    ## entry.  The second entry has a type of Unknown ('00').
54    SectionData:     0000000047F96B2000000000100000000000000000000000000000000000000047F96B200000000000000000000000000000000000000000
55symbols:         []
56...
57