[llvm] r232191 - [dsymutil] Fix location cloning for newer dwarf versions.

Frederic Riss friss at apple.com
Fri Mar 13 11:35:39 PDT 2015


Author: friss
Date: Fri Mar 13 13:35:39 2015
New Revision: 232191

URL: http://llvm.org/viewvc/llvm-project?rev=232191&view=rev
Log:
[dsymutil] Fix location cloning for newer dwarf versions.

The typo got unnoticed because we were testing only on Dwarf 2. Add a
Dwarf4 test that exercises the code path, and also tests some newer
FORMs that the other test doesn't cover.

Added:
    llvm/trunk/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64   (with props)
    llvm/trunk/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64.o
    llvm/trunk/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test
Modified:
    llvm/trunk/tools/dsymutil/DwarfLinker.cpp

Added: llvm/trunk/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64?rev=232191&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64 (added) and llvm/trunk/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64 Fri Mar 13 13:35:39 2015 differ

Propchange: llvm/trunk/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64
------------------------------------------------------------------------------
    svn:executable = *

Added: llvm/trunk/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64.o
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64.o?rev=232191&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64.o (added) and llvm/trunk/test/tools/dsymutil/Inputs/basic-lto-dw4.macho.x86_64.o Fri Mar 13 13:35:39 2015 differ

Added: llvm/trunk/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test?rev=232191&view=auto
==============================================================================
--- llvm/trunk/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test (added)
+++ llvm/trunk/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test Fri Mar 13 13:35:39 2015
@@ -0,0 +1,94 @@
+RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-lto-dw4.macho.x86_64 | llvm-dwarfdump - | FileCheck %s
+
+CHECK: file format Mach-O 64-bit x86-64
+
+CHECK: debug_info contents
+
+CHECK:  Compile Unit: {{.*}} version = 0x0004
+
+CHECK:  DW_TAG_compile_unit [1] *
+CHECK:    DW_AT_producer [DW_FORM_strp]	( .debug_str[0x00000001] = "clang version 3.7.0 ")
+CHECK:    DW_AT_language [DW_FORM_data2]	(DW_LANG_C99)
+CHECK:    DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000016] = "basic1.c")
+CHECK:    DW_AT_comp_dir [DW_FORM_strp]	( .debug_str[0x0000001f] = "/Inputs")
+CHECK:    DW_TAG_subprogram [2] *
+CHECK:      DW_AT_low_pc [DW_FORM_addr]	(0x0000000100000f40)
+CHECK:      DW_AT_high_pc [DW_FORM_data4]	(0x0000000b)
+CHECK:      DW_AT_frame_base [DW_FORM_exprloc]	(<0x1> 56 )
+CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000027] = "main")
+CHECK:      DW_AT_prototyped [DW_FORM_flag_present]	(true)
+CHECK:      DW_AT_external [DW_FORM_flag_present]	(true)
+CHECK:      DW_TAG_formal_parameter [3]  
+CHECK:        DW_AT_location [DW_FORM_exprloc]	(<0x3> 55 93 04 )
+CHECK:        DW_AT_name [DW_FORM_strp]	( .debug_str[0x0000002c] = "argc")
+CHECK:      DW_TAG_formal_parameter [4]  
+CHECK:        DW_AT_location [DW_FORM_exprloc]	(<0x1> 54 )
+CHECK:        DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000031] = "argv")
+CHECK:      NULL
+CHECK:    DW_TAG_pointer_type [5]  
+CHECK:    DW_TAG_pointer_type [5]  
+CHECK:    DW_TAG_const_type [6]  
+CHECK:    DW_TAG_base_type [7]  
+CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000036] = "char")
+CHECK:      DW_AT_encoding [DW_FORM_data1]	(DW_ATE_signed_char)
+CHECK:      DW_AT_byte_size [DW_FORM_data1]	(0x01)
+CHECK:    NULL
+
+CHECK:  Compile Unit:{{.*}} version = 0x0004
+
+CHECK:  DW_TAG_compile_unit [1] *
+CHECK:    DW_AT_producer [DW_FORM_strp]	( .debug_str[0x00000001] = "clang version 3.7.0 ")
+CHECK:    DW_AT_language [DW_FORM_data2]	(DW_LANG_C99)
+CHECK:    DW_AT_name [DW_FORM_strp]	( .debug_str[0x0000003b] = "basic2.c")
+CHECK:    DW_TAG_base_type [7]  
+CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000044] = "int")
+CHECK:    DW_TAG_variable [8]  
+CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000048] = "baz")
+CHECK:      DW_AT_location [DW_FORM_exprloc]	(<0x9> 03 00 10 00 00 01 00 00 00 )
+CHECK:    DW_TAG_variable [8]  
+CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x0000004c] = "private_int")
+CHECK:      DW_AT_location [DW_FORM_exprloc]	(<0x9> 03 08 10 00 00 01 00 00 00 )
+CHECK:    DW_TAG_subprogram [9]  
+CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000058] = "inc")
+CHECK:      DW_AT_type [DW_FORM_ref4]	(cu + 0x002a => {0x000000a1})
+CHECK:      DW_AT_inline [DW_FORM_data1]	(DW_INL_inlined)
+CHECK:    DW_TAG_subprogram [10] *
+CHECK:      DW_AT_low_pc [DW_FORM_addr]	(0x0000000100000f50)
+CHECK:      DW_AT_high_pc [DW_FORM_data4]	(0x00000037)
+CHECK:      DW_AT_frame_base [DW_FORM_exprloc]	(<0x1> 56 )
+CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x0000005c] = "foo")
+CHECK:      DW_AT_prototyped [DW_FORM_flag_present]	(true)
+CHECK:      DW_AT_type [DW_FORM_ref4]	(cu + 0x002a => {0x000000a1})
+CHECK:      DW_TAG_formal_parameter [11]  
+CHECK:        DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000060] = "arg")
+CHECK:        DW_AT_type [DW_FORM_ref4]	(cu + 0x002a => {0x000000a1})
+CHECK:      DW_TAG_inlined_subroutine [12]  
+CHECK:        DW_AT_abstract_origin [DW_FORM_ref4]	(cu + 0x005b => {0x000000d2} "inc")
+CHECK:        DW_AT_low_pc [DW_FORM_addr]	(0x0000000100000f61)
+CHECK:        DW_AT_high_pc [DW_FORM_data4]	(0x0000000f)
+CHECK:      NULL
+CHECK:    NULL
+
+CHECK:  Compile Unit: {{.*}} version = 0x0004
+
+CHECK:  DW_TAG_compile_unit [1] *
+CHECK:    DW_AT_producer [DW_FORM_strp]	( .debug_str[0x00000001] = "clang version 3.7.0 ")
+CHECK:    DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000064] = "basic3.c")
+CHECK:    DW_TAG_variable [13]  
+CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x0000006d] = "val")
+CHECK:      DW_AT_location [DW_FORM_exprloc]	(<0x9> 03 04 10 00 00 01 00 00 00 )
+CHECK:    DW_TAG_volatile_type [14]  
+CHECK:    DW_TAG_subprogram [15]  
+CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000058] = "inc")
+CHECK:      DW_AT_inline [DW_FORM_data1]	(DW_INL_inlined)
+CHECK:    DW_TAG_subprogram [2] *
+CHECK:      DW_AT_low_pc [DW_FORM_addr]	(0x0000000100000f90)
+CHECK:      DW_AT_high_pc [DW_FORM_data4]	(0x00000024)
+CHECK:      DW_AT_frame_base [DW_FORM_exprloc]	(<0x1> 56 )
+CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000071] = "bar")
+CHECK:      DW_TAG_formal_parameter [16]  
+CHECK:        DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000060] = "arg")
+CHECK:      DW_TAG_inlined_subroutine [17]  
+CHECK:        DW_AT_abstract_origin [DW_FORM_ref4]	(cu + 0x0044 => {0x0000015f} "inc")
+CHECK:      NULL
+CHECK:    NULL

Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=232191&r1=232190&r2=232191&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)
+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Fri Mar 13 13:35:39 2015
@@ -1225,7 +1225,7 @@ unsigned DwarfLinker::cloneBlockAttribut
   DIELoc *Loc = nullptr;
   DIEBlock *Block = nullptr;
   // Just copy the block data over.
-  if (AttrSpec.Attr == dwarf::DW_FORM_exprloc) {
+  if (AttrSpec.Form == dwarf::DW_FORM_exprloc) {
     Loc = new (DIEAlloc) DIELoc();
     DIELocs.push_back(Loc);
   } else {





More information about the llvm-commits mailing list