[llvm-dev] Finding a Compile Unit for Address segfaults for Macho File when calling DwarfContext::getDIEsForAddress

Scott Densmore via llvm-dev llvm-dev at lists.llvm.org
Mon Sep 3 12:43:07 PDT 2018


I am using llvm 6.0.1 and trying to find an an address in llvm. I tried llvm-dwarfdump -lookup and it fails. If I loop through the compile units in the parsed macho file, I find the address using the DWARFCompileUnit::getSubroutineForAddress. Is there a way to find the address?  I find the following Compile Unit when looping through for address 0x00000001000dd174:

(I am removing identifying info)

0x002112d0: Compile Unit: length = 0x00002928 version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x00213bfc)

0x002112db: DW_TAG_compile_unit
             DW_AT_producer	("Apple Swift version 4.1 (swiftlang-902.0.48 clang-902.0.37.1) -emit-object -filelist <temporary-file> <removed-rest>")
             DW_AT_language	(DW_LANG_Swift)
             DW_AT_name	(“<filename>")
             DW_AT_stmt_list	(0x0010c54b)
             DW_AT_comp_dir	("/Users/build/bamboo-agent-home/xml-data/build-dir/ID-RAX9-JOB1")
             DW_AT_APPLE_optimized	(true)
             DW_AT_APPLE_flags	("-emit-object -filelist <temporary-file> ")
             DW_AT_APPLE_major_runtime_vers	(0x04)
             DW_AT_low_pc	(0x00000001000d957c)
             DW_AT_ranges	(0x00007100
                [0x00000001000d957c - 0x00000001000dabb4)
                [0x00000001000dabc0 - 0x00000001000dad40)
                [0x00000001000dadac - 0x00000001000dbd60)
                [0x00000001000dbd84 - 0x00000001000dbdbc)
                [0x00000001000dbde0 - 0x00000001000dbf90)
                [0x00000001000dbff8 - 0x00000001000e069c)
                [0x00000001000e0708 - 0x00000001000e070c)
                [0x00000001000e0a28 - 0x00000001000e0c8c)
                [0x00000001000e0ce4 - 0x00000001000e1118)
                [0x00000001000e113c - 0x00000001000e1888))

The DIE is:

0x0021237a: DW_TAG_inlined_subroutine
             DW_AT_abstract_origin	(cu + 0x14eb "_T0IeyB_Ieg_TR")
             DW_AT_low_pc	(0x00000001000dd174)
             DW_AT_high_pc	(0x00000001000dd190)
             DW_AT_call_file	(“<removed>")
             DW_AT_call_line	(118)

Looks like the address should be in range so not sure why it can’t find it. Any help is appreciated.

I did debug the SEGFAULT and getting an assert. It fines a Compile Unit, then the FunctionDIE is not value (NULL). The die in the building the wordlist because the DIE is invalid and asserts in DWARFDie::getAbbreviationDeclarationPtr.

Any help is appreciated.

Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180903/9f9a59b5/attachment.html>


More information about the llvm-dev mailing list