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

2019-01-30 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song abandoned this revision. yonghong-song added a comment. Abandon this patch as the proposed fix is not correct. I have put relative information in the bug https://bugs.llvm.org/show_bug.cgi?id=40170. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D5332

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

2019-01-28 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment. In D53329#1373799 , @yonghong-song wrote: > @dblaikie As I mentioned in one of my earlier comments, after some analysis, > I think this patch definitely not the right way to fix the problem. We just > cannot default to the main

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

2019-01-28 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @dblaikie As I mentioned in one of my earlier comments, after some analysis, I think this patch definitely not the right way to fix the problem. We just cannot default to the main file if the DIFile source is not available. I have a bug filed for the same issue (

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

2019-01-23 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment. Thanks for filing the bug/reducing a test case - this change should include an automated test case that captures this issue (check for other tests that pass -gembed-source to see how this might be tested, possibly expanding the existing test case case or introducing a

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

2019-01-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @scott.linder Thanks! It would be good if you could give at least an initial, even rough, analysis. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D53329/new/ https://reviews.llvm.org/D53329 ___

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

2019-01-14 Thread Scott Linder via Phabricator via cfe-commits
scott.linder added a comment. In D53329#1356381 , @yonghong-song wrote: > @dblaikie @scott.linder Have you got time to look at this issue? Looks like a > trivial test case will be able to reproduce the problem. I have the simple > example in the previou

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

2019-01-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @dblaikie @scott.linder Have you got time to look at this issue? Looks like a trivial test case will be able to reproduce the problem. I have the simple example in the previous comments. Practically, `-gdwarf-5 -gembed-source` is broken now. Repository: rC Cla

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

2018-12-27 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. I found an easy way to reproduce the issue and also did some preliminary analysis. I have filed a bug https://bugs.llvm.org/show_bug.cgi?id=40170. The reproducible case and my analysis is below: -bash-4.4$ cat ttest2.c #include "ttest.h" BPF_PERF_OUTPUT2(probe);

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

2018-11-30 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. F7630900: clang-crash-x86-2.tar @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 r

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

2018-11-30 Thread Scott Linder via Phabricator via cfe-commits
scott.linder added a comment. The Verifier patch has landed as https://reviews.llvm.org/rL348022 I do not have any more knowledge than the reviewers of the right way to handle providing source for remapped files, but at least compilation will warn and strip debug-info rather than segfault when

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

2018-11-27 Thread Scott Linder via Phabricator via cfe-commits
scott.linder added a comment. See https://reviews.llvm.org/D54953 for the Verifier work. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D53329/new/ https://reviews.llvm.org/D53329 ___ cfe-commits mailing list cfe-commi

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

2018-11-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. Thanks @scott.linder, actually "all or nothing" is what I wanted here. We really want to get the source for these remapped files. Repository: rC Clang https://reviews.llvm.org/D53329 ___ cfe-commits mailing list cf

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

2018-11-16 Thread Scott Linder via Phabricator via cfe-commits
scott.linder added a comment. In https://reviews.llvm.org/D53329#1300435, @dblaikie wrote: > Thanks! > > So I can see where/how this fails now - the LLVM backend seems to require > that if any file has embedded source, they all do. Would you be able to/would > you mind adding a debug info verif

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

2018-11-15 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a subscriber: scott.linder. dblaikie added a comment. Thanks! So I can see where/how this fails now - the LLVM backend seems to require that if any file has embedded source, they all do. Would you be able to/would you mind adding a debug info verifier check for this? That'd help

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

2018-11-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. F7549230: clang-crash-x86.tar Just attached a new test case (clang-crash-x86.tar) which works even if the compiler is compiled with assertion on. JIT now generates x86-64 code instead of BPF code. The error message looks like:

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

2018-11-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. You compiled with the assertion on, which triggered the issue. I should have thought about this. Sorry. For error, clang-test: /usr/local/google/home/blaikie/dev/llvm/src/lib/ExecutionEngine/MCJIT/MCJIT.cpp:204: virtual void llvm::MCJIT::generateCodeForModule(l

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

2018-11-14 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment. Thanks for this - though it looks like the test program hits an assertion failure (for me at least - before it gets to the interesting point. clang-test: /usr/local/google/home/blaikie/dev/llvm/src/lib/ExecutionEngine/MCJIT/MCJIT.cpp:204: virtual void llvm::MCJIT::gen

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

2018-11-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. If I am using regular files instead of remapped files, I did not see the segfault. So is it possible that this is a clang issue? Repository: rC Clang https://reviews.llvm.org/D53329 ___ cfe-commits mailing list cfe

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

2018-11-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. The above segment looks like #0 0x00a1 in ?? () #1 0x01490d63 in clang::SourceManager::~SourceManager() () #2 0x005ad0ee in clang::CompilerInstance::~CompilerInstance() () #3 0x0056ad1b in main () In my example, I did

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

2018-11-14 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. F7545597: clang-crash.tar @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 detai

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

2018-11-06 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. @dblaikie This is not blocking me yet since the main BTF support is not in llvm yet. I will be in a conference next week. I will dig into this issue the week after, to have a smaller test case and try to root cause a little further. Will update here as soon as I g

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

2018-11-06 Thread David Blaikie via Phabricator via cfe-commits
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 > MC

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

2018-10-20 Thread Yonghong Song via Phabricator via cfe-commits
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 m

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

2018-10-19 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment. @aprantl - yeah, not sure I have any big feels about this (nor do I fully understand it) @yonghong-song - could you explain this maybe in a bit more detail. What behavior does this fix provide? (compared to behavior of existing working cases that don't hit this bug, f

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

2018-10-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. In the above `/virtual/main.c` is a memory mapped file. The `invocation0.getPreprocessorOpts().addRemappedFile(...)` adds the mapping for the compilation. Repository: rC Clang https://reviews.llvm.org/D53329 ___ cf

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

2018-10-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. We already have `-main-file-name` in cc1. `clang -cc1 -triple x86_64-unknown-linux-gnu ... -main-file-name main.c ... -o main.bc -x c /virtual/main.c -faddrsig` Is this expected? BTW, we just pass the normal C flags to the driver like vector flags_cstr({"-O0", "

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

2018-10-16 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added a comment. Couldn't you just pass `-main-file-name` to cc1 instead? Repository: rC Clang https://reviews.llvm.org/D53329 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm

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

2018-10-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment. Hi, @vsk @HsiangKai @ABataev I found a bug in clang when trying to use "-g -gdwarf-5 -gembed-source" for bcc MCJIT based clang/llvm compilation. This patch fixed the issue but I am not sure whether this is the correct fix or not. Please help take a look and advise

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

2018-10-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision. yonghong-song added reviewers: vsk, HsiangKai, ABataev. yonghong-song added a project: debug-info. Herald added subscribers: cfe-commits, JDevlieghere, aprantl. A llvm segfault happens when I tried to add "-g -gdwarf-5 -gembed-source" in bcc in order to get sor