From a74e9cd840e70cf6350b0c0d971a4316e7c3ee9e Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 23 Jan 2020 14:11:15 -0800 Subject: DWARF: Update .debug_loc (#2616) Add support for that section to the YAML layer, and add code to update it. The updating is slightly tricky - unlike .debug_ranges, the size of entries is not fixed. So we can't just skip entries, as the end marker is smaller than a normal entry. Instead, replace now-invalid segments with (1, 1) which is of size 0 and so should be ignored by the debugger (we can't use (0, 0) as that would be an end marker, and (-1, *) is the special base marker). In the future we probably do want to do this in a more sophisticated manner, completely rewriting the indexes into the section as well. For now though this should be enough for when binaryen does not optimize (as we don't move/reorder anything). Note that this doesn't update the location description (like where on the wasm expression stack the value is). Again, that is correct for when binaryen doesn't optimize, but for fully optimized builds we would need to track things (which would be hard!). Also clean up some code that uses "Extra" instead of "Delimiter" that was missed before, and shorten some unnecessarily long names. --- third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h') diff --git a/third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h b/third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h index 943868b36..948418c7b 100644 --- a/third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h +++ b/third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h @@ -77,6 +77,12 @@ struct Range { uint64_t End; uint64_t SectionIndex; // XXX ? }; + +struct Loc { + uint32_t Start; + uint32_t End; + std::vector Location; +}; // XXX BINARYEN --> struct PubEntry { @@ -154,6 +160,7 @@ struct Data { std::vector DebugStrings; std::vector ARanges; std::vector Ranges; // XXX BINARYEN + std::vector Locs; // XXX BINARYEN PubSection PubNames; PubSection PubTypes; @@ -175,6 +182,7 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Abbrev) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::ARangeDescriptor) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::ARange) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Range) // XXX BINARYEN +LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Loc) // XXX BINARYEN LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::PubEntry) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Unit) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::FormValue) @@ -210,6 +218,10 @@ template <> struct MappingTraits { // XXX BINARYEN static void mapping(IO &IO, DWARFYAML::Range &Range); }; +template <> struct MappingTraits { // XXX BINARYEN + static void mapping(IO &IO, DWARFYAML::Loc &Loc); +}; + template <> struct MappingTraits { static void mapping(IO &IO, DWARFYAML::PubEntry &Entry); }; -- cgit v1.2.3