[PATCH] D53329: Generate DIFile with main program if source is not available

Yonghong Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 20 00:15:11 PDT 2018


yonghong-song added a comment.

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.


Repository:
  rC Clang

https://reviews.llvm.org/D53329





More information about the cfe-commits mailing list