diff options
author | Eric Christopher <echristo@gmail.com> | 2013-01-04 21:51:53 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2013-01-04 21:51:53 +0000 |
commit | 8cab6edf4fa46d9bd06ff3ce0e1dd4557be58b65 (patch) | |
tree | 90c368a3ea8fd557e536af31dec0fd0ec3ba51b7 | |
parent | 715f6a62a17f1e26a7c3f673b70bf44c99ae7cae (diff) | |
download | external_llvm-8cab6edf4fa46d9bd06ff3ce0e1dd4557be58b65.zip external_llvm-8cab6edf4fa46d9bd06ff3ce0e1dd4557be58b65.tar.gz external_llvm-8cab6edf4fa46d9bd06ff3ce0e1dd4557be58b65.tar.bz2 |
Add a name for the anonymous type we're creating for subrange
types and a FIXME for what we should be doing. Should solve the
immediacy of PR12069 where our debug info is crashing another
tool.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171536 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 3 | ||||
-rw-r--r-- | test/DebugInfo/X86/empty-and-one-elem-array.ll | 36 | ||||
-rw-r--r-- | test/DebugInfo/X86/empty-array.ll | 19 | ||||
-rw-r--r-- | test/DebugInfo/X86/nondefault-subrange-array.ll | 31 | ||||
-rw-r--r-- | test/DebugInfo/X86/subrange-type.ll | 39 |
5 files changed, 86 insertions, 42 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 8caf4b9..3b9ce65 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -1329,10 +1329,13 @@ void CompileUnit::constructArrayTypeDIE(DIE &Buffer, DIArray Elements = CTy->getTypeArray(); // Get an anonymous type for index type. + // FIXME: This type should be passed down from the front end + // as different languages may have different sizes for indexes. DIE *IdxTy = getIndexTyDie(); if (!IdxTy) { // Construct an anonymous type for index type. IdxTy = new DIE(dwarf::DW_TAG_base_type); + addString(IdxTy, dwarf::DW_AT_name, "int"); addUInt(IdxTy, dwarf::DW_AT_byte_size, 0, sizeof(int32_t)); addUInt(IdxTy, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, dwarf::DW_ATE_signed); diff --git a/test/DebugInfo/X86/empty-and-one-elem-array.ll b/test/DebugInfo/X86/empty-and-one-elem-array.ll index b9224b1..0744c6b 100644 --- a/test/DebugInfo/X86/empty-and-one-elem-array.ll +++ b/test/DebugInfo/X86/empty-and-one-elem-array.ll @@ -29,33 +29,33 @@ declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone ; should. ; CHECK: 0x00000074: DW_TAG_base_type [5] -; CHECK-NEXT: 0x00000075: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000043] = "int") -; CHECK-NEXT: 0x00000079: DW_AT_encoding [DW_FORM_data1] (0x05) -; CHECK-NEXT: 0x0000007a: DW_AT_byte_size [DW_FORM_data1] (0x04) +; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000043] = "int") +; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (0x05) +; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x04) ; int[1]: -; CHECK: 0x0000007e: DW_TAG_array_type [7] * -; CHECK-NEXT: 0x0000007f: DW_AT_type [DW_FORM_ref4] (cu + 0x0074 => {0x00000074}) -; CHECK: 0x00000083: DW_TAG_subrange_type [8] -; CHECK-NEXT: 0x00000084: DW_AT_type [DW_FORM_ref4] (cu + 0x007b => {0x0000007b}) -; CHECK-NEXT: 0x00000088: DW_AT_upper_bound [DW_FORM_data1] (0x00) +; CHECK: 0x00000082: DW_TAG_array_type [7] * +; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0074 => {0x00000074}) +; CHECK: 0x00000087: DW_TAG_subrange_type [8] +; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x007b => {0x0000007b}) +; CHECK-NEXT: DW_AT_upper_bound [DW_FORM_data1] (0x00) ; int foo::b[1]: -; CHECK: 0x000000a1: DW_TAG_member [10] -; CHECK-NEXT: 0x000000a2: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000050] = "b") -; CHECK-NEXT: 0x000000a6: DW_AT_type [DW_FORM_ref4] (cu + 0x007e => {0x0000007e}) +; CHECK: 0x000000a5: DW_TAG_member [10] +; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000050] = "b") +; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0082 => {0x00000082}) ; int[0]: -; CHECK: 0x000000b1: DW_TAG_array_type [7] * -; CHECK-NEXT: 0x000000b2: DW_AT_type [DW_FORM_ref4] (cu + 0x0074 => {0x00000074}) -; CHECK: 0x000000b6: DW_TAG_subrange_type [11] -; CHECK-NEXT: 0x000000b7: DW_AT_type [DW_FORM_ref4] (cu + 0x007b => {0x0000007b}) +; CHECK: 0x000000b5: DW_TAG_array_type [7] * +; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0074 => {0x00000074}) +; CHECK: 0x000000ba: DW_TAG_subrange_type [11] +; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x007b => {0x0000007b}) ; CHECK-NOT: DW_AT_upper_bound ; int bar::b[0]: -; CHECK: 0x000000d3: DW_TAG_member [10] -; CHECK-NEXT: 0x000000d4: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000050] = "b") -; CHECK-NEXT: 0x000000d8: DW_AT_type [DW_FORM_ref4] (cu + 0x00b1 => {0x000000b1}) +; CHECK: 0x000000d7: DW_TAG_member [10] +; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000050] = "b") +; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x00b5 => {0x000000b5}) !llvm.dbg.cu = !{!0} diff --git a/test/DebugInfo/X86/empty-array.ll b/test/DebugInfo/X86/empty-array.ll index cd96847..dd5c636 100644 --- a/test/DebugInfo/X86/empty-array.ll +++ b/test/DebugInfo/X86/empty-array.ll @@ -7,19 +7,20 @@ @a = global %class.A zeroinitializer, align 4 ; CHECK: 0x0000002d: DW_TAG_base_type [3] -; CHECK-NEXT: 0x0000002e: DW_AT_byte_size [DW_FORM_data1] (0x04) -; CHECK-NEXT: 0x0000002f: DW_AT_encoding [DW_FORM_data1] (0x05) +; CHECK-NEXT: DW_AT_name +; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x04) +; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (0x05) -; CHECK: 0x00000030: DW_TAG_array_type [4] * -; CHECK-NEXT: 0x00000031: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x00000026}) +; CHECK: 0x00000034: DW_TAG_array_type [4] * +; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x00000026}) -; CHECK: 0x00000035: DW_TAG_subrange_type [5] -; CHECK-NEXT: 0x00000036: DW_AT_type [DW_FORM_ref4] (cu + 0x002d => {0x0000002d}) +; CHECK: 0x00000039: DW_TAG_subrange_type [5] +; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x002d => {0x0000002d}) ; CHECK-NOT: DW_AT_upper_bound -; CHECK: 0x00000048: DW_TAG_member [8] -; CHECK-NEXT: 0x00000049: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000003f] = "x") -; CHECK-NEXT: 0x0000004d: DW_AT_type [DW_FORM_ref4] (cu + 0x0030 => {0x00000030}) +; CHECK: DW_TAG_member [8] +; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000003f] = "x") +; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0034 => {0x00000034}) !llvm.dbg.cu = !{!0} diff --git a/test/DebugInfo/X86/nondefault-subrange-array.ll b/test/DebugInfo/X86/nondefault-subrange-array.ll index 5845f3e..6247cc3 100644 --- a/test/DebugInfo/X86/nondefault-subrange-array.ll +++ b/test/DebugInfo/X86/nondefault-subrange-array.ll @@ -8,21 +8,22 @@ ; Check that we can handle non-default array bounds. In this case, the array ; goes from [-3, 38]. -; CHECK: 0x0000002d: DW_TAG_base_type [3] -; CHECK-NEXT: 0x0000002e: DW_AT_byte_size [DW_FORM_data1] (0x04) -; CHECK-NEXT: 0x0000002f: DW_AT_encoding [DW_FORM_data1] (0x05) - -; CHECK: 0x00000030: DW_TAG_array_type [4] * -; CHECK-NEXT: 0x00000031: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x00000026}) - -; CHECK: 0x00000035: DW_TAG_subrange_type [5] -; CHECK-NEXT: 0x00000036: DW_AT_type [DW_FORM_ref4] (cu + 0x002d => {0x0000002d}) -; CHECK-NEXT: 0x0000003a: DW_AT_lower_bound [DW_FORM_data8] (0xfffffffffffffffd) -; CHECK-NEXT: 0x00000042: DW_AT_upper_bound [DW_FORM_data1] (0x26) - -; CHECK: 0x00000051: DW_TAG_member [8] -; CHECK-NEXT: 0x00000052: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000003f] = "x") -; CHECK-NEXT: 0x00000056: DW_AT_type [DW_FORM_ref4] (cu + 0x0030 => {0x00000030}) +; CHECK: 0x0000002d: DW_TAG_base_type [3] +; CHECK-NEXT: 0x0000002e: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000041] = "int") +; CHECK-NEXT: 0x00000032: DW_AT_byte_size [DW_FORM_data1] (0x04) +; CHECK-NEXT: 0x00000033: DW_AT_encoding [DW_FORM_data1] (0x05) + +; CHECK: 0x00000034: DW_TAG_array_type [4] * +; CHECK-NEXT: 0x00000035: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x00000026}) + +; CHECK: 0x00000039: DW_TAG_subrange_type [5] +; CHECK-NEXT: 0x0000003a: DW_AT_type [DW_FORM_ref4] (cu + 0x002d => {0x0000002d}) +; CHECK-NEXT: 0x0000003e: DW_AT_lower_bound [DW_FORM_data8] (0xfffffffffffffffd) +; CHECK-NEXT: 0x00000046: DW_AT_upper_bound [DW_FORM_data1] (0x26) + +; CHECK: 0x00000055: DW_TAG_member [8] +; CHECK-NEXT: 0x00000056: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000003f] = "x") +; CHECK-NEXT: 0x0000005a: DW_AT_type [DW_FORM_ref4] (cu + 0x0034 => {0x00000034}) !llvm.dbg.cu = !{!0} diff --git a/test/DebugInfo/X86/subrange-type.ll b/test/DebugInfo/X86/subrange-type.ll new file mode 100644 index 0000000..15202fb --- /dev/null +++ b/test/DebugInfo/X86/subrange-type.ll @@ -0,0 +1,39 @@ +; RUN: llc -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t +; RUN: llvm-dwarfdump %t | FileCheck %s + +; Make sure that the base type from the subrange type has a name. +; CHECK: 0x0000006b: DW_TAG_base_type [6] +; CHECK-NEXT: DW_AT_name +; CHECK: DW_TAG_subrange_type [8] +; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x006b => {0x0000006b}) + +define i32 @main() nounwind uwtable { +entry: + %retval = alloca i32, align 4 + %i = alloca [2 x i32], align 4 + store i32 0, i32* %retval + call void @llvm.dbg.declare(metadata !{[2 x i32]* %i}, metadata !10), !dbg !15 + ret i32 0, !dbg !16 +} + +declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone + +!llvm.dbg.cu = !{!0} + +!0 = metadata !{i32 786449, i32 0, i32 12, metadata !"foo.c", metadata !"/usr/local/google/home/echristo/tmp", metadata !"clang version 3.3 (trunk 171472) (llvm/trunk 171487)", i1 true, i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !3, metadata !1} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/echristo/tmp/foo.c] [DW_LANG_C99] +!1 = metadata !{metadata !2} +!2 = metadata !{i32 0} +!3 = metadata !{metadata !4} +!4 = metadata !{metadata !5} +!5 = metadata !{i32 786478, i32 0, metadata !6, metadata !"main", metadata !"main", metadata !"", metadata !6, i32 2, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @main, null, null, metadata !1, i32 3} ; [ DW_TAG_subprogram ] [line 2] [def] [scope 3] [main] +!6 = metadata !{i32 786473, metadata !"foo.c", metadata !"/usr/local/google/home/echristo/tmp", null} ; [ DW_TAG_file_type ] +!7 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] +!8 = metadata !{metadata !9} +!9 = metadata !{i32 786468, null, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] +!10 = metadata !{i32 786688, metadata !11, metadata !"i", metadata !6, i32 4, metadata !12, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [i] [line 4] +!11 = metadata !{i32 786443, metadata !5, i32 3, i32 0, metadata !6, i32 0} ; [ DW_TAG_lexical_block ] [/usr/local/google/home/echristo/tmp/foo.c] +!12 = metadata !{i32 786433, null, metadata !"", null, i32 0, i64 64, i64 32, i32 0, i32 0, metadata !9, metadata !13, i32 0, i32 0} ; [ DW_TAG_array_type ] [line 0, size 64, align 32, offset 0] [from int] +!13 = metadata !{metadata !14} +!14 = metadata !{i32 786465, i64 0, i64 2} ; [ DW_TAG_subrange_type ] [0, 1] +!15 = metadata !{i32 4, i32 0, metadata !11, null} +!16 = metadata !{i32 6, i32 0, metadata !11, null} |