define weak i32 @foo(i32 %a, i32 %b) {
entry:
- %sum = call i32 @fastadd(i32 %a, i32 %b), !dbg !MDLocation(line: 2, scope: !3)
- ret i32 %sum, !dbg !MDLocation(line: 3, scope: !3)
+ %sum = call i32 @fastadd(i32 %a, i32 %b), !dbg !MDLocation(line: 52, scope: !3)
+ ret i32 %sum, !dbg !MDLocation(line: 53, scope: !3)
}
declare i32 @fastadd(i32, i32)
!llvm.dbg.cu = !{!1}
!1 = !MDCompileUnit(language: DW_LANG_C99, file: !2, subprograms: !{!3}, emissionKind: 2)
!2 = !MDFile(filename: "foo.c", directory: "/path/to/dir")
-!3 = !MDSubprogram(file: !2, scope: !2, line: 1, name: "foo", function: i32 (i32, i32)* @foo, type: !4)
+!3 = !MDSubprogram(file: !2, scope: !2, line: 51, name: "foo", function: i32 (i32, i32)* @foo, type: !4)
!4 = !MDSubroutineType(types: !{})
; LW: ![[FOOINBAR]] = !MDLocation(line: 2, scope: ![[FOOSP]], inlinedAt: ![[BARIA:[0-9]+]])
; LW: ![[BARIA]] = !MDLocation(line: 12, scope: ![[BARSP]])
; LW: ![[BARRET]] = !MDLocation(line: 13, scope: ![[BARSP]])
-; LW: ![[FOOCALL]] = !MDLocation(line: 2, scope: ![[WEAKFOOSP]])
-; LW: ![[FOORET]] = !MDLocation(line: 3, scope: ![[WEAKFOOSP]])
+; LW: ![[FOOCALL]] = !MDLocation(line: 52, scope: ![[WEAKFOOSP]])
+; LW: ![[FOORET]] = !MDLocation(line: 53, scope: ![[WEAKFOOSP]])
; Same as above, but reordered.
; WL: ![[WCU]] = !MDCompileUnit({{.*}} subprograms: ![[WSPs:[0-9]+]]
; WL: ![[FOOSP]] = {{.*}}!MDSubprogram(name: "foo",
; Note, for symmetry, this should be "NOT: function:" and "SAME: ){{$}}".
; WL-SAME: function: i32 (i32, i32)* @foo
-; WL: ![[FOOCALL]] = !MDLocation(line: 2, scope: ![[WEAKFOOSP]])
-; WL: ![[FOORET]] = !MDLocation(line: 3, scope: ![[WEAKFOOSP]])
+; WL: ![[FOOCALL]] = !MDLocation(line: 52, scope: ![[WEAKFOOSP]])
+; WL: ![[FOORET]] = !MDLocation(line: 53, scope: ![[WEAKFOOSP]])
; WL: ![[FOOINBAR]] = !MDLocation(line: 2, scope: ![[FOOSP]], inlinedAt: ![[BARIA:[0-9]+]])
; WL: ![[BARIA]] = !MDLocation(line: 12, scope: ![[BARSP]])
; WL: ![[BARRET]] = !MDLocation(line: 13, scope: ![[BARSP]])
; Crasher for llc.
; REQUIRES: object-emission
; RUN: %llc_dwarf -filetype=obj -O0 %t1 -o %t1.o
-; RUNDISABLED: llvm-dwarfdump %t1.o -debug-dump=info | FileCheck %s -check-prefix=DWLW
+; RUN: llvm-dwarfdump %t1.o -debug-dump=all | FileCheck %s -check-prefix=DWLW -check-prefix=DW
; RUN: %llc_dwarf -filetype=obj -O0 %t2 -o %t2.o
-; RUNDISABLED: llvm-dwarfdump %t2.o -debug-dump=info | FileCheck %s -check-prefix=DWWL
-; Getting different dwarfdump output on different platforms, so I've
-; temporarily disabled the Dwarf FileChecks while leaving in the crash tests.
-; I'll keep using PR22792 to track this.
+; RUN: llvm-dwarfdump %t2.o -debug-dump=all | FileCheck %s -check-prefix=DWWL -check-prefix=DW
+; Don't check for the DW_TAG_subprogram for the weak version of @foo. It has
+; no inlined subroutines, so with -gmlt may not exist (debuggers can find the
+; aranges in the compile unit and look in the line table directly). See the
+; checks against the line table that follow.
+; DW-LABEL: .debug_info contents:
; DWLW: DW_TAG_compile_unit
; DWLW: DW_AT_name {{.*}}"bar.c"
+; DWLW: DW_AT_low_pc [DW_FORM_addr] ([[BARLOW:0x[0-9a-f]+]])
; DWLW: DW_TAG_subprogram
; DWLW-NOT: DW_AT_{{[lowhigh]*}}_pc
; DWLW: DW_AT_name {{.*}}foo
; DWLW: DW_AT_abstract_origin
; DWLW: DW_TAG_compile_unit
; DWLW: DW_AT_name {{.*}}"foo.c"
-; DWLW: DW_TAG_subprogram
-; DWLW: DW_AT_low_pc
-; DWLW: DW_AT_high_pc
-; DWLW: DW_AT_name {{.*}}foo
+; DWLW: DW_AT_low_pc [DW_FORM_addr] ([[FOOLOW:0x[0-9a-f]+]])
; The DWARF output is already symmetric (just reordered).
; DWWL: DW_TAG_compile_unit
; DWWL: DW_AT_name {{.*}}"foo.c"
-; DWWL: DW_TAG_subprogram
-; DWWL: DW_AT_low_pc
-; DWWL: DW_AT_high_pc
-; DWWL: DW_AT_name {{.*}}foo
+; DWWL: DW_AT_low_pc [DW_FORM_addr] ([[FOOLOW:0x[0-9a-f]+]])
; DWWL: DW_TAG_compile_unit
; DWWL: DW_AT_name {{.*}}"bar.c"
+; DWWL: DW_AT_low_pc [DW_FORM_addr] ([[BARLOW:0x[0-9a-f]+]])
; DWWL: DW_TAG_subprogram
; DWWL-NOT: DW_AT_{{[lowhigh]*}}_pc
; DWWL: DW_AT_name {{.*}}foo
; DWWL: DW_AT_name {{.*}}bar
; DWWL: DW_TAG_inlined_subroutine
; DWWL: DW_AT_abstract_origin
+
+; DW-LABEL: .debug_line contents:
+; Check that the low_pc entries from above hit the right files.
+
+; DWLW-LABEL: file_names[{{ *}}1]{{.*}} bar.c
+; DWLW: [[BARLOW]] 0 0 1 0 0 is_stmt
+; DWLW: [[BARLOW]] 2 0 1 0 0 is_stmt prologue_end
+; DWLW-LABEL: file_names[{{ *}}1]{{.*}} foo.c
+; DWLW: [[FOOLOW]] 0 0 1 0 0 is_stmt
+; DWLW: [[FOOLOW]] 52 0 1 0 0 is_stmt prologue_end
+
+; DWWL-LABEL: file_names[{{ *}}1]{{.*}} foo.c
+; DWWL: [[FOOLOW]] 0 0 1 0 0 is_stmt
+; DWWL: [[FOOLOW]] 52 0 1 0 0 is_stmt prologue_end
+; DWWL-LABEL: file_names[{{ *}}1]{{.*}} bar.c
+; DWWL: [[BARLOW]] 0 0 1 0 0 is_stmt
+; DWWL: [[BARLOW]] 2 0 1 0 0 is_stmt prologue_end