Commit 84e5760a authored by Sourabh Singh Tomar's avatar Sourabh Singh Tomar
Browse files

[DebugInfo]: Reorderd the emission of debug_str section.

Summary:
This patch reorders the emission of debug_str section, so that
string can come after macros.
This is necessary for macro forms like DW_MACRO_define_strp,
which emits macro as a string in debug_str section.
parent ae4e4986
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1260,8 +1260,6 @@ void DwarfDebug::endModule() {
  // Finalize the debug info for the module.
  finalizeModuleInfo();

  emitDebugStr();

  if (useSplitDwarf())
    // Emit debug_loc.dwo/debug_loclists.dwo section.
    emitDebugLocDWO();
@@ -1289,6 +1287,8 @@ void DwarfDebug::endModule() {
  // Emit info into a debug macinfo section.
    emitDebugMacinfo();

  emitDebugStr();

  if (useSplitDwarf()) {
    emitDebugStrDWO();
    emitDebugInfoDWO();
+3 −5
Original line number Diff line number Diff line
@@ -18,9 +18,6 @@
# CHECK-NEXT: .Ltmp6:
# CHECK: .Lfunc_end0:
#
# CHECK: .Linfo_string7:
# CHECK-NEXT: .asciz  "local1"
#
# CHECK: .Ldebug_loc2:
# CHECK-NEXT: .quad   .Ltmp1-.Lfunc_begin0
# CHECK-NEXT: .quad   .Ltmp4-.Lfunc_begin0
@@ -34,8 +31,9 @@
#
# CHECK: .long   .Ldebug_loc2            # DW_AT_location
# CHECK-NEXT: .long   .Linfo_string7          # DW_AT_name


#
# CHECK: .Linfo_string7:
# CHECK-NEXT: .asciz  "local1"
--- |
  ; ModuleID = 'dbg-stack-value-range.ll'
  source_filename = "dbg-stack-value-range.c"
+8 −6
Original line number Diff line number Diff line
@@ -14,11 +14,6 @@ source_filename = "test/DebugInfo/X86/stringpool.ll"
!3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!4 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 3.1 (trunk 143009)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !6, imports: !5)
!5 = !{}
; Verify that "yyyy" ended up in the stringpool.
; LINUX: .section .debug_str,"MS",@progbits,1
; LINUX: yyyy
; DARWIN: .section __DWARF,__debug_str,regular,debug
; DARWIN: .asciz "yyyy" ## string offset=[[YYYY:[0-9]+]]

; Verify that we refer to 'yyyy' with a relocation.
; LINUX:      .long   .Linfo_string3          # DW_AT_name
@@ -29,9 +24,14 @@ source_filename = "test/DebugInfo/X86/stringpool.ll"
; LINUX-NEXT: .byte   9                       # DW_AT_location
; LINUX-NEXT: .byte   3
; LINUX-NEXT: .quad   yyyy
; Verify that "yyyy" ended up in the stringpool.
; LINUX: .section .debug_str,"MS",@progbits,1
; LINUX: yyyy

; Verify that we refer to 'yyyy' with a direct offset.
; DARWIN:             .long   [[YYYY]]
; DARWIN: .section        __DWARF,__debug_info,regular,debug
; DARWIN: DW_TAG_variable
; DARWIN:             .long   [[YYYY:[0-9]+]]
; DARWIN-NEXT:        .long   {{[0-9]+}}              ## DW_AT_type
; DARWIN-NEXT:                                        ## DW_AT_external
; DARWIN-NEXT:        .byte   1                       ## DW_AT_decl_file
@@ -39,5 +39,7 @@ source_filename = "test/DebugInfo/X86/stringpool.ll"
; DARWIN-NEXT:        .byte   9                       ## DW_AT_location
; DARWIN-NEXT:        .byte   3
; DARWIN-NEXT:        .quad   _yyyy
; DARWIN: .section __DWARF,__debug_str,regular,debug
; DARWIN: .asciz "yyyy" ## string offset=[[YYYY]]
!6 = !{!0}
!7 = !{i32 1, !"Debug Info Version", i32 3}