[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
Wed Nov 14 00:08:45 PST 2018


yonghong-song added a comment.

F7545597: clang-crash.tar <https://reviews.llvm.org/F7545597>

@dblaikie I got a standalone reproducible test now.

  -bash-4.4$ pwd
  /home/yhs/work/bcc/clang-crash
  -bash-4.4$ ls
  clang-test.cpp  compile.sh  README  ttest.c  ttest.h
  -bash-4.4$

README has details how to reproduce the issue. Basically, step 1, build a llvm with x86/bpf support; step 2, run "compile.sh"; step 3, run the binary "clang-test" produced in step 2 and you will get IR with missing file content and segfault.

I did not investigate further, but my above patch does not really fix the issue. So the right fix should be a different one. There could be multiple issues with clang remapped files.

It will be great if you or others can help resolve these issues!

    2. $ ./compile.sh
    3. $ ./clang-test
  
  The test will print IR before JITing for BPF backend.
  The IR has something like:
     ...
  !8 = !DIFile(filename: "/virtual/ttest.h", directory: "/tmp", checksumkind: CSK_MD5, checksum: "6a615c0cc48c46cdbe7d9917c635d292", source: "\0A#define BPF_PERF_OUTPUT2(_name) \5C\0Astruct _name##_table_t { \5C\0A  int key; \5C\0A  unsigned leaf; \5C\0A  int (*perf_submit) (void *, void *, unsigned); \5C\0A  int (*perf_submit_skb) (void *, unsigned, void *, unsigned); \5C\0A  unsigned max_entries; \5C\0A}; \5C\0A__attribute__((section(\22maps/perf_output\22))) \5C\0Astruct _name##_table_t _name = { .max_entries = 0 }\0A\0Aint g;\0A")
  !9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  !10 = !DIFile(filename: "/virtual/ttest.c", directory: "/tmp")
  !11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "probe_table_t", file: !10, line: 3, size: 256, elements: !12)
     ...
  Segmentation fault (core dumped)

Note that the "!10" DIFile does not have source code.


Repository:
  rC Clang

https://reviews.llvm.org/D53329





More information about the cfe-commits mailing list