Page MenuHomePhabricator

llvm-dwarfinfo add support to decode DW_OP_convert
ClosedPublic

Authored by markus on Feb 20 2019, 5:28 AM.

Details

Summary

Added llvm-dwarfdump support to decode DW_OP_convert (and eventually other typed DW5 ops) as a preparation before introducing such ops in llvm debug info output (see https://reviews.llvm.org/D56587)

Example output

0x0000013d:     DW_TAG_variable
                  DW_AT_location        (0x000000d3
                     [0x0000000000401197,  0x000000000040119a): DW_OP_breg0 RAX+0, DW_OP_constu 0xff, DW_OP_and, DW_OP_convert (0x00000107) "DW_ATE_signed_8", DW_OP_convert (0x0000010e) "DW_ATE_signed_16", DW_OP_stack_value)
                  DW_AT_name    ("z")
                  DW_AT_decl_file       ("/repo/elavkje/llvm/my-dbg-test/dwarf-sext/linked/dbg-bar.c")
                  DW_AT_decl_line       (3)
                  DW_AT_type    (0x0000014d "short")

0x0000014c:     NULL

Diff Detail

Repository
rL LLVM

Event Timeline

markus created this revision.Feb 20 2019, 5:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 20 2019, 5:28 AM
Herald added a subscriber: jdoerfert. · View Herald Transcript
markus edited the summary of this revision. (Show Details)Feb 20 2019, 5:37 AM

That's awesome!

test/tools/llvm-dwarfdump/X86/debug_expr_convert.s
2 ↗(On Diff #187554)

Can you change this or add a second invocation of RUN: not llvm-dwarfdump -verify %t.o?

markus updated this revision to Diff 187646.Feb 20 2019, 12:15 PM

Added support for rudimentary verify of expressions (basically to check that a BaseTypeRef operand actually points to a DW_TAG_base_type DIE).

markus marked an inline comment as done.Feb 20 2019, 12:16 PM
aprantl accepted this revision.Feb 20 2019, 1:58 PM
aprantl added inline comments.
lib/DebugInfo/DWARF/DWARFExpression.cpp
304 ↗(On Diff #187646)

It would be nice to bubble up a more specific error message.

This revision is now accepted and ready to land.Feb 20 2019, 1:58 PM
This revision was automatically updated to reflect the committed changes.