[cfe-dev] dump contents of a module (.pcm) file
Richard Smith via cfe-dev
cfe-dev at lists.llvm.org
Mon Aug 6 14:50:25 PDT 2018
On Mon, 6 Aug 2018 at 14:45, Victor Zverovich via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> How can I dump the contents of a module (.pcm) file in a human-readable
> form for debugging? I'd like to at least see the exported symbols.
>
> Precompiled Header and Modules Internals
> <https://clang.llvm.org/docs/PCHInternals.html> mentions that the
> llvm-objdump utility provides a -raw-clang-ast option but running
>
> llvm-objdump -raw-clang-ast test.pcm
>
> gives the error:
>
> The file was not recognized as a valid object file
>
Sometimes clang AST files are in an ELF wrapper so they can (eg) have
accompanying debug information; llvm-objdump -raw-clang-ast extracts the
clang AST from the wrapper. But you probably don't have ELF-wrapped AST,
just plain AST.
To inspect an AST file, you can use llvm-bcanalyzer (which will give you
summary information) or llvm-bcanalyzer -dump (which will extract the raw
AST records from the file). Neither of those is particularly useful unless
you also have the Clang serialization code to hand so you can figure out
what the various record entries mean. (For instance, there is no list of
exported symbols in an AST file.)
Your best bet for applying semantic queries to an AST file would be to
write a tool against the Clang API or one of its language bindings.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180806/d0af4bfe/attachment.html>
More information about the cfe-dev
mailing list