|
| 1 | +# REQUIRES: x86 |
| 2 | +# RUN: llvm-mc -filetype=obj %s -o %t.obj -triple x86_64-windows-msvc |
| 3 | +# RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe -pdb:%t.pdb -debug |
| 4 | +# RUN: llvm-symbolizer --obj=%t.exe --use-native-pdb-reader --relative-address \ |
| 5 | +# RUN: 0x1014 0x1018 0x101c 0x1023 0x1024 | FileCheck %s |
| 6 | + |
| 7 | +# Compiled from this cpp code, with modifications to add extra inline line and |
| 8 | +# file changes: |
| 9 | +# clang -cc1 -triple x86_64-windows-msvc -gcodeview -S test.cpp |
| 10 | +# |
| 11 | +# __attribute__((always_inline)) int inlinee_2(int x) { |
| 12 | +# return x + 1; |
| 13 | +# } |
| 14 | +# __attribute__((always_inline)) int inlinee_1(int x) { |
| 15 | +# return inlinee_2(x) + 1; |
| 16 | +# } |
| 17 | +# int main() { |
| 18 | +# return inlinee_1(33); |
| 19 | +# } |
| 20 | + |
| 21 | + |
| 22 | +# CHECK: inlinee_1 |
| 23 | +# CHECK-NEXT: C:\src\test.cpp:9:0 |
| 24 | +# CHECK-NEXT: main |
| 25 | +# CHECK-NEXT: C:\src\test.cpp:13:10 |
| 26 | + |
| 27 | +# CHECK: inlinee_1 |
| 28 | +# CHECK-NEXT: C:\src\test.cpp:10:0 |
| 29 | +# CHECK-NEXT: main |
| 30 | +# CHECK-NEXT: C:\src\test.cpp:13:10 |
| 31 | + |
| 32 | +# CHECK: inlinee_2 |
| 33 | +# CHECK-NEXT: C:\src\test.cpp:5:0 |
| 34 | +# CHECK-NEXT: inlinee_1 |
| 35 | +# CHECK-NEXT: C:\src\test.cpp:9:0 |
| 36 | +# CHECK-NEXT: main |
| 37 | +# CHECK-NEXT: C:\src\test.cpp:13:10 |
| 38 | + |
| 39 | +# CHECK: inlinee_2 |
| 40 | +# CHECK-NEXT: C:\src\file.cpp:5:0 |
| 41 | +# CHECK-NEXT: inlinee_1 |
| 42 | +# CHECK-NEXT: C:\src\test.cpp:9:0 |
| 43 | +# CHECK-NEXT: main |
| 44 | +# CHECK-NEXT: C:\src\test.cpp:13:10 |
| 45 | + |
| 46 | +# CHECK: inlinee_1 |
| 47 | +# CHECK-NEXT: C:\src\test.cpp:9:0 |
| 48 | +# CHECK-NEXT: main |
| 49 | +# CHECK-NEXT: C:\src\test.cpp:13:10 |
| 50 | + |
| 51 | + .text |
| 52 | + .def @feat.00; |
| 53 | + .scl 3; |
| 54 | + .type 0; |
| 55 | + .endef |
| 56 | + .globl @feat.00 |
| 57 | +.set @feat.00, 0 |
| 58 | + .file "test.cpp" |
| 59 | + .def main; |
| 60 | + .scl 2; |
| 61 | + .type 32; |
| 62 | + .endef |
| 63 | + .globl main # -- Begin function main |
| 64 | + .p2align 4, 0x90 |
| 65 | +main: # @main |
| 66 | +.Lfunc_begin0: |
| 67 | + .cv_func_id 0 |
| 68 | + .cv_file 1 "C:\\src\\test.cpp" "4BECA437CFE062C7D0B74B1851B65988" 1 |
| 69 | + .cv_file 2 "C:\\src\\file.cpp" "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 1 |
| 70 | + .cv_loc 0 1 12 0 # test.cpp:12:0 |
| 71 | +# %bb.0: # %entry |
| 72 | + subq $16, %rsp |
| 73 | + movl $0, 4(%rsp) |
| 74 | + movl $33, 8(%rsp) |
| 75 | +.Ltmp0: |
| 76 | + .cv_inline_site_id 1 within 0 inlined_at 1 13 10 |
| 77 | + .cv_loc 1 1 9 20 # test.cpp:9:20 |
| 78 | + movl 8(%rsp), %eax |
| 79 | + .cv_loc 1 1 10 0 # test.cpp:10:0 |
| 80 | + movl %eax, 12(%rsp) |
| 81 | +.Ltmp1: |
| 82 | + .cv_inline_site_id 2 within 1 inlined_at 1 9 10 |
| 83 | + .cv_loc 2 1 5 10 # test.cpp:5:10 |
| 84 | + movl 12(%rsp), %eax |
| 85 | + .cv_loc 2 1 5 12 # test.cpp:5:12 |
| 86 | + addl $1, %eax |
| 87 | + .cv_loc 2 2 5 13 # file.cpp:5:13 |
| 88 | + nop |
| 89 | +.Ltmp2: |
| 90 | + .cv_loc 1 1 9 23 # test.cpp:9:23 |
| 91 | + addl $1, %eax |
| 92 | +.Ltmp3: |
| 93 | + .cv_loc 0 1 13 3 # test.cpp:13:3 |
| 94 | + addq $16, %rsp |
| 95 | + retq |
| 96 | +.Ltmp4: |
| 97 | +.Lfunc_end0: |
| 98 | + # -- End function |
| 99 | + .section .debug$S,"dr" |
| 100 | + .p2align 2 |
| 101 | + .long 4 # Debug section magic |
| 102 | + .long 241 |
| 103 | + .long .Ltmp6-.Ltmp5 # Subsection size |
| 104 | +.Ltmp5: |
| 105 | + .short .Ltmp8-.Ltmp7 # Record length |
| 106 | +.Ltmp7: |
| 107 | + .short 4412 # Record kind: S_COMPILE3 |
| 108 | + .long 1 # Flags and language |
| 109 | + .short 208 # CPUType |
| 110 | + .short 12 # Frontend version |
| 111 | + .short 0 |
| 112 | + .short 0 |
| 113 | + .short 0 |
| 114 | + .short 12000 # Backend version |
| 115 | + .short 0 |
| 116 | + .short 0 |
| 117 | + .short 0 |
| 118 | + .asciz "clang version 12.0.0 (https://github.com/llvm/llvm-project.git 6a4850e9c1cc74cc67f99f1f81a8fe060a7088d2)" # Null-terminated compiler version string |
| 119 | + .p2align 2 |
| 120 | +.Ltmp8: |
| 121 | +.Ltmp6: |
| 122 | + .p2align 2 |
| 123 | + .long 246 # Inlinee lines subsection |
| 124 | + .long .Ltmp10-.Ltmp9 # Subsection size |
| 125 | +.Ltmp9: |
| 126 | + .long 0 # Inlinee lines signature |
| 127 | + |
| 128 | + # Inlined function inlinee_1 starts at test.cpp:8 |
| 129 | + .long 4098 # Type index of inlined function |
| 130 | + .cv_filechecksumoffset 1 # Offset into filechecksum table |
| 131 | + .long 8 # Starting line number |
| 132 | + |
| 133 | + # Inlined function inlinee_2 starts at test.cpp:4 |
| 134 | + .long 4099 # Type index of inlined function |
| 135 | + .cv_filechecksumoffset 1 # Offset into filechecksum table |
| 136 | + .long 4 # Starting line number |
| 137 | +.Ltmp10: |
| 138 | + .p2align 2 |
| 139 | + .long 241 # Symbol subsection for main |
| 140 | + .long .Ltmp12-.Ltmp11 # Subsection size |
| 141 | +.Ltmp11: |
| 142 | + .short .Ltmp14-.Ltmp13 # Record length |
| 143 | +.Ltmp13: |
| 144 | + .short 4423 # Record kind: S_GPROC32_ID |
| 145 | + .long 0 # PtrParent |
| 146 | + .long 0 # PtrEnd |
| 147 | + .long 0 # PtrNext |
| 148 | + .long .Lfunc_end0-main # Code size |
| 149 | + .long 0 # Offset after prologue |
| 150 | + .long 0 # Offset before epilogue |
| 151 | + .long 4102 # Function type index |
| 152 | + .secrel32 main # Function section relative address |
| 153 | + .secidx main # Function section index |
| 154 | + .byte 0 # Flags |
| 155 | + .asciz "main" # Function name |
| 156 | + .p2align 2 |
| 157 | +.Ltmp14: |
| 158 | + .short .Ltmp16-.Ltmp15 # Record length |
| 159 | +.Ltmp15: |
| 160 | + .short 4114 # Record kind: S_FRAMEPROC |
| 161 | + .long 16 # FrameSize |
| 162 | + .long 0 # Padding |
| 163 | + .long 0 # Offset of padding |
| 164 | + .long 0 # Bytes of callee saved registers |
| 165 | + .long 0 # Exception handler offset |
| 166 | + .short 0 # Exception handler section |
| 167 | + .long 81920 # Flags (defines frame register) |
| 168 | + .p2align 2 |
| 169 | +.Ltmp16: |
| 170 | + .short .Ltmp18-.Ltmp17 # Record length |
| 171 | +.Ltmp17: |
| 172 | + .short 4429 # Record kind: S_INLINESITE |
| 173 | + .long 0 # PtrParent |
| 174 | + .long 0 # PtrEnd |
| 175 | + .long 4098 # Inlinee type index |
| 176 | + .cv_inline_linetable 1 1 8 .Lfunc_begin0 .Lfunc_end0 |
| 177 | + .p2align 2 |
| 178 | +.Ltmp18: |
| 179 | + .short .Ltmp20-.Ltmp19 # Record length |
| 180 | +.Ltmp19: |
| 181 | + .short 4414 # Record kind: S_LOCAL |
| 182 | + .long 116 # TypeIndex |
| 183 | + .short 1 # Flags |
| 184 | + .asciz "x" |
| 185 | + .p2align 2 |
| 186 | +.Ltmp20: |
| 187 | + .cv_def_range .Ltmp0 .Ltmp3, frame_ptr_rel, 8 |
| 188 | + .short .Ltmp22-.Ltmp21 # Record length |
| 189 | +.Ltmp21: |
| 190 | + .short 4429 # Record kind: S_INLINESITE |
| 191 | + .long 0 # PtrParent |
| 192 | + .long 0 # PtrEnd |
| 193 | + .long 4099 # Inlinee type index |
| 194 | + .cv_inline_linetable 2 1 4 .Lfunc_begin0 .Lfunc_end0 |
| 195 | + .p2align 2 |
| 196 | +.Ltmp22: |
| 197 | + .short .Ltmp24-.Ltmp23 # Record length |
| 198 | +.Ltmp23: |
| 199 | + .short 4414 # Record kind: S_LOCAL |
| 200 | + .long 116 # TypeIndex |
| 201 | + .short 1 # Flags |
| 202 | + .asciz "x" |
| 203 | + .p2align 2 |
| 204 | +.Ltmp24: |
| 205 | + .cv_def_range .Ltmp1 .Ltmp2, frame_ptr_rel, 12 |
| 206 | + .short 2 # Record length |
| 207 | + .short 4430 # Record kind: S_INLINESITE_END |
| 208 | + .short 2 # Record length |
| 209 | + .short 4430 # Record kind: S_INLINESITE_END |
| 210 | + .short 2 # Record length |
| 211 | + .short 4431 # Record kind: S_PROC_ID_END |
| 212 | +.Ltmp12: |
| 213 | + .p2align 2 |
| 214 | + .cv_linetable 0, main, .Lfunc_end0 |
| 215 | + .cv_filechecksums # File index to string table offset subsection |
| 216 | + .cv_stringtable # String table |
| 217 | + .long 241 |
| 218 | + .long .Ltmp26-.Ltmp25 # Subsection size |
| 219 | +.Ltmp25: |
| 220 | + .short .Ltmp28-.Ltmp27 # Record length |
| 221 | +.Ltmp27: |
| 222 | + .short 4428 # Record kind: S_BUILDINFO |
| 223 | + .long 4105 # LF_BUILDINFO index |
| 224 | + .p2align 2 |
| 225 | +.Ltmp28: |
| 226 | +.Ltmp26: |
| 227 | + .p2align 2 |
| 228 | + .section .debug$T,"dr" |
| 229 | + .p2align 2 |
| 230 | + .long 4 # Debug section magic |
| 231 | + # ArgList (0x1000) |
| 232 | + .short 0xa # Record length |
| 233 | + .short 0x1201 # Record kind: LF_ARGLIST |
| 234 | + .long 0x1 # NumArgs |
| 235 | + .long 0x74 # Argument: int |
| 236 | + # Procedure (0x1001) |
| 237 | + .short 0xe # Record length |
| 238 | + .short 0x1008 # Record kind: LF_PROCEDURE |
| 239 | + .long 0x74 # ReturnType: int |
| 240 | + .byte 0x0 # CallingConvention: NearC |
| 241 | + .byte 0x0 # FunctionOptions |
| 242 | + .short 0x1 # NumParameters |
| 243 | + .long 0x1000 # ArgListType: (int) |
| 244 | + # FuncId (0x1002) |
| 245 | + .short 0x16 # Record length |
| 246 | + .short 0x1601 # Record kind: LF_FUNC_ID |
| 247 | + .long 0x0 # ParentScope |
| 248 | + .long 0x1001 # FunctionType: int (int) |
| 249 | + .asciz "inlinee_1" # Name |
| 250 | + .byte 242 |
| 251 | + .byte 241 |
| 252 | + # FuncId (0x1003) |
| 253 | + .short 0x16 # Record length |
| 254 | + .short 0x1601 # Record kind: LF_FUNC_ID |
| 255 | + .long 0x0 # ParentScope |
| 256 | + .long 0x1001 # FunctionType: int (int) |
| 257 | + .asciz "inlinee_2" # Name |
| 258 | + .byte 242 |
| 259 | + .byte 241 |
| 260 | + # ArgList (0x1004) |
| 261 | + .short 0x6 # Record length |
| 262 | + .short 0x1201 # Record kind: LF_ARGLIST |
| 263 | + .long 0x0 # NumArgs |
| 264 | + # Procedure (0x1005) |
| 265 | + .short 0xe # Record length |
| 266 | + .short 0x1008 # Record kind: LF_PROCEDURE |
| 267 | + .long 0x74 # ReturnType: int |
| 268 | + .byte 0x0 # CallingConvention: NearC |
| 269 | + .byte 0x0 # FunctionOptions |
| 270 | + .short 0x0 # NumParameters |
| 271 | + .long 0x1004 # ArgListType: () |
| 272 | + # FuncId (0x1006) |
| 273 | + .short 0x12 # Record length |
| 274 | + .short 0x1601 # Record kind: LF_FUNC_ID |
| 275 | + .long 0x0 # ParentScope |
| 276 | + .long 0x1005 # FunctionType: int () |
| 277 | + .asciz "main" # Name |
| 278 | + .byte 243 |
| 279 | + .byte 242 |
| 280 | + .byte 241 |
| 281 | + # StringId (0x1007) |
| 282 | + .short 0xe # Record length |
| 283 | + .short 0x1605 # Record kind: LF_STRING_ID |
| 284 | + .long 0x0 # Id |
| 285 | + .asciz "C:\\src" # StringData |
| 286 | + .byte 241 |
| 287 | + # StringId (0x1008) |
| 288 | + .short 0xe # Record length |
| 289 | + .short 0x1605 # Record kind: LF_STRING_ID |
| 290 | + .long 0x0 # Id |
| 291 | + .asciz "<stdin>" # StringData |
| 292 | + # BuildInfo (0x1009) |
| 293 | + .short 0x1a # Record length |
| 294 | + .short 0x1603 # Record kind: LF_BUILDINFO |
| 295 | + .short 0x5 # NumArgs |
| 296 | + .long 0x1007 # Argument: C:\src |
| 297 | + .long 0x0 # Argument |
| 298 | + .long 0x1008 # Argument: <stdin> |
| 299 | + .long 0x0 # Argument |
| 300 | + .long 0x0 # Argument |
| 301 | + .byte 242 |
| 302 | + .byte 241 |
0 commit comments