<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Dec 8, 2016 at 4:36 PM Chris Bieneman via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: cbieneman<br class="gmail_msg">
Date: Thu Dec 8 18:26:44 2016<br class="gmail_msg">
New Revision: 289161<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=289161&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=289161&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
[ObjectYAML] Support for DWARF debug_aranges<br class="gmail_msg">
<br class="gmail_msg">
This patch adds support for round tripping DWARF debug_aranges in and out of YAML.<br class="gmail_msg">
<br class="gmail_msg">
Added:<br class="gmail_msg">
llvm/trunk/test/ObjectYAML/MachO/DWARF-debug_aranges.yaml<br class="gmail_msg">
Modified:<br class="gmail_msg">
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h<br class="gmail_msg">
llvm/trunk/include/llvm/ObjectYAML/DWARFYAML.h<br class="gmail_msg">
llvm/trunk/lib/ObjectYAML/DWARFYAML.cpp<br class="gmail_msg">
llvm/trunk/tools/obj2yaml/dwarf2yaml.cpp<br class="gmail_msg">
llvm/trunk/tools/yaml2obj/yaml2dwarf.cpp<br class="gmail_msg">
llvm/trunk/tools/yaml2obj/yaml2macho.cpp<br class="gmail_msg">
llvm/trunk/tools/yaml2obj/yaml2obj.h<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h?rev=289161&r1=289160&r2=289161&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h?rev=289161&r1=289160&r2=289161&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h (original)<br class="gmail_msg">
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h Thu Dec 8 18:26:44 2016<br class="gmail_msg">
@@ -59,6 +59,8 @@ public:<br class="gmail_msg">
<br class="gmail_msg">
uint32_t getCompileUnitDIEOffset() const { return HeaderData.CuOffset; }<br class="gmail_msg">
<br class="gmail_msg">
+ const Header &getHeader() const { return HeaderData; }<br class="gmail_msg">
+<br class="gmail_msg">
desc_iterator_range descriptors() const {<br class="gmail_msg">
return desc_iterator_range(ArangeDescriptors.begin(),<br class="gmail_msg">
ArangeDescriptors.end());<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/include/llvm/ObjectYAML/DWARFYAML.h<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ObjectYAML/DWARFYAML.h?rev=289161&r1=289160&r2=289161&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ObjectYAML/DWARFYAML.h?rev=289161&r1=289160&r2=289161&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/include/llvm/ObjectYAML/DWARFYAML.h (original)<br class="gmail_msg">
+++ llvm/trunk/include/llvm/ObjectYAML/DWARFYAML.h Thu Dec 8 18:26:44 2016<br class="gmail_msg">
@@ -35,9 +35,24 @@ struct Abbrev {<br class="gmail_msg">
std::vector<AttributeAbbrev> Attributes;<br class="gmail_msg">
};<br class="gmail_msg">
<br class="gmail_msg">
+struct ARangeDescriptor {<br class="gmail_msg">
+ llvm::yaml::Hex64 Address;<br class="gmail_msg">
+ uint64_t Length;<br class="gmail_msg">
+};<br class="gmail_msg">
+<br class="gmail_msg">
+struct ARange {<br class="gmail_msg">
+ uint32_t Length;<br class="gmail_msg">
+ uint16_t Version;<br class="gmail_msg">
+ uint32_t CuOffset;<br class="gmail_msg">
+ uint8_t AddrSize;<br class="gmail_msg">
+ uint8_t SegSize;<br class="gmail_msg">
+ std::vector<ARangeDescriptor> Descriptors;<br class="gmail_msg">
+};<br class="gmail_msg">
+<br class="gmail_msg">
struct Data {<br class="gmail_msg">
std::vector<Abbrev> AbbrevDecls;<br class="gmail_msg">
std::vector<StringRef> DebugStrings;<br class="gmail_msg">
+ std::vector<ARange> ARanges;<br class="gmail_msg">
<br class="gmail_msg">
bool isEmpty() const;<br class="gmail_msg">
};<br class="gmail_msg">
@@ -48,6 +63,8 @@ struct Data {<br class="gmail_msg">
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::StringRef)<br class="gmail_msg">
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::AttributeAbbrev)<br class="gmail_msg">
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Abbrev)<br class="gmail_msg">
+LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::ARangeDescriptor)<br class="gmail_msg">
+LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::ARange)<br class="gmail_msg">
<br class="gmail_msg">
namespace llvm {<br class="gmail_msg">
namespace yaml {<br class="gmail_msg">
@@ -64,6 +81,14 @@ template <> struct MappingTraits<DWARFYA<br class="gmail_msg">
static void mapping(IO &IO, DWARFYAML::AttributeAbbrev &AttAbbrev);<br class="gmail_msg">
};<br class="gmail_msg">
<br class="gmail_msg">
+template <> struct MappingTraits<DWARFYAML::ARangeDescriptor> {<br class="gmail_msg">
+ static void mapping(IO &IO, DWARFYAML::ARangeDescriptor &Descriptor);<br class="gmail_msg">
+};<br class="gmail_msg">
+<br class="gmail_msg">
+template <> struct MappingTraits<DWARFYAML::ARange> {<br class="gmail_msg">
+ static void mapping(IO &IO, DWARFYAML::ARange &Range);<br class="gmail_msg">
+};<br class="gmail_msg">
+<br class="gmail_msg">
#define HANDLE_DW_TAG(unused, name) \<br class="gmail_msg">
io.enumCase(value, "DW_TAG_" #name, dwarf::DW_TAG_##name);<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/ObjectYAML/DWARFYAML.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/DWARFYAML.cpp?rev=289161&r1=289160&r2=289161&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/DWARFYAML.cpp?rev=289161&r1=289160&r2=289161&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/ObjectYAML/DWARFYAML.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/ObjectYAML/DWARFYAML.cpp Thu Dec 8 18:26:44 2016<br class="gmail_msg">
@@ -26,6 +26,8 @@ void MappingTraits<DWARFYAML::Data>::map<br class="gmail_msg">
IO &IO, DWARFYAML::Data &DWARF) {<br class="gmail_msg">
IO.mapOptional("debug_str", DWARF.DebugStrings);<br class="gmail_msg">
IO.mapOptional("debug_abbrev", DWARF.AbbrevDecls);<br class="gmail_msg">
+ if(!DWARF.ARanges.empty() || !IO.outputting())<br class="gmail_msg">
+ IO.mapOptional("debug_aranges", DWARF.ARanges);<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
void MappingTraits<DWARFYAML::Abbrev>::mapping(<br class="gmail_msg">
@@ -42,6 +44,22 @@ void MappingTraits<DWARFYAML::AttributeA<br class="gmail_msg">
IO.mapRequired("Form", AttAbbrev.Form);<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
+void MappingTraits<DWARFYAML::ARangeDescriptor>::mapping(<br class="gmail_msg">
+ IO &IO, DWARFYAML::ARangeDescriptor &Descriptor) {<br class="gmail_msg">
+ IO.mapRequired("Address", Descriptor.Address);<br class="gmail_msg">
+ IO.mapRequired("Length", Descriptor.Length);<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+void MappingTraits<DWARFYAML::ARange>::mapping(IO &IO,<br class="gmail_msg">
+ DWARFYAML::ARange &Range) {<br class="gmail_msg">
+ IO.mapRequired("Length", Range.Length);<br class="gmail_msg">
+ IO.mapRequired("Version", Range.Version);<br class="gmail_msg">
+ IO.mapRequired("CuOffset", Range.CuOffset);<br class="gmail_msg">
+ IO.mapRequired("AddrSize", Range.AddrSize);<br class="gmail_msg">
+ IO.mapRequired("SegSize", Range.SegSize);<br class="gmail_msg">
+ IO.mapRequired("Descriptors", Range.Descriptors);<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
} // namespace llvm::yaml<br class="gmail_msg">
<br class="gmail_msg">
} // namespace llvm<br class="gmail_msg">
<br class="gmail_msg">
Added: llvm/trunk/test/ObjectYAML/MachO/DWARF-debug_aranges.yaml<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/MachO/DWARF-debug_aranges.yaml?rev=289161&view=auto" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/MachO/DWARF-debug_aranges.yaml?rev=289161&view=auto</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/test/ObjectYAML/MachO/DWARF-debug_aranges.yaml (added)<br class="gmail_msg">
+++ llvm/trunk/test/ObjectYAML/MachO/DWARF-debug_aranges.yaml Thu Dec 8 18:26:44 2016<br class="gmail_msg">
@@ -0,0 +1,335 @@<br class="gmail_msg">
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s<br class="gmail_msg">
+<br class="gmail_msg">
+--- !mach-o<br class="gmail_msg">
+FileHeader:<br class="gmail_msg">
+ magic: 0xFEEDFACF<br class="gmail_msg">
+ cputype: 0x01000007<br class="gmail_msg">
+ cpusubtype: 0x00000003<br class="gmail_msg">
+ filetype: 0x0000000A<br class="gmail_msg">
+ ncmds: 7<br class="gmail_msg">
+ sizeofcmds: 1848<br class="gmail_msg">
+ flags: 0x00000000<br class="gmail_msg">
+ reserved: 0x00000000<br class="gmail_msg">
+LoadCommands:<br class="gmail_msg">
+ - cmd: LC_UUID<br class="gmail_msg">
+ cmdsize: 24<br class="gmail_msg">
+ uuid: B4D48511-37F4-3ED4-AFA7-1683DCE69AC4<br class="gmail_msg">
+ - cmd: LC_SYMTAB<br class="gmail_msg">
+ cmdsize: 24<br class="gmail_msg">
+ symoff: 4096<br class="gmail_msg">
+ nsyms: 2<br class="gmail_msg">
+ stroff: 4128<br class="gmail_msg">
+ strsize: 28<br class="gmail_msg">
+ - cmd: LC_SEGMENT_64<br class="gmail_msg">
+ cmdsize: 72<br class="gmail_msg">
+ segname: __PAGEZERO<br class="gmail_msg">
+ vmaddr: 0<br class="gmail_msg">
+ vmsize: 4294967296<br class="gmail_msg">
+ fileoff: 0<br class="gmail_msg">
+ filesize: 0<br class="gmail_msg">
+ maxprot: 0<br class="gmail_msg">
+ initprot: 0<br class="gmail_msg">
+ nsects: 0<br class="gmail_msg">
+ flags: 0<br class="gmail_msg">
+ - cmd: LC_SEGMENT_64<br class="gmail_msg">
+ cmdsize: 472<br class="gmail_msg">
+ segname: __TEXT<br class="gmail_msg">
+ vmaddr: 4294967296<br class="gmail_msg">
+ vmsize: 4096<br class="gmail_msg">
+ fileoff: 0<br class="gmail_msg">
+ filesize: 0<br class="gmail_msg">
+ maxprot: 7<br class="gmail_msg">
+ initprot: 5<br class="gmail_msg">
+ nsects: 5<br class="gmail_msg">
+ flags: 0<br class="gmail_msg">
+ Sections:<br class="gmail_msg">
+ - sectname: __text<br class="gmail_msg">
+ segname: __TEXT<br class="gmail_msg">
+ addr: 0x0000000100000F50<br class="gmail_msg">
+ size: 52<br class="gmail_msg">
+ offset: 0x00000000<br class="gmail_msg">
+ align: 4<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x80000400<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __stubs<br class="gmail_msg">
+ segname: __TEXT<br class="gmail_msg">
+ addr: 0x0000000100000F84<br class="gmail_msg">
+ size: 6<br class="gmail_msg">
+ offset: 0x00000000<br class="gmail_msg">
+ align: 1<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x80000408<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000006<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __stub_helper<br class="gmail_msg">
+ segname: __TEXT<br class="gmail_msg">
+ addr: 0x0000000100000F8C<br class="gmail_msg">
+ size: 26<br class="gmail_msg">
+ offset: 0x00000000<br class="gmail_msg">
+ align: 2<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x80000400<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __cstring<br class="gmail_msg">
+ segname: __TEXT<br class="gmail_msg">
+ addr: 0x0000000100000FA6<br class="gmail_msg">
+ size: 14<br class="gmail_msg">
+ offset: 0x00000000<br class="gmail_msg">
+ align: 0<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000002<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __unwind_info<br class="gmail_msg">
+ segname: __TEXT<br class="gmail_msg">
+ addr: 0x0000000100000FB4<br class="gmail_msg">
+ size: 72<br class="gmail_msg">
+ offset: 0x00000000<br class="gmail_msg">
+ align: 2<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000000<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - cmd: LC_SEGMENT_64<br class="gmail_msg">
+ cmdsize: 232<br class="gmail_msg">
+ segname: __DATA<br class="gmail_msg">
+ vmaddr: 4294971392<br class="gmail_msg">
+ vmsize: 4096<br class="gmail_msg">
+ fileoff: 0<br class="gmail_msg">
+ filesize: 0<br class="gmail_msg">
+ maxprot: 7<br class="gmail_msg">
+ initprot: 3<br class="gmail_msg">
+ nsects: 2<br class="gmail_msg">
+ flags: 0<br class="gmail_msg">
+ Sections:<br class="gmail_msg">
+ - sectname: __nl_symbol_ptr<br class="gmail_msg">
+ segname: __DATA<br class="gmail_msg">
+ addr: 0x0000000100001000<br class="gmail_msg">
+ size: 16<br class="gmail_msg">
+ offset: 0x00000000<br class="gmail_msg">
+ align: 3<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000006<br class="gmail_msg">
+ reserved1: 0x00000001<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __la_symbol_ptr<br class="gmail_msg">
+ segname: __DATA<br class="gmail_msg">
+ addr: 0x0000000100001010<br class="gmail_msg">
+ size: 8<br class="gmail_msg">
+ offset: 0x00000000<br class="gmail_msg">
+ align: 3<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000007<br class="gmail_msg">
+ reserved1: 0x00000003<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - cmd: LC_SEGMENT_64<br class="gmail_msg">
+ cmdsize: 72<br class="gmail_msg">
+ segname: __LINKEDIT<br class="gmail_msg">
+ vmaddr: 4294975488<br class="gmail_msg">
+ vmsize: 4096<br class="gmail_msg">
+ fileoff: 4096<br class="gmail_msg">
+ filesize: 60<br class="gmail_msg">
+ maxprot: 7<br class="gmail_msg">
+ initprot: 1<br class="gmail_msg">
+ nsects: 0<br class="gmail_msg">
+ flags: 0<br class="gmail_msg">
+ - cmd: LC_SEGMENT_64<br class="gmail_msg">
+ cmdsize: 952<br class="gmail_msg">
+ segname: __DWARF<br class="gmail_msg">
+ vmaddr: 4294979584<br class="gmail_msg">
+ vmsize: 4096<br class="gmail_msg">
+ fileoff: 8192<br class="gmail_msg">
+ filesize: 764<br class="gmail_msg">
+ maxprot: 7<br class="gmail_msg">
+ initprot: 3<br class="gmail_msg">
+ nsects: 11<br class="gmail_msg">
+ flags: 0<br class="gmail_msg">
+ Sections:<br class="gmail_msg">
+ - sectname: __debug_line<br class="gmail_msg">
+ segname: __DWARF<br class="gmail_msg">
+ addr: 0x0000000100003000<br class="gmail_msg">
+ size: 69<br class="gmail_msg">
+ offset: 0x00002000<br class="gmail_msg">
+ align: 0<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000000<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __debug_pubnames<br class="gmail_msg">
+ segname: __DWARF<br class="gmail_msg">
+ addr: 0x0000000100003045<br class="gmail_msg">
+ size: 27<br class="gmail_msg">
+ offset: 0x00002045<br class="gmail_msg">
+ align: 0<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000000<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __debug_pubtypes<br class="gmail_msg">
+ segname: __DWARF<br class="gmail_msg">
+ addr: 0x0000000100003060<br class="gmail_msg">
+ size: 35<br class="gmail_msg">
+ offset: 0x00002060<br class="gmail_msg">
+ align: 0<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000000<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __debug_aranges<br class="gmail_msg">
+ segname: __DWARF<br class="gmail_msg">
+ addr: 0x0000000100003083<br class="gmail_msg">
+ size: 48<br class="gmail_msg">
+ offset: 0x00002083<br class="gmail_msg">
+ align: 0<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000000<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __debug_info<br class="gmail_msg">
+ segname: __DWARF<br class="gmail_msg">
+ addr: 0x00000001000030B3<br class="gmail_msg">
+ size: 121<br class="gmail_msg">
+ offset: 0x000020B3<br class="gmail_msg">
+ align: 0<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000000<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __debug_abbrev<br class="gmail_msg">
+ segname: __DWARF<br class="gmail_msg">
+ addr: 0x000000010000312C<br class="gmail_msg">
+ size: 76<br class="gmail_msg">
+ offset: 0x0000212C<br class="gmail_msg">
+ align: 0<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000000<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __debug_str<br class="gmail_msg">
+ segname: __DWARF<br class="gmail_msg">
+ addr: 0x0000000100003178<br class="gmail_msg">
+ size: 142<br class="gmail_msg">
+ offset: 0x00002178<br class="gmail_msg">
+ align: 0<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000000<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __apple_names<br class="gmail_msg">
+ segname: __DWARF<br class="gmail_msg">
+ addr: 0x0000000100003206<br class="gmail_msg">
+ size: 60<br class="gmail_msg">
+ offset: 0x00002206<br class="gmail_msg">
+ align: 0<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000000<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __apple_namespac<br class="gmail_msg">
+ segname: __DWARF<br class="gmail_msg">
+ addr: 0x0000000100003242<br class="gmail_msg">
+ size: 36<br class="gmail_msg">
+ offset: 0x00002242<br class="gmail_msg">
+ align: 0<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000000<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __apple_types<br class="gmail_msg">
+ segname: __DWARF<br class="gmail_msg">
+ addr: 0x0000000100003266<br class="gmail_msg">
+ size: 114<br class="gmail_msg">
+ offset: 0x00002266<br class="gmail_msg">
+ align: 0<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000000<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+ - sectname: __apple_objc<br class="gmail_msg">
+ segname: __DWARF<br class="gmail_msg">
+ addr: 0x00000001000032D8<br class="gmail_msg">
+ size: 36<br class="gmail_msg">
+ offset: 0x000022D8<br class="gmail_msg">
+ align: 0<br class="gmail_msg">
+ reloff: 0x00000000<br class="gmail_msg">
+ nreloc: 0<br class="gmail_msg">
+ flags: 0x00000000<br class="gmail_msg">
+ reserved1: 0x00000000<br class="gmail_msg">
+ reserved2: 0x00000000<br class="gmail_msg">
+ reserved3: 0x00000000<br class="gmail_msg">
+LinkEditData:<br class="gmail_msg">
+ NameList:<br class="gmail_msg">
+ - n_strx: 2<br class="gmail_msg">
+ n_type: 0x0F<br class="gmail_msg">
+ n_sect: 1<br class="gmail_msg">
+ n_desc: 16<br class="gmail_msg">
+ n_value: 4294967296<br class="gmail_msg">
+ - n_strx: 22<br class="gmail_msg">
+ n_type: 0x0F<br class="gmail_msg">
+ n_sect: 1<br class="gmail_msg">
+ n_desc: 0<br class="gmail_msg">
+ n_value: 4294971216<br class="gmail_msg">
+ StringTable:<br class="gmail_msg">
+ - ''<br class="gmail_msg">
+ - ''<br class="gmail_msg">
+ - __mh_execute_header<br class="gmail_msg">
+ - _main<br class="gmail_msg">
+DWARF:<br class="gmail_msg">
+ debug_aranges:<br class="gmail_msg">
+ - Length: 44<br class="gmail_msg">
+ Version: 2<br class="gmail_msg">
+ CuOffset: 0<br class="gmail_msg">
+ AddrSize: 8<br class="gmail_msg">
+ SegSize: 0<br class="gmail_msg">
+ Descriptors:<br class="gmail_msg">
+ - Address: 0x0000000100000F50<br class="gmail_msg">
+ Length: 52<br class="gmail_msg">
+...<br class="gmail_msg">
+<br class="gmail_msg">
+#CHECK: DWARF:<br class="gmail_msg">
+#CHECK: debug_aranges:<br class="gmail_msg">
+#CHECK: - Length: 44<br class="gmail_msg">
+#CHECK: Version: 2<br class="gmail_msg">
+#CHECK: CuOffset: 0<br class="gmail_msg">
+#CHECK: AddrSize: 8<br class="gmail_msg">
+#CHECK: SegSize: 0<br class="gmail_msg">
+#CHECK: Descriptors:<br class="gmail_msg">
+#CHECK: - Address: 0x0000000100000F50<br class="gmail_msg">
+#CHECK: Length: 52<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/tools/obj2yaml/dwarf2yaml.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/obj2yaml/dwarf2yaml.cpp?rev=289161&r1=289160&r2=289161&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/obj2yaml/dwarf2yaml.cpp?rev=289161&r1=289160&r2=289161&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/tools/obj2yaml/dwarf2yaml.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/tools/obj2yaml/dwarf2yaml.cpp Thu Dec 8 18:26:44 2016<br class="gmail_msg">
@@ -9,6 +9,7 @@<br class="gmail_msg">
<br class="gmail_msg">
#include "Error.h"<br class="gmail_msg">
#include "llvm/DebugInfo/DWARF/DWARFContext.h"<br class="gmail_msg">
+#include "llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h"<br class="gmail_msg">
#include "llvm/ObjectYAML/DWARFYAML.h"<br class="gmail_msg">
<br class="gmail_msg">
using namespace llvm;<br class="gmail_msg">
@@ -44,10 +45,33 @@ void dumpDebugStrings(DWARFContextInMemo<br class="gmail_msg">
}<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
+void dumpDebugARanges(DWARFContextInMemory &DCtx, DWARFYAML::Data &Y) {<br class="gmail_msg">
+ DataExtractor ArangesData(DCtx.getARangeSection(), DCtx.isLittleEndian(), 0);<br class="gmail_msg">
+ uint32_t Offset = 0;<br class="gmail_msg">
+ DWARFDebugArangeSet Set;<br class="gmail_msg">
+<br class="gmail_msg">
+ while (Set.extract(ArangesData, &Offset)) {<br class="gmail_msg">
+ DWARFYAML::ARange Range;<br class="gmail_msg">
+ Range.Length = Set.getHeader().Length;<br class="gmail_msg">
+ Range.Version = Set.getHeader().Version;<br class="gmail_msg">
+ Range.CuOffset = Set.getHeader().CuOffset;<br class="gmail_msg">
+ Range.AddrSize = Set.getHeader().AddrSize;<br class="gmail_msg">
+ Range.SegSize = Set.getHeader().SegSize;<br class="gmail_msg">
+ for (auto Descriptor : Set.descriptors()) {<br class="gmail_msg">
+ DWARFYAML::ARangeDescriptor Desc;<br class="gmail_msg">
+ Desc.Address = Descriptor.Address;<br class="gmail_msg">
+ Desc.Length = Descriptor.Length;<br class="gmail_msg">
+ Range.Descriptors.push_back(Desc);<br class="gmail_msg">
+ }<br class="gmail_msg">
+ Y.ARanges.push_back(Range);<br class="gmail_msg">
+ }<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
std::error_code dwarf2yaml(DWARFContextInMemory &DCtx,<br class="gmail_msg">
DWARFYAML::Data &Y) {<br class="gmail_msg">
dumpDebugAbbrev(DCtx, Y);<br class="gmail_msg">
dumpDebugStrings(DCtx, Y);<br class="gmail_msg">
+ dumpDebugARanges(DCtx, Y);<br class="gmail_msg">
<br class="gmail_msg">
return obj2yaml_error::success;<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/tools/yaml2obj/yaml2dwarf.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2dwarf.cpp?rev=289161&r1=289160&r2=289161&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2dwarf.cpp?rev=289161&r1=289160&r2=289161&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/tools/yaml2obj/yaml2dwarf.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/tools/yaml2obj/yaml2dwarf.cpp Thu Dec 8 18:26:44 2016<br class="gmail_msg">
@@ -19,6 +19,12 @@<br class="gmail_msg">
<br class="gmail_msg">
using namespace llvm;<br class="gmail_msg">
<br class="gmail_msg">
+void ZeroFillBytes(raw_ostream &OS, size_t Size) {<br class="gmail_msg">
+ std::vector<uint8_t> FillData;<br class="gmail_msg">
+ FillData.insert(FillData.begin(), Size, 0);<br class="gmail_msg">
+ OS.write(reinterpret_cast<char *>(FillData.data()), Size);<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
void yaml2debug_str(raw_ostream &OS, const DWARFYAML::Data &DI) {<br class="gmail_msg">
for (auto Str : DI.DebugStrings) {<br class="gmail_msg">
OS.write(Str.data(), Str.size());<br class="gmail_msg">
@@ -39,3 +45,24 @@ void yaml2debug_abbrev(raw_ostream &OS,<br class="gmail_msg">
encodeULEB128(0, OS);<br class="gmail_msg">
}<br class="gmail_msg">
}<br class="gmail_msg">
+<br class="gmail_msg">
+void yaml2debug_aranges(raw_ostream &OS, const DWARFYAML::Data &DI) {<br class="gmail_msg">
+ for (auto Range : DI.ARanges) {<br class="gmail_msg">
+ auto HeaderStart = OS.tell();<br class="gmail_msg">
+ OS.write(reinterpret_cast<char *>(&Range.Length), 4);<br class="gmail_msg">
+ OS.write(reinterpret_cast<char *>(&Range.Version), 2);<br class="gmail_msg">
+ OS.write(reinterpret_cast<char *>(&Range.CuOffset), 4);<br class="gmail_msg">
+ OS.write(reinterpret_cast<char *>(&Range.AddrSize), 1);<br class="gmail_msg">
+ OS.write(reinterpret_cast<char *>(&Range.SegSize), 1);<br class="gmail_msg">
+<br class="gmail_msg">
+ auto HeaderSize = OS.tell() - HeaderStart;<br class="gmail_msg">
+ auto FirstDescriptor = alignTo(HeaderSize, Range.AddrSize * 2);<br class="gmail_msg">
+ ZeroFillBytes(OS, FirstDescriptor - HeaderSize);<br class="gmail_msg">
+<br class="gmail_msg">
+ for (auto Descriptor : Range.Descriptors) {<br class="gmail_msg">
+ OS.write(reinterpret_cast<char *>(&Descriptor.Address), Range.AddrSize);<br class="gmail_msg">
+ OS.write(reinterpret_cast<char *>(&Descriptor.Length), Range.AddrSize);<br class="gmail_msg">
+ }<br class="gmail_msg">
+ ZeroFillBytes(OS, Range.AddrSize * 2);<br class="gmail_msg">
+ }<br class="gmail_msg">
+}<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/tools/yaml2obj/yaml2macho.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2macho.cpp?rev=289161&r1=289160&r2=289161&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2macho.cpp?rev=289161&r1=289160&r2=289161&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/tools/yaml2obj/yaml2macho.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/tools/yaml2obj/yaml2macho.cpp Thu Dec 8 18:26:44 2016<br class="gmail_msg">
@@ -393,6 +393,9 @@ Error MachOWriter::writeDWARFData(raw_os<br class="gmail_msg">
} else if (0 == strncmp(&Section.sectname[0], "__debug_abbrev", 16)) {<br class="gmail_msg">
yaml2debug_abbrev(OS, Obj.DWARF);<br class="gmail_msg">
}<br class="gmail_msg">
+ else if (0 == strncmp(&Section.sectname[0], "__debug_aranges", 16)) {<br class="gmail_msg"></blockquote><div><br></div><div>Weird bracing ^ ? (else should be on the same line as the preceeding } I assume?)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ yaml2debug_aranges(OS, Obj.DWARF);<br class="gmail_msg">
+ }<br class="gmail_msg">
}<br class="gmail_msg">
return Error::success();<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/tools/yaml2obj/yaml2obj.h<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2obj.h?rev=289161&r1=289160&r2=289161&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2obj.h?rev=289161&r1=289160&r2=289161&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/tools/yaml2obj/yaml2obj.h (original)<br class="gmail_msg">
+++ llvm/trunk/tools/yaml2obj/yaml2obj.h Thu Dec 8 18:26:44 2016<br class="gmail_msg">
@@ -42,4 +42,6 @@ void yaml2debug_abbrev(llvm::raw_ostream<br class="gmail_msg">
void yaml2debug_str(llvm::raw_ostream &OS,<br class="gmail_msg">
const llvm::DWARFYAML::Data &DI);<br class="gmail_msg">
<br class="gmail_msg">
+void yaml2debug_aranges(llvm::raw_ostream &OS, const llvm::DWARFYAML::Data &DI);<br class="gmail_msg">
+<br class="gmail_msg">
#endif<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
llvm-commits mailing list<br class="gmail_msg">
<a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="gmail_msg">
</blockquote></div></div>