[PATCH] D53329: Generate DIFile with main program if source is not available
David Blaikie via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 6 13:05:43 PST 2018
dblaikie added a comment.
In https://reviews.llvm.org/D53329#1270035, @yonghong-song wrote:
> Sure. Let me provide a little bit more context and what I want to achieve:
> . I have a tool, called bcc (https://github.com/iovisor/bcc) which uses clang CompilerInvocation interface and
> MCJIT to generates BPF code and load into kernel
> . Several files (the main.c and a few others headers) are clang memory mapped.
> . The particular fix here is related to https://reviews.llvm.org/D53261, getting source code into BTF, but
> before that, based on that particular implementation, the source code needs to be in IR.
> What I found is that for the memory mapped /virtual/main.c file, there is one DIFile entry in
> generated IR, the associated 'source' is empty, which actually caused a seg fault later.
> Not that this bug itself does not need https://reviews.llvm.org/D53261.
> So without this fix, bcc tool will seg fault.
> With this fix, bcc tool works properly and all DIFile entry has proper source codes embedded, which
> if coupled with IR->BTF or Dwarf->BTF should generate correct BTF debug info.
Thanks for the explanation/context.
Any chance of a test case? I'm not sure how the current virtual filesystem support is tested & whether it could be extended/used to cover this issue.
More information about the cfe-commits