llvm.org GIT mirror llvm / 1d68fc5
DebugInfo: Omit is_stmt from line table entries on the same line. GCC does this for non-zero discriminators and since GCC doesn't produce column info, that was the only place it comes up there. For LLVM, since we can emit discriminators and/or column info, it makes more sense to invert the condition and just test for changes in line number. This should resolve at least some of the GDB 7.5 test suite failures created by recent Clang changes that increase the location fidelity (which, since Clang defaults to including column info on Linux by default created a bunch of cases that confused GDB). In theory we could do this better/differently by grouping actual source statements together in a similar manner to the way lexical scopes are handled but given that GDB isn't really in a position to consume that (& users are probably somewhat used to different lines being different 'statements') this seems the safest and cheapest change. (I'm concerned that doing this 'right' would bloat the debugloc data even further - something Duncan's working hard to address) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225011 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 5 years ago
4 changed file(s) with 87 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
10251025 if (DL == PrologEndLoc) {
10261026 Flags |= DWARF2_FLAG_PROLOGUE_END;
10271027 PrologEndLoc = DebugLoc();
1028 Flags |= DWARF2_FLAG_IS_STMT;
10281029 }
1029 if (PrologEndLoc.isUnknown())
1030 if (DL.getLine() !=
1031 Asm->OutStreamer.getContext().getCurrentDwarfLoc().getLine())
10301032 Flags |= DWARF2_FLAG_IS_STMT;
10311033
10321034 if (!DL.isUnknown()) {
871871 unsigned Isa,
872872 unsigned Discriminator,
873873 StringRef FileName) {
874 this->MCStreamer::EmitDwarfLocDirective(FileNo, Line, Column, Flags,
875 Isa, Discriminator, FileName);
876874 OS << "\t.loc\t" << FileNo << " " << Line << " " << Column;
877875 if (Flags & DWARF2_FLAG_BASIC_BLOCK)
878876 OS << " basic_block";
902900 << Line << ':' << Column;
903901 }
904902 EmitEOL();
903 this->MCStreamer::EmitDwarfLocDirective(FileNo, Line, Column, Flags,
904 Isa, Discriminator, FileName);
905905 }
906906
907907 MCSymbol *MCAsmStreamer::getDwarfLineTableSymbol(unsigned CUID) {
5959
6060 ; CHECK: Address Line Column File ISA Discriminator Flags
6161 ; CHECK: ------------------ ------ ------ ------ --- ------------- -------------
62 ; CHECK: 0x0000000000000011 2 0 1 0 42 is_stmt
62 ; CHECK: 0x0000000000000011 2 0 1 0 42 {{$}}
0 ; RUN: llc -filetype=asm -O0 < %s | FileCheck %s
1 ; RUN: llc -filetype=obj -O0 < %s | llvm-dwarfdump -debug-dump=line - | FileCheck %s --check-prefix=INT
2
3 ; Check that the assembly output properly handles is_stmt changes. And since
4 ; we're testing anyway, check the integrated assembler too.
5
6 ; Generated with clang from multiline.c:
7 ; void f1();
8 ; void f2() {
9 ; f1(); f1(); f1();
10 ; f1(); f1(); f1();
11 ; }
12
13
14 ; CHECK: .loc 1 2 0 #
15 ; CHECK-NOT: .loc
16 ; CHECK: .loc 1 3 3 prologue_end #
17 ; CHECK-NOT: .loc
18 ; CHECK: .loc 1 3 9 is_stmt 0 #
19 ; CHECK-NOT: .loc
20 ; CHECK: .loc 1 3 15 #
21 ; CHECK-NOT: .loc
22 ; CHECK: .loc 1 4 3 is_stmt 1 #
23 ; CHECK-NOT: .loc
24 ; CHECK: .loc 1 4 9 is_stmt 0 #
25 ; CHECK-NOT: .loc
26 ; CHECK: .loc 1 4 15 #
27 ; CHECK-NOT: .loc
28 ; CHECK: .loc 1 5 1 is_stmt 1 #
29
30 ; INT: {{^}}Address
31 ; INT: -----
32 ; INT-NEXT: 2 0 1 0 0 is_stmt{{$}}
33 ; INT-NEXT: 3 3 1 0 0 is_stmt prologue_end{{$}}
34 ; INT-NEXT: 3 9 1 0 0 {{$}}
35 ; INT-NEXT: 3 15 1 0 0 {{$}}
36 ; INT-NEXT: 4 3 1 0 0 is_stmt{{$}}
37 ; INT-NEXT: 4 9 1 0 0 {{$}}
38 ; INT-NEXT: 4 15 1 0 0 {{$}}
39 ; INT-NEXT: 5 1 1 0 0 is_stmt{{$}}
40
41
42 ; Function Attrs: nounwind uwtable
43 define void @f2() #0 {
44 entry:
45 call void (...)* @f1(), !dbg !11
46 call void (...)* @f1(), !dbg !12
47 call void (...)* @f1(), !dbg !13
48 call void (...)* @f1(), !dbg !14
49 call void (...)* @f1(), !dbg !15
50 call void (...)* @f1(), !dbg !16
51 ret void, !dbg !17
52 }
53
54 declare void @f1(...) #1
55
56 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
57 attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
58
59 !llvm.dbg.cu = !{!0}
60 !llvm.module.flags = !{!8, !9}
61 !llvm.ident = !{!10}
62
63 !0 = !{!"0x11\0012\00clang version 3.6.0 (trunk 225000) (llvm/trunk 224999)\000\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [/tmp/dbginfo/multiline.c] [DW_LANG_C99]
64 !1 = !{!"multiline.c", !"/tmp/dbginfo"}
65 !2 = !{}
66 !3 = !{!4}
67 !4 = !{!"0x2e\00f2\00f2\00\002\000\001\000\000\000\000\002", !1, !5, !6, null, void ()* @f2, null, null, !2} ; [ DW_TAG_subprogram ] [line 2] [def] [f2]
68 !5 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [/tmp/dbginfo/multiline.c]
69 !6 = !{!"0x15\00\000\000\000\000\000\000", null, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
70 !7 = !{null}
71 !8 = !{i32 2, !"Dwarf Version", i32 4}
72 !9 = !{i32 2, !"Debug Info Version", i32 2}
73 !10 = !{!"clang version 3.6.0 (trunk 225000) (llvm/trunk 224999)"}
74 !11 = !{i32 3, i32 3, !4, null}
75 !12 = !{i32 3, i32 9, !4, null}
76 !13 = !{i32 3, i32 15, !4, null}
77 !14 = !{i32 4, i32 3, !4, null}
78 !15 = !{i32 4, i32 9, !4, null}
79 !16 = !{i32 4, i32 15, !4, null}
80 !17 = !{i32 5, i32 1, !4, null}