[Lldb-commits] [PATCH] D67994: [WIP] Modify lldb-test to print out ASTs from symbol file

Shafik Yaghmour via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 24 15:56:15 PDT 2019

shafik created this revision.
shafik added reviewers: labath, JDevlieghere, xiaobai, aam, amccarth.
Herald added a subscriber: aprantl.
shafik marked an inline comment as done.
shafik added inline comments.

Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3060
+    switch (tag) {
+      case DW_TAG_array_type:
I added this change because currently when end up trying to parse non-types which generates diagnostic like the following:

error: anon.o {0x0000001e}: unhandled type tag 0x0034 (DW_TAG_variable), please file a bug and attach the file at the start of this error message

Currently when invoking `lldb-test symbols -dump-ast` it parses all the debug symbols and calls `print(...)` on the `TranslationUnitDecl`.

While useful the `TranslationUnitDecl::print(...)` method gives us a higher level view then the dump from `ASTDumper` which is what we get when we invoke `dump()` on a  specific AST node.

The main motivation for this change is allow us to verify that the AST nodes we create when we parse DWARF. For example in order to verify we are correctly using `DIFlagExportSymbols` added by D66667 <https://reviews.llvm.org/D66667> we would want to dump a `CXXRecordDecl`:

  CXXRecordDecl 0x7fdc578295f8 <<invalid sloc>> <invalid sloc> struct definition
  |-DefinitionData is_anonymous pass_in_registers aggregate standard_layout trivially_copyable pod trivial literal

and check for the `is_anonymous` flag or the lack thereof.

My current approach is to enumerate the symbols and to obtain specific AST nodes if possible and dump them. It looks in some cases such as `FunctionDecl`s we don't have direct access to it but I don't think that is an major problem at this point.

I did not implement it but we should probably have a way of request a specific type instead of indiscriminately dumping all of them.

This is a work in progress and I am not sure if the following is the best approach and I am open to alternative approaches or modification to the current one.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67994.221594.patch
Type: text/x-patch
Size: 3869 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190924/84e413fc/attachment.bin>

More information about the lldb-commits mailing list