[DebugInfo] Support DWARF v5 source code embedding extension
authorScott Linder <scott@scottlinder.com>
Fri, 23 Feb 2018 23:01:06 +0000 (23:01 +0000)
committerScott Linder <scott@scottlinder.com>
Fri, 23 Feb 2018 23:01:06 +0000 (23:01 +0000)
commit16c7bdaf3245d23b9b441144f5efb610e2044927
tree870f3b5c5c606b19951cb4433f3887825bc61e56
parent5e2f6ba51e89c9b9625902f0c36493ad46e46a3b
[DebugInfo] Support DWARF v5 source code embedding extension

In DWARF v5 the Line Number Program Header is extensible, allowing values with
new content types. In this extension a content type is added,
DW_LNCT_LLVM_source, which contains the embedded source code of the file.

Add new optional attribute for !DIFile IR metadata called source which contains
source text. Use this to output the source to the DWARF line table of code
objects. Analogously extend METADATA_FILE in Bitcode and .file directive in ASM
to support optional source.

Teach llvm-dwarfdump and llvm-objdump about the new values. Update the output
format of llvm-dwarfdump to make room for the new attribute on file_names
entries, and support embedded sources for the -source option in llvm-objdump.

Differential Revision: https://reviews.llvm.org/D42765

llvm-svn: 325970
51 files changed:
llvm/docs/AMDGPUUsage.rst
llvm/include/llvm/BinaryFormat/Dwarf.def
llvm/include/llvm/DebugInfo/DIContext.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
llvm/include/llvm/IR/DIBuilder.h
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/include/llvm/MC/MCContext.h
llvm/include/llvm/MC/MCDwarf.h
llvm/include/llvm/MC/MCStreamer.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/Bitcode/Reader/MetadataLoader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/DIBuilder.cpp
llvm/lib/IR/DebugInfoMetadata.cpp
llvm/lib/IR/LLVMContextImpl.h
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/MC/MCContext.cpp
llvm/lib/MC/MCDwarf.cpp
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/lib/MC/MCStreamer.cpp
llvm/test/Assembler/debug-info.ll
llvm/test/CodeGen/BPF/dwarfdump.ll
llvm/test/CodeGen/Generic/dwarf-md5.ll
llvm/test/CodeGen/X86/dwarf-comp-dir.ll
llvm/test/DebugInfo/AMDGPU/dwarfdump-relocs.ll
llvm/test/DebugInfo/Generic/lto-comp-dir.ll
llvm/test/DebugInfo/X86/debug-macro.ll
llvm/test/DebugInfo/X86/dwarfdump-header-64.s
llvm/test/DebugInfo/X86/dwarfdump-header.s
llvm/test/DebugInfo/X86/dwarfdump-line-dwo.s
llvm/test/DebugInfo/X86/dwarfdump-line-only.s
llvm/test/DebugInfo/X86/generate-odr-hash.ll
llvm/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll
llvm/test/DebugInfo/debugmacinfo.test
llvm/test/Linker/subprogram-linkonce-weak.ll
llvm/test/MC/ARM/dwarf-asm-multiple-sections.s
llvm/test/MC/ELF/debug-md5.s
llvm/test/MC/MachO/gen-dwarf-cpp.s
llvm/test/MC/MachO/gen-dwarf-macro-cpp.s
llvm/test/MC/MachO/gen-dwarf.s
llvm/test/tools/dsymutil/X86/basic-linking-x86.test
llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test
llvm/test/tools/dsymutil/X86/basic-lto-linking-x86.test
llvm/tools/llvm-objdump/llvm-objdump.cpp
llvm/unittests/IR/MetadataTest.cpp