[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
Fri Nov 30 17:39:14 PST 2018


yonghong-song added a comment.

F7630900: clang-crash-x86-2.tar <https://reviews.llvm.org/F7630900>

@scott.linder Actually clang can get source for remapped files. I just uploaded another test tarball which may help you debug the issue.
The test script is changed as well since recent llvm/clang requiring linking with -ltinfo.

Just give you a summary here.

  -bash-4.2$ cat ttest.h
  
  #define BPF_PERF_OUTPUT2(_name) \
  struct _name##_table_t { \
    int key; \
    unsigned leaf; \
    int (*perf_submit) (void *, void *, unsigned); \
    int (*perf_submit_skb) (void *, unsigned, void *, unsigned); \
    unsigned max_entries; \
  }; \
  __attribute__((section("maps/perf_output"))) \
  struct _name##_table_t _name = { .max_entries = 0 }
  
  int g;
  -bash-4.2$ cat ttest1.c
  #include "ttest.h"
  
  int main() { return g; }
  -bash-4.2$ cat ttest2.c
  #include "ttest.h"
  
  BPF_PERF_OUTPUT2(probe);
  
  int main() { return g; }
  -bash-4.2$

The header file ttest.h is remapped.
For remapped file ttest1.c, the clang can get the source properly.
For remapped file ttest2.c, the clang cannot get the source.
The difference between two files are macro usage.

  -bash-4.2$ diff ttest1.c ttest2.c
  2a3,4
  > BPF_PERF_OUTPUT2(probe);
  > 
  -bash-4.2$

So macro existence may somehow prevent availability of remapped file source.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53329/new/

https://reviews.llvm.org/D53329





More information about the cfe-commits mailing list