<div><div dir="auto">Could you give specific pointers to the resources that are relevant to segmentation fault debugging? This kind of bug is the hardest to bebug because the error message has nothing to do with the actual bug.</div><div dir="auto"><br></div><div dir="auto">Generic advices without consideration of specific properties of the problem will surely end up inefficient debugging.</div><div dir="auto"><br></div><div dir="auto">What I added to the .ll file in this case are just function calls to write something to a file without touching any thing else in the original .ll. I can not envision how such changes can cause segmentation faults.</div><div dir="auto"><br></div><div dir="auto">How can even be sure the bug is in the .ll code but not in lli?</div><div dir="auto"><br></div><div dir="auto">Also, in this case, I don’t think running lli through lldb or gdb can be helpful, as it will show information of lli not the bitcode converted from the edited .ll file.</div><br><div class="gmail_quote"><div>On Fri, Jan 25, 2019 at 11:44 PM Chandler Carruth <<a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hey Peng,<div><br></div><div>I'm really excited that you're working with LLVM, but I don't think this list is really the best place to get help with the basics of debugging. I'm afraid you'll need to debug this (and learn how to debug this) kind of failure yourself. There are lots of documents and even some good books about this you can find with a quick search.</div><div><br></div><div> If you get to the point where there is clearly a bug in LLVM upstream, you can file it on our bug tracker of course.</div><div><br></div><div>-Chandler</div><div><br></div></div><br><div class="gmail_quote"></div><div class="gmail_quote"><div class="m_274538086052231703gmail_attr">On Fri, Jan 25, 2019 at 6:50 PM Peng Yu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I edited a working .ll file and llvm-as it to a .bc file. But it<br>
causes segmentation fault. I don't know how to debug such errors.<br>
Could anybody show me the best way to debug such errors? Thanks.<br>
<br>
$ TRACE_OUTFILE=/tmp/trace.txt lli /tmp/y/bash_trcr.bc --norc<br>
__trace_init<br>
LLVMSymbolizer: error reading file: No such file or directory<br>
#0 0x00007f162b1ee0ea llvm::sys::PrintStackTrace(llvm::raw_ostream&)<br>
(/usr/lib/llvm-6.0/bin/../lib/libLLVM-6.0.so.1+0x81e0ea)<br>
#1 0x00007f162b1ec366 llvm::sys::RunSignalHandlers()<br>
(/usr/lib/llvm-6.0/bin/../lib/libLLVM-6.0.so.1+0x81c366)<br>
#2 0x00007f162b1ec49b (/usr/lib/llvm-6.0/bin/../lib/libLLVM-6.0.so.1+0x81c49b)<br>
#3 0x00007f162a7c3890 __restore_rt<br>
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)<br>
#4 0x00007f162a0923cc _IO_vfprintf<br>
/build/glibc-OTsEL5/glibc-2.27/stdio-common/vfprintf.c:1283:0<br>
#5 0x00007f162a09be54 _IO_fprintf<br>
/build/glibc-OTsEL5/glibc-2.27/stdio-common/fprintf.c:36:0<br>
#6 0x00007f1628ff648e<br>
#7 0x00007f1628e37bc0<br>
#8 0x00007f1628ff63a4<br>
#9 0x00007f1628fc89e5<br>
#10 0x00007f162c3cd79d llvm::MCJIT::runFunction(llvm::Function*,<br>
llvm::ArrayRef<llvm::GenericValue>)<br>
(/usr/lib/llvm-6.0/bin/../lib/libLLVM-6.0.so.1+0x19fd79d)<br>
#11 0x00007f162c3a67f7<br>
llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*,<br>
std::vector<std::__cxx11::basic_string<char, std::char_traits<char>,<br>
std::allocator<char> >,<br>
std::allocator<std::__cxx11::basic_string<char,<br>
std::char_traits<char>, std::allocator<char> > > > const&, char const*<br>
const*) (/usr/lib/llvm-6.0/bin/../lib/libLLVM-6.0.so.1+0x19d67f7)<br>
#12 0x0000563cd2ca472b (lli+0x2772b)<br>
#13 0x00007f162a058b97 __libc_start_main<br>
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0<br>
#14 0x0000563cd2cad34a (lli+0x3034a)<br>
Stack dump:<br>
0.    Program arguments: lli /tmp/y/bash_trcr.bc --norc<br>
Segmentation fault<br>
<br>
-- <br>
Regards,<br>
Peng<br></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Regards,<br>Peng</div>