debug-names-hash-collisions.ll 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. ; REQUIRES: object-emission
  2. ; RUN: %llc_dwarf -accel-tables=Dwarf -filetype=obj -o %t < %s
  3. ; RUN: llvm-dwarfdump -debug-names %t | FileCheck %s
  4. ; RUN: llvm-dwarfdump -debug-names -verify %t | FileCheck --check-prefix=VERIFY %s
  5. ; Generated from the following C code using
  6. ; clang -S -emit-llvm -g col.c
  7. ;
  8. ; These names were carefully chosen to cause hash collisions. Each type-variable
  9. ; pair will hash to the same value. The also happen to demonstrate a flaw in the
  10. ; DWARF v5 hash function: A copy constructor and an assignment operator for a
  11. ; class will always hash to the same value.
  12. ;
  13. ; typedef void *_ZN4lldb7SBBlockaSERKS0_;
  14. ; _ZN4lldb7SBBlockaSERKS0_ _ZN4lldb7SBBlockC1ERKS0_;
  15. ; typedef void *_ZN4lldb7SBErroraSERKS0_;
  16. ; _ZN4lldb7SBErroraSERKS0_ _ZN4lldb7SBErrorC1ERKS0_;
  17. ; typedef void *_ZN4lldb7SBValueaSERKS0_;
  18. ; _ZN4lldb7SBValueaSERKS0_ _ZN4lldb7SBValueC1ERKS0_;
  19. ; typedef void *_ZL11numCommutes;
  20. ; _ZL11numCommutes _ZL11NumCommutes;
  21. ; typedef void *_ZL9NumRemats;
  22. ; _ZL9NumRemats _ZL9NumReMats;
  23. ; Check that we have the right amount of hashes and names.
  24. ; CHECK: Bucket count: 5
  25. ; CHECK: Name count: 10
  26. ; Check that all the names are present in the output
  27. ; CHECK: Bucket 0
  28. ; CHECK: Hash: 0xF8CF70D
  29. ; CHECK-NEXT:String: 0x{{[0-9a-f]*}} "_ZN4lldb7SBBlockaSERKS0_"
  30. ; CHECK: Hash: 0xF8CF70D
  31. ; CHECK-NEXT:String: 0x{{[0-9a-f]*}} "_ZN4lldb7SBBlockC1ERKS0_"
  32. ; CHECK: Hash: 0x135A482C
  33. ; CHECK-NEXT:String: 0x{{[0-9a-f]*}} "_ZN4lldb7SBErroraSERKS0_"
  34. ; CHECK: Hash: 0x135A482C
  35. ; CHECK-NEXT:String: 0x{{[0-9a-f]*}} "_ZN4lldb7SBErrorC1ERKS0_"
  36. ; CHECK-NOT: String:
  37. ; CHECK: Bucket 1
  38. ; CHECK-NEXT: EMPTY
  39. ; CHECK: Bucket 2
  40. ; CHECK: Hash: 0x2841B989
  41. ; CHECK-NEXT:String: 0x{{[0-9a-f]*}} "_ZL11numCommutes"
  42. ; CHECK: Hash: 0x2841B989
  43. ; CHECK-NEXT:String: 0x{{[0-9a-f]*}} "_ZL11NumCommutes"
  44. ; CHECK: Hash: 0x3E190F5F
  45. ; CHECK-NEXT:String: 0x{{[0-9a-f]*}} "_ZL9NumRemats"
  46. ; CHECK: Hash: 0x3E190F5F
  47. ; CHECK-NEXT:String: 0x{{[0-9a-f]*}} "_ZL9NumReMats"
  48. ; CHECK-NOT: String:
  49. ; CHECK: Bucket 3
  50. ; CHECK: Hash: 0x2642207F
  51. ; CHECK-NEXT:String: 0x{{[0-9a-f]*}} "_ZN4lldb7SBValueaSERKS0_"
  52. ; CHECK: Hash: 0x2642207F
  53. ; CHECK-NEXT:String: 0x{{[0-9a-f]*}} "_ZN4lldb7SBValueC1ERKS0_"
  54. ; CHECK-NOT: String:
  55. ; CHECK: Bucket 4
  56. ; CHECK-NEXT: EMPTY
  57. ; VERIFY: No errors.
  58. @_ZN4lldb7SBBlockC1ERKS0_ = common dso_local global i8* null, align 8, !dbg !0
  59. @_ZN4lldb7SBErrorC1ERKS0_ = common dso_local global i8* null, align 8, !dbg !6
  60. @_ZN4lldb7SBValueC1ERKS0_ = common dso_local global i8* null, align 8, !dbg !10
  61. @_ZL11NumCommutes = common dso_local global i8* null, align 8, !dbg !13
  62. @_ZL9NumReMats = common dso_local global i8* null, align 8, !dbg !16
  63. !llvm.dbg.cu = !{!2}
  64. !llvm.module.flags = !{!20, !21, !22}
  65. !llvm.ident = !{!23}
  66. !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
  67. !1 = distinct !DIGlobalVariable(name: "_ZN4lldb7SBBlockC1ERKS0_", scope: !2, file: !3, line: 1, type: !19, isLocal: false, isDefinition: true)
  68. !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 7.0.0 (trunk 325496) (llvm/trunk 325732)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
  69. !3 = !DIFile(filename: "/tmp/col.c", directory: "/tmp")
  70. !4 = !{}
  71. !5 = !{!0, !6, !10, !13, !16}
  72. !6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
  73. !7 = distinct !DIGlobalVariable(name: "_ZN4lldb7SBErrorC1ERKS0_", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: true)
  74. !8 = !DIDerivedType(tag: DW_TAG_typedef, name: "_ZN4lldb7SBErroraSERKS0_", file: !3, line: 2, baseType: !9)
  75. !9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
  76. !10 = !DIGlobalVariableExpression(var: !11, expr: !DIExpression())
  77. !11 = distinct !DIGlobalVariable(name: "_ZN4lldb7SBValueC1ERKS0_", scope: !2, file: !3, line: 3, type: !12, isLocal: false, isDefinition: true)
  78. !12 = !DIDerivedType(tag: DW_TAG_typedef, name: "_ZN4lldb7SBValueaSERKS0_", file: !3, line: 3, baseType: !9)
  79. !13 = !DIGlobalVariableExpression(var: !14, expr: !DIExpression())
  80. !14 = distinct !DIGlobalVariable(name: "_ZL11NumCommutes", scope: !2, file: !3, line: 4, type: !15, isLocal: false, isDefinition: true)
  81. !15 = !DIDerivedType(tag: DW_TAG_typedef, name: "_ZL11numCommutes", file: !3, line: 4, baseType: !9)
  82. !16 = !DIGlobalVariableExpression(var: !17, expr: !DIExpression())
  83. !17 = distinct !DIGlobalVariable(name: "_ZL9NumReMats", scope: !2, file: !3, line: 5, type: !18, isLocal: false, isDefinition: true)
  84. !18 = !DIDerivedType(tag: DW_TAG_typedef, name: "_ZL9NumRemats", file: !3, line: 5, baseType: !9)
  85. !19 = !DIDerivedType(tag: DW_TAG_typedef, name: "_ZN4lldb7SBBlockaSERKS0_", file: !3, line: 1, baseType: !9)
  86. !20 = !{i32 2, !"Dwarf Version", i32 4}
  87. !21 = !{i32 2, !"Debug Info Version", i32 3}
  88. !22 = !{i32 1, !"wchar_size", i32 4}
  89. !23 = !{!"clang version 7.0.0 (trunk 325496) (llvm/trunk 325732)"}