summaryrefslogtreecommitdiff
path: root/third_party/llvm-project/dwarf2yaml.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-01-09 13:39:53 -0800
committerGitHub <noreply@github.com>2020-01-09 13:39:53 -0800
commit98747d97f089354091d115fb300006f3cc506a0c (patch)
tree441a8325cd91f6fe30653f4a0d69258db316b284 /third_party/llvm-project/dwarf2yaml.cpp
parent77329439d6307d292e59986db3a194c3085abbe2 (diff)
downloadbinaryen-98747d97f089354091d115fb300006f3cc506a0c.tar.gz
binaryen-98747d97f089354091d115fb300006f3cc506a0c.tar.bz2
binaryen-98747d97f089354091d115fb300006f3cc506a0c.zip
DWARF support for multiple line tables (#2557)
Multiple tables appear to be emitted when linking files together. This fixes our support for that, which did not update their size properly. This required patching the YAML emitting code from LLVM in order to measure the size and then emit it, as that code is apparently not designed to handle changes in line table contents. Other minor fixes: * Set the flags for our dwarfdump command to emit the same as llvm-dwarfdump does with -v -all. * Add support for a few more opcodes, set_discriminator, set_basic_block, fixed_advance_pc, set_isa. * Handle a compile unit without abbreviations in the YAML code (again, apparently not something this LLVM code was intended to do). * Handle a compile unit with zero entries in the YAML code (ditto). * Properly set the AddressSize - we use the DWARFContext in a different way than LLVM expects, apparently. With this the emscripten test suite passes with -gforce_dwarf without crashing. My overall impression so from the the YAML code is that it probably isn't a long-term solution for us. Perhaps it may end up being scaffolding, that is, we can replace it with our own code eventually that is based on it, and remove most of the LLVM code. Before deciding that we should get everything working first, and this seems like the quickest path there.
Diffstat (limited to 'third_party/llvm-project/dwarf2yaml.cpp')
-rw-r--r--third_party/llvm-project/dwarf2yaml.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/third_party/llvm-project/dwarf2yaml.cpp b/third_party/llvm-project/dwarf2yaml.cpp
index bdaf1e429..7d5f2e048 100644
--- a/third_party/llvm-project/dwarf2yaml.cpp
+++ b/third_party/llvm-project/dwarf2yaml.cpp
@@ -146,7 +146,9 @@ void dumpDebugInfo(DWARFContext &DCtx, DWARFYAML::Data &Y) {
NewUnit.Version = CU->getVersion();
if(NewUnit.Version >= 5)
NewUnit.Type = (dwarf::UnitType)CU->getUnitType();
- NewUnit.AbbrOffset = CU->getAbbreviations()->getOffset();
+ if (auto* Abbreviations = CU->getAbbreviations()) { // XXX BINARYEN
+ NewUnit.AbbrOffset = Abbreviations->getOffset();
+ }
NewUnit.AddrSize = CU->getAddressByteSize();
for (auto DIE : CU->dies()) {
DWARFYAML::Entry NewEntry;