|
| 1 | +# REQUIRES: x86 |
| 2 | + |
| 3 | +# RUN: split-file %s %t |
| 4 | +# RUN: llvm-mc --triple=x86_64-pc-linux -filetype=obj %t/a.s -o %t/a.o |
| 5 | +# RUN: %lldb %t/a.o -o "settings set target.source-map . %t" \ |
| 6 | +# RUN: -o "settings set interpreter.stop-command-source-on-error false" \ |
| 7 | +# RUN: -s %t/commands -o exit 2>&1 | FileCheck %s |
| 8 | + |
| 9 | +#--- commands |
| 10 | +# CASE 0: function at the start of the file |
| 11 | +source list -n func0 |
| 12 | +# CHECK-LABEL: source list -n func0 |
| 13 | +# CHECK-NEXT: File: file0.c |
| 14 | +# CHECK-NEXT: 1 content of file0.c:1 |
| 15 | +# CHECK-NEXT: 2 content of file0.c:2 |
| 16 | +# CHECK-NEXT: 3 content of file0.c:3 |
| 17 | +# CHECK-NEXT: 4 content of file0.c:4 |
| 18 | +# CHECK-NEXT: 5 content of file0.c:5 |
| 19 | +# CHECK-NEXT: 6 content of file0.c:6 |
| 20 | +# CHECK-NEXT: 7 content of file0.c:7 |
| 21 | +# CHECK-NEXT: 8 content of file0.c:8 |
| 22 | +# CHECK-NEXT: 9 content of file0.c:9 |
| 23 | +# CHECK-NEXT: 10 content of file0.c:10 |
| 24 | + |
| 25 | +# CASE 1: function in the middle of the file |
| 26 | +source list -n func1 |
| 27 | +# CHECK-NEXT: source list -n func1 |
| 28 | +# CHECK-NEXT: File: file0.c |
| 29 | +# CHECK-NEXT: 5 content of file0.c:5 |
| 30 | +# CHECK-NEXT: 6 content of file0.c:6 |
| 31 | +# CHECK-NEXT: 7 content of file0.c:7 |
| 32 | +# CHECK-NEXT: 8 content of file0.c:8 |
| 33 | +# CHECK-NEXT: 9 content of file0.c:9 |
| 34 | +# CHECK-NEXT: 10 content of file0.c:10 |
| 35 | +# CHECK-NEXT: 11 content of file0.c:11 |
| 36 | +# CHECK-NEXT: 12 content of file0.c:12 |
| 37 | +# CHECK-NEXT: 13 content of file0.c:13 |
| 38 | +# CHECK-NEXT: 14 content of file0.c:14 |
| 39 | +# CHECK-NEXT: 15 content of file0.c:15 |
| 40 | +# CHECK-NEXT: 16 content of file0.c:16 |
| 41 | +# CHECK-NEXT: 17 content of file0.c:17 |
| 42 | + |
| 43 | +# CASE 2: function at the end of the file |
| 44 | +source list -n func2 |
| 45 | +# CHECK-NEXT: source list -n func2 |
| 46 | +# CHECK-NEXT: File: file0.c |
| 47 | +# CHECK-NEXT: 20 content of file0.c:20 |
| 48 | +# CHECK-NEXT: 21 content of file0.c:21 |
| 49 | +# CHECK-NEXT: 22 content of file0.c:22 |
| 50 | +# CHECK-NEXT: 23 content of file0.c:23 |
| 51 | +# CHECK-NEXT: 24 content of file0.c:24 |
| 52 | +# CHECK-NEXT: 25 content of file0.c:25 |
| 53 | +# CHECK-NEXT: 26 content of file0.c:26 |
| 54 | +# CHECK-NEXT: 27 content of file0.c:27 |
| 55 | +# CHECK-NEXT: 28 content of file0.c:28 |
| 56 | +# CHECK-NEXT: 29 content of file0.c:29 |
| 57 | +# CHECK-NEXT: 30 content of file0.c:30 |
| 58 | + |
| 59 | +# CASE 3: function ends in a different file |
| 60 | +source list -n func3 |
| 61 | +# CHECK-NEXT: source list -n func3 |
| 62 | +# CHECK-NEXT: File: file0.c |
| 63 | +# CHECK-NEXT: 1 content of file0.c:1 |
| 64 | +# CHECK-NEXT: 2 content of file0.c:2 |
| 65 | +# CHECK-NEXT: 3 content of file0.c:3 |
| 66 | +# CHECK-NEXT: 4 content of file0.c:4 |
| 67 | +# CHECK-NEXT: 5 content of file0.c:5 |
| 68 | +# CHECK-NEXT: 6 content of file0.c:6 |
| 69 | +# CHECK-NEXT: 7 content of file0.c:7 |
| 70 | +# CHECK-NEXT: 8 content of file0.c:8 |
| 71 | +# CHECK-NEXT: 9 content of file0.c:9 |
| 72 | +# CHECK-NEXT: 10 content of file0.c:10 |
| 73 | + |
| 74 | +# CASE 4: function has no line entry with line!=0 |
| 75 | +source list -n func4 |
| 76 | +# CHECK-LABEL: source list -n func4 |
| 77 | +# CHECK: error: Could not find line information for function "func4". |
| 78 | + |
| 79 | +# CASE 5: discontinuous function |
| 80 | +source list -n func5 |
| 81 | +# CHECK-LABEL: source list -n func5 |
| 82 | +# CHECK-NEXT: File: file0.c |
| 83 | +# CHECK-NEXT: 1 content of file0.c:1 |
| 84 | +# CHECK-NEXT: 2 content of file0.c:2 |
| 85 | +# CHECK-NEXT: 3 content of file0.c:3 |
| 86 | +# CHECK-NEXT: 4 content of file0.c:4 |
| 87 | +# CHECK-NEXT: 5 content of file0.c:5 |
| 88 | +# CHECK-NEXT: 6 content of file0.c:6 |
| 89 | +# CHECK-NEXT: 7 content of file0.c:7 |
| 90 | +# CHECK-NEXT: 8 content of file0.c:8 |
| 91 | +# CHECK-NEXT: 9 content of file0.c:9 |
| 92 | +# CHECK-NEXT: 10 content of file0.c:10 |
| 93 | + |
| 94 | + |
| 95 | +#--- a.s |
| 96 | + .file 0 "." "file0.c" |
| 97 | + .file 1 "." "file1.c" |
| 98 | + .text |
| 99 | +func0: |
| 100 | + .loc 0 1 |
| 101 | + nop |
| 102 | + .loc 0 5 |
| 103 | + nop |
| 104 | +.Lfunc0_end: |
| 105 | + |
| 106 | +func1: |
| 107 | + .loc 0 10 |
| 108 | + nop |
| 109 | + .loc 0 12 |
| 110 | + nop |
| 111 | +.Lfunc1_end: |
| 112 | + |
| 113 | +func2: |
| 114 | + .loc 0 25 |
| 115 | + nop |
| 116 | + .loc 0 30 |
| 117 | + nop |
| 118 | +.Lfunc2_end: |
| 119 | + |
| 120 | +func3: |
| 121 | + .loc 0 1 |
| 122 | + nop |
| 123 | + .loc 0 5 |
| 124 | + nop |
| 125 | + .loc 1 5 |
| 126 | + nop |
| 127 | +.Lfunc3_end: |
| 128 | + |
| 129 | +func4: |
| 130 | + .loc 0 0 |
| 131 | + nop |
| 132 | +.Lfunc4_end: |
| 133 | + |
| 134 | +func5.__part.1: |
| 135 | + .loc 0 1 |
| 136 | + nop |
| 137 | +.Lfunc5.__part.1_end: |
| 138 | + |
| 139 | +.Lpadding: |
| 140 | + nop |
| 141 | + |
| 142 | +func5: |
| 143 | + .loc 0 5 |
| 144 | + nop |
| 145 | +.Lfunc5_end: |
| 146 | + |
| 147 | +.Ltext_end: |
| 148 | + |
| 149 | + .section .debug_abbrev,"",@progbits |
| 150 | + .byte 1 # Abbreviation Code |
| 151 | + .byte 17 # DW_TAG_compile_unit |
| 152 | + .byte 1 # DW_CHILDREN_yes |
| 153 | + .byte 3 # DW_AT_name |
| 154 | + .byte 8 # DW_FORM_string |
| 155 | + .byte 37 # DW_AT_producer |
| 156 | + .byte 8 # DW_FORM_string |
| 157 | + .byte 19 # DW_AT_language |
| 158 | + .byte 5 # DW_FORM_data2 |
| 159 | + .byte 17 # DW_AT_low_pc |
| 160 | + .byte 1 # DW_FORM_addr |
| 161 | + .byte 18 # DW_AT_high_pc |
| 162 | + .byte 1 # DW_FORM_addr |
| 163 | + .byte 16 # DW_AT_stmt_list |
| 164 | + .byte 23 # DW_FORM_sec_offset |
| 165 | + .byte 0 # EOM(1) |
| 166 | + .byte 0 # EOM(2) |
| 167 | + .byte 2 # Abbreviation Code |
| 168 | + .byte 46 # DW_TAG_subprogram |
| 169 | + .byte 0 # DW_CHILDREN_no |
| 170 | + .byte 17 # DW_AT_low_pc |
| 171 | + .byte 1 # DW_FORM_addr |
| 172 | + .byte 18 # DW_AT_high_pc |
| 173 | + .byte 1 # DW_FORM_addr |
| 174 | + .byte 3 # DW_AT_name |
| 175 | + .byte 8 # DW_FORM_string |
| 176 | + .byte 0 # EOM(1) |
| 177 | + .byte 0 # EOM(2) |
| 178 | + .byte 3 # Abbreviation Code |
| 179 | + .byte 46 # DW_TAG_subprogram |
| 180 | + .byte 0 # DW_CHILDREN_no |
| 181 | + .byte 85 # DW_AT_ranges |
| 182 | + .byte 23 # DW_FORM_sec_offset |
| 183 | + .byte 3 # DW_AT_name |
| 184 | + .byte 8 # DW_FORM_string |
| 185 | + .byte 0 # EOM(1) |
| 186 | + .byte 0 # EOM(2) |
| 187 | + .byte 0 # EOM(3) |
| 188 | + .section .debug_info,"",@progbits |
| 189 | +.Lcu_begin0: |
| 190 | + .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit |
| 191 | +.Ldebug_info_start0: |
| 192 | + .short 5 # DWARF version number |
| 193 | + .byte 1 # DWARF Unit Type |
| 194 | + .byte 8 # Address Size (in bytes) |
| 195 | + .long .debug_abbrev # Offset Into Abbrev. Section |
| 196 | + .byte 1 # Abbrev DW_TAG_compile_unit |
| 197 | + .asciz "file0.c" # DW_AT_producer |
| 198 | + .asciz "Hand-written DWARF" # DW_AT_producer |
| 199 | + .short 29 # DW_AT_language |
| 200 | + .quad .text # DW_AT_low_pc |
| 201 | + .quad .Ltext_end # DW_AT_high_pc |
| 202 | + .long .Lline_table_start0 # DW_AT_stmt_list |
| 203 | + .rept 5 |
| 204 | + .byte 2 # Abbrev DW_TAG_subprogram |
| 205 | + .quad func\+ # DW_AT_low_pc |
| 206 | + .quad .Lfunc\+_end # DW_AT_high_pc |
| 207 | + .asciz "func\+" # DW_AT_name |
| 208 | + .endr |
| 209 | + .byte 3 # Abbrev DW_TAG_subprogram |
| 210 | + .long .Ldebug_ranges0 |
| 211 | + .asciz "func5" # DW_AT_name |
| 212 | + .byte 0 # End Of Children Mark |
| 213 | +.Ldebug_info_end0: |
| 214 | + |
| 215 | + .section .debug_rnglists,"",@progbits |
| 216 | + .long .Ldebug_list_header_end0-.Ldebug_list_header_start0 # Length |
| 217 | +.Ldebug_list_header_start0: |
| 218 | + .short 5 # Version |
| 219 | + .byte 8 # Address size |
| 220 | + .byte 0 # Segment selector size |
| 221 | + .long 2 # Offset entry count |
| 222 | +.Lrnglists_table_base0: |
| 223 | + .long .Ldebug_ranges0-.Lrnglists_table_base0 |
| 224 | +.Ldebug_ranges0: |
| 225 | + .byte 6 # DW_RLE_start_end |
| 226 | + .quad func5 |
| 227 | + .quad .Lfunc5_end |
| 228 | + .byte 6 # DW_RLE_start_end |
| 229 | + .quad func5.__part.1 |
| 230 | + .quad .Lfunc5.__part.1_end |
| 231 | + .byte 0 # DW_RLE_end_of_list |
| 232 | +.Ldebug_list_header_end0: |
| 233 | + .section .debug_line,"",@progbits |
| 234 | +.Lline_table_start0: |
| 235 | + |
| 236 | +#--- file0.c |
| 237 | +content of file0.c:1 |
| 238 | +content of file0.c:2 |
| 239 | +content of file0.c:3 |
| 240 | +content of file0.c:4 |
| 241 | +content of file0.c:5 |
| 242 | +content of file0.c:6 |
| 243 | +content of file0.c:7 |
| 244 | +content of file0.c:8 |
| 245 | +content of file0.c:9 |
| 246 | +content of file0.c:10 |
| 247 | +content of file0.c:11 |
| 248 | +content of file0.c:12 |
| 249 | +content of file0.c:13 |
| 250 | +content of file0.c:14 |
| 251 | +content of file0.c:15 |
| 252 | +content of file0.c:16 |
| 253 | +content of file0.c:17 |
| 254 | +content of file0.c:18 |
| 255 | +content of file0.c:19 |
| 256 | +content of file0.c:20 |
| 257 | +content of file0.c:21 |
| 258 | +content of file0.c:22 |
| 259 | +content of file0.c:23 |
| 260 | +content of file0.c:24 |
| 261 | +content of file0.c:25 |
| 262 | +content of file0.c:26 |
| 263 | +content of file0.c:27 |
| 264 | +content of file0.c:28 |
| 265 | +content of file0.c:29 |
| 266 | +content of file0.c:30 |
| 267 | +#--- file1.c |
| 268 | +content of file1.c:1 |
| 269 | +content of file1.c:2 |
| 270 | +content of file1.c:3 |
| 271 | +content of file1.c:4 |
| 272 | +content of file1.c:5 |
| 273 | +content of file1.c:6 |
| 274 | +content of file1.c:7 |
| 275 | +content of file1.c:8 |
| 276 | +content of file1.c:9 |
| 277 | +content of file1.c:10 |
0 commit comments