<div dir="ltr">Could you re-build lldb with <a href="http://reviews.llvm.org/D15172">http://reviews.llvm.org/D15172</a> and try to hit a breakpoint in jit code?<div><br></div><div>I'm using following setup to compile and run JIT code:</div><div>./build_release/bin/clang -c -O0 -g -emit-llvm ./jit_test.cpp<div>./build_release/bin/lli -debugger-tune=lldb -jit-kind=mcjit ~/projects/lldb/test/jit_test.bc</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 30, 2015 at 3:47 AM, Tamas Berghammer via lldb-dev <span dir="ltr"><<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><br><div class="gmail_quote"><span class=""><div dir="ltr">On Mon, Nov 30, 2015 at 10:18 AM haifeng_q <<a href="mailto:haifeng_q@foxmail.com" target="_blank">haifeng_q@foxmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><span>Question 1:<br>On the windows, I use the code implements a function (see debug_target.cpp) of JIT (see debug_target_process.cpp), but when generating debug information, no production .symtab section for information that leads LLDB get JIT debugging information .symtab failure , and then set a breakpoint to fail.</span></div>
<div><span> LLDB command: lldb_result.txt<br> JIT compilation results: debug_target.ll</span></div>
<div><span></span> </div>
<div><span> Question 2:<br> How JIT debugging supported on Linux?</span></div></blockquote><div> </div></span><div>I theory when a new function is JIT-ed then <span style="font-size:13px;line-height:19.5px">__jit_debug_register_code function is called where LLDB have a breakpoint set. When that breakpoint is hit then LLDB reads the JIT-ed elf file based on the information in </span><span style="font-size:13px;line-height:19.5px">__it_debug_descriptor and processes all debug info in it.</span></div><div><span style="font-size:13px;line-height:19.5px"><br></span></div><div><span style="line-height:19.5px">In practice when I last tried JIT debugging with lldb and lli (few weeks ago) it get the notification for the new JIT-ed elf file but it processed only the eh_frame from it even though symtab and full debug info was also provided. Most likely there is some issue around the JIT breakpoint handling or around the elf file parsing code in LLDB what needs some investigation.</span></div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><span></span> </div>
<div>
<div>thanks!<br></div>
<div><br></div>
<div style="FONT-SIZE:12px;FONT-FAMILY:Arial Narrow;PADDING-BOTTOM:2px;PADDING-TOP:2px;PADDING-LEFT:0px;PADDING-RIGHT:0px">------------------ <span>The original message</span> ------------------</div>
<div style="FONT-SIZE:12px;BACKGROUND:#efefef;PADDING-BOTTOM:8px;PADDING-TOP:8px;PADDING-LEFT:8px;PADDING-RIGHT:8px">
<div><b>From:</b> "Zachary Turner";<<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>>;</div>
<div><b>Data:</b> 2015年11月21日 AM 0:10</div>
<div><b>Receive:</b> "Tamas Berghammer"<<a href="mailto:tberghammer@google.com" target="_blank">tberghammer@google.com</a>>; " "<<a href="mailto:haifeng_q@foxmail.com" target="_blank">haifeng_q@foxmail.com</a>>; "lldb-dev"<<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>>; </div>
<div></div>
<div><b>Title:</b> Re: [lldb-dev] reply: lldb debug jit-compiled code with llvm on windows</div></div>
<div><br></div>
<div dir="ltr">Can you also try clang-cl and see if it works?</div><br>
<div class="gmail_quote">
<div dir="ltr">On Fri, Nov 20, 2015 at 3:02 AM Tamas Berghammer via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>> wrote:<br></div>
<blockquote class="gmail_quote" style="PADDING-LEFT:1ex;BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex">
<div dir="ltr">I don't know how JIT debugging should work on WIndows with MSVC but I don't think LLDB support it in any way. What I wrote should be true on Linux (and on some related) systems. You might be able to get the same results on Windows if you use lli (LLVM based JIT runner) but I have no knowledge if it will work or not.</div><br>
<div class="gmail_quote">
<div dir="ltr">On Fri, Nov 20, 2015 at 8:56 AM haifeng_q <<a href="mailto:haifeng_q@foxmail.com" target="_blank">haifeng_q@foxmail.com</a>> wrote:<br></div>
<blockquote class="gmail_quote" style="PADDING-LEFT:1ex;BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex">
<div>My analysis of the code, the reasons are:</div>
<div> </div>
<div>
<div><span>Since the</span> <span>debugging process</span> <span>is</span> <span>MSVC</span> <span>compiler</span><span>,</span> there is <span>no</span> <span>DWARF</span> <span>debugging information. So</span> <span>lldb</span> <span>get</span> <span>__jit_debug_register_code</span> <span>and</span> <span>__it_debug_descriptor</span> <span>symbol</span> <span>debugging process</span> <span>fails</span><span>,</span> <span>and</span> <span>__jit_debug_register_code</span> <span>not</span> <span>support</span> <span>MSVC.</span><br></div>
<div>I do not know whether correct?</div>
<div><br></div>
<div style="FONT-SIZE:12px;FONT-FAMILY:Arial Narrow;PADDING-BOTTOM:2px;PADDING-TOP:2px;PADDING-LEFT:0px;PADDING-RIGHT:0px">------------------ <span style="BORDER-LEFT-WIDTH:0px;BORDER-RIGHT-WIDTH:0px;WHITE-SPACE:normal;BORDER-BOTTOM-WIDTH:0px;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(67,67,67);OUTLINE-WIDTH:0px;PADDING-BOTTOM:0px;TEXT-ALIGN:left;PADDING-TOP:0px;FONT:12px/24px Tahoma,Arial;OUTLINE-STYLE:none;PADDING-LEFT:0px;MARGIN:0px;LETTER-SPACING:normal;OUTLINE-COLOR:invert;PADDING-RIGHT:0px;BORDER-TOP-WIDTH:0px;BACKGROUND-COLOR:rgb(242,242,242);TEXT-INDENT:0px">original</span><span style="WHITE-SPACE:normal;WORD-SPACING:0px;TEXT-TRANSFORM:none;FLOAT:none;COLOR:rgb(67,67,67);TEXT-ALIGN:left;FONT:12px/24px Tahoma,Arial;DISPLAY:inline!important;LETTER-SPACING:normal;BACKGROUND-COLOR:rgb(242,242,242);TEXT-INDENT:0px"><span> </span></span><span style="BORDER-LEFT-WIDTH:0px;BORDER-RIGHT-WIDTH:0px;WHITE-SPACE:normal;BORDER-BOTTOM-WIDTH:0px;WORD-SPACING:0px;TEXT-TRANSFORM:none;COLOR:rgb(67,67,67);OUTLINE-WIDTH:0px;PADDING-BOTTOM:0px;TEXT-ALIGN:left;PADDING-TOP:0px;FONT:12px/24px Tahoma,Arial;OUTLINE-STYLE:none;PADDING-LEFT:0px;MARGIN:0px;LETTER-SPACING:normal;OUTLINE-COLOR:invert;PADDING-RIGHT:0px;BORDER-TOP-WIDTH:0px;BACKGROUND-COLOR:rgb(242,242,242);TEXT-INDENT:0px">message</span>------------------</div>
<div style="FONT-SIZE:12px;BACKGROUND:#efefef;PADDING-BOTTOM:8px;PADDING-TOP:8px;PADDING-LEFT:8px;PADDING-RIGHT:8px">
<div><b>From:</b>"Tamas Berghammer";<a href="mailto:tberghammer@google.com" target="_blank">tberghammer@google.com</a>;</div>
<div>Date<strong>:</strong>2015年11月19日 PM 8:37</div>
<div><b>receive:</b> " "<<a href="mailto:haifeng_q@foxmail.com" target="_blank">haifeng_q@foxmail.com</a>>; "lldb-dev"<<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>>; </div>
<div></div>
<div><b>Subject:</b> Re: [lldb-dev] lldb debug jit-compiled code with llvm on windows</div></div>
<div><br></div>
<div dir="ltr">In theory you don't have to do anything special to debug some JIT-ed code as everything should just work (based on the gdb jit interface). In practice I tried it out a few days ago and it wasn't working at all even in the case when the application is launched under LLDB (not with attach). LLDB was understanding the eh_frame for the JIT-ed code but didn't found the debug info for unknown reason. We should investigate it and try to fix it sometime. We (lldb for android developers) plan to do it sometime but if you are interested in it then please feel free to take a look and let us know if you have any question. 
<div><br></div>
<div>Tamas</div></div><br>
<div class="gmail_quote">
<div dir="ltr">On Thu, Nov 19, 2015 at 8:40 AM haifeng_q via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>> wrote:<br></div>
<blockquote class="gmail_quote" style="PADDING-LEFT:1ex;BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex">
<div><span>hi,</span></div>
<div><span>process <span>A</span> </span><span>generate</span> function Func1 code with llvm jit compiler<span>,</span> <span>and</span> <span>calls </span><span>Func1</span><span>. modeled on</span> <span>"Kaleidoscope: Adding Debug Information"</span> <span>add</span> <span>debug information</span><span>. how</span> <span>to use</span> <span>LLDB</span> to attach process <span>A</span> to <span>debug this</span> <span>function</span><span>,</span> <span>add a breakpoint in the function?</span></div>
<div><span></span> </div>
<div><span>thanks!</span></div>_______________________________________________<br>lldb-dev mailing list<br><a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br></blockquote></div>
<div></div></div></blockquote></div>_______________________________________________<br>lldb-dev mailing list<br><a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br></blockquote></div>
<div></div></div></blockquote></div></div></div></div>
<br>_______________________________________________<br>
lldb-dev mailing list<br>
<a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><span style="color:rgb(85,85,85);font-family:sans-serif;line-height:20px;background-color:rgb(255,255,255);border-width:2px 0px 0px;border-style:solid;border-color:rgb(213,15,37);padding-top:2px;margin-top:2px">Oleksiy Vyalov |</span><span style="color:rgb(85,85,85);font-family:sans-serif;line-height:20px;background-color:rgb(255,255,255);border-width:2px 0px 0px;border-style:solid;border-color:rgb(51,105,232);padding-top:2px;margin-top:2px"> Software Engineer |</span><span style="color:rgb(85,85,85);font-family:sans-serif;line-height:20px;background-color:rgb(255,255,255);border-width:2px 0px 0px;border-style:solid;border-color:rgb(0,153,57);padding-top:2px;margin-top:2px"> <a href="mailto:ovyalov@google.com" target="_blank">ovyalov<font color="#1155cc">@google.com</font></a></span></div></div>
</div>