forked from OSchip/llvm-project
[DebugInfo] Fix emitting the DW_AT_location attribute for 64-bit DWARFv3 (7/19).
The patch uses a common method to determine the appropriate form for the value of the attribute. Differential Revision: https://reviews.llvm.org/D87016
This commit is contained in:
parent
cae7c1eb78
commit
26f1f18831
|
@ -1346,11 +1346,9 @@ void DwarfCompileUnit::addComplexAddress(const DbgVariable &DV, DIE &Die,
|
|||
/// Add a Dwarf loclistptr attribute data and value.
|
||||
void DwarfCompileUnit::addLocationList(DIE &Die, dwarf::Attribute Attribute,
|
||||
unsigned Index) {
|
||||
dwarf::Form Form = dwarf::DW_FORM_data4;
|
||||
if (DD->getDwarfVersion() == 4)
|
||||
Form =dwarf::DW_FORM_sec_offset;
|
||||
if (DD->getDwarfVersion() >= 5)
|
||||
Form =dwarf::DW_FORM_loclistx;
|
||||
dwarf::Form Form = (DD->getDwarfVersion() >= 5)
|
||||
? dwarf::DW_FORM_loclistx
|
||||
: DD->getDwarfSectionOffsetForm();
|
||||
Die.addValue(DIEValueAllocator, Attribute, Form, DIELocList(Index));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
; RUN: llc -O1 -filetype=obj -mtriple=x86_64-apple-darwin < %s > %t
|
||||
; RUN: llvm-dwarfdump -v %t | FileCheck %s
|
||||
; RUN: llvm-dwarfdump -v %t | FileCheck %s --check-prefixes=CHECK,DWARFv4
|
||||
; RUN: llvm-objdump -r %t | FileCheck --check-prefix=DARWIN %s
|
||||
|
||||
; RUN: llc -O1 -filetype=obj -mtriple=x86_64-pc-linux-gnu < %s > %t
|
||||
; RUN: llvm-dwarfdump -v %t | FileCheck %s
|
||||
; RUN: llvm-dwarfdump -v %t | FileCheck %s --check-prefixes=CHECK,DWARFv4
|
||||
; RUN: llvm-objdump -r %t | FileCheck --check-prefix=LINUX %s
|
||||
|
||||
; RUN: llc -dwarf-version=3 -O1 -filetype=obj -mtriple=x86_64-pc-linux-gnu < %s > %t
|
||||
; RUN: llvm-dwarfdump -debug-info -v %t | FileCheck %s --check-prefixes=CHECK,DWARF32v3
|
||||
; RUN: llvm-objdump -r %t | FileCheck --check-prefix=LINUX %s
|
||||
|
||||
; RUN: llc -dwarf64 -dwarf-version=3 -O1 -filetype=obj -mtriple=x86_64-pc-linux-gnu < %s > %t
|
||||
; RUN: llvm-dwarfdump -debug-info -v %t | FileCheck %s --check-prefixes=CHECK,DWARF64v3
|
||||
; RUN: llvm-objdump -r %t | FileCheck --check-prefix=LINUX %s
|
||||
|
||||
; PR9493
|
||||
|
@ -31,7 +40,9 @@
|
|||
; // The 'x' variable and its symbol reference location
|
||||
; CHECK: .debug_info contents:
|
||||
; CHECK: DW_TAG_variable
|
||||
; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x00000000
|
||||
; DWARF32v3-NEXT: DW_AT_location [DW_FORM_data4] (0x00000000
|
||||
; DWARF64v3-NEXT: DW_AT_location [DW_FORM_data8] (0x00000000
|
||||
; DWARFv4-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x00000000
|
||||
; Check that the location contains only 4 ranges.
|
||||
; CHECK-NEXT: [0x{{[0-9a-f]*}}, 0x{{[0-9a-f]*}})
|
||||
; CHECK-NEXT: [0x{{[0-9a-f]*}}, 0x{{[0-9a-f]*}})
|
||||
|
|
Loading…
Reference in New Issue