<div dir="ltr">Oh, this is great. I can't wait to try it. I'll clean up the upstream LLVM patch and post it. It's not all that big, it's basically adding those calls and updating the appropriate structs in memory (just like ELF does). </div>

<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jan 6, 2014 at 5:11 PM, Andrew MacPherson <span dir="ltr"><<a href="mailto:andrew.macp@gmail.com" target="_blank">andrew.macp@gmail.com</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"><div>I've attached a patch to add support for JITed ELF objects to the work you did in your lldb repo. This was taken almost verbatim from the original patch you posted so all credit goes to you. :) With this patch we now have breakpoints and full stack traces into the code JITed by our KL compiler on Linux, including line numbers and variable info.<br>





<br></div><div>Since it sounds like you're on OSX I'm guessing your upstream LLVM changes included adding the calls to the GDBRegistrar in RuntimeDyldMachO.cpp? It looks like they're only in there for ELF right now. Let me know if there's anything else I might need for OSX and I'll investigate what's happening with the missing line numbers there.<br>




</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 3, 2014 at 11:35 PM, Keno Fischer <span dir="ltr"><<a href="mailto:kfischer@college.harvard.edu" target="_blank">kfischer@college.harvard.edu</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">Everything I've been doing with that was upstream llvm to get the relocations right rather than lldb. <a href="https://github.com/loladiro/lldb/commit/991583df4d052cb7dab692e657c4ced4d01ff384" target="_blank">https://github.com/loladiro/lldb/commit/991583df4d052cb7dab692e657c4ced4d01ff384</a> is up to date (the next commit on master has a few debugging things I was trying out, but that commit is functionally complete). <div>





<br></div><div>Yes, I thought about that solution as well. Seems like the way to go. </div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 2, 2014 at 11:56 AM, Andrew MacPherson <span dir="ltr"><<a href="mailto:andrew.macp@gmail.com" target="_blank">andrew.macp@gmail.com</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"><div><div>Hi Keno,<br><br></div>This all sounds great, can you check in the progress you've made so far with seeing JITed functions in backtraces? I can try to figure out what's happening with the missing line numbers.<br>







<br>Regarding the breakpoints a quick look at Breakpoint.cpp seems to show that this is intentional, there's an explicit check for !IsInternal() inside Breakpoint::ModulesChanged() which I would guess is what applies here. I think we would want these breakpoints to be internal though so that users don't see them and if we make sure that the JITLoader gets an event whenever a new shared library is loaded then we can also add more explicit logging around when the JIT register code function has actually been found and resolved.<br>







<br></div>Thanks!<span><font color="#888888"><br>Andrew<br>
</font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 1, 2014 at 3:39 PM, Keno Fischer <span dir="ltr"><<a href="mailto:kfischer@college.harvard.edu" target="_blank">kfischer@college.harvard.edu</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">I'm currently in holiday mode as well. A couple of things that I didn't get to that need to be resolved (these are pretty general questions on lldb itself, so I'd appreciate input from anybody on this list):<div>









<br></div><div>- I'm using a regular rather than an internal breakpoint, because the latter does not get updated when shared libraries are loaded (Is this intended? Is there a recommended workaround?)</div><div><br></div>









<div>- I'm not seeing the function in backtraces even though I can set breakpoints. Is there anything else that needs to be done/ Do the backtraces use different information that is perhaps not relocated properly? If so, how can I check?</div>









<div><br></div><div>- I'm also not seeing line numbers, etc. Probably related to the second point. </div><span><font color="#888888"><div><br></div><div>- Keno</div></font></span></div><div>

<div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 31, 2013 at 10:16 AM, Andrew MacPherson <span dir="ltr"><<a href="mailto:andrew.macp@gmail.com" target="_blank">andrew.macp@gmail.com</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">This looks great. I'm still in holiday mode but will tackle any outstanding ELF-related work when I'm back on Thursday, feel free to ping me or the list again if you get any further. Thanks for pushing on this!<br>











<div><br>Cheers,<br>Andrew<br></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Dec 29, 2013 at 6:29 PM, Keno Fischer <span dir="ltr"><<a href="mailto:kfischer@college.harvard.edu" target="_blank">kfischer@college.harvard.edu</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">I've gotten pretty far,<div>Code is here: <a href="https://github.com/loladiro/lldb" target="_blank">https://github.com/loladiro/lldb</a></div>











<div>It's interacting correctly with the debug interface and I've got it loading the object file from memory correctly for </div>

<div>MachO/DWARF (working on ELF right now). Currently not much use as it doesn't seem to be looking at the</div><div>debug information that were just added (I can see them via `image dump sections` and I can set breakpoints</div>













<div>correctly though, so that's a plus). For DWARF, there's a few changes for upstream LLVM needed. I'll put them</div><div>up if anybody's interested, otherwise, I'll just keep chugging along and wait until I have more complete patch.</div>











<span><font color="#888888">

<div><br></div><div>- Keno</div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Dec 28, 2013 at 1:07 PM, Andrew MacPherson <span dir="ltr"><<a href="mailto:andrew.macp@gmail.com" target="_blank">andrew.macp@gmail.com</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">Hi Keno,<br><br>I noticed the same thing and agree that the JIT loader doesn't perfectly fit as a DynamicLoader, the suggestion from a couple of years back on the list was to make the Process -> DynamicLoader relationship 1:n but I prefer your suggestion of adding a new plugin type (JITLoader). Right now there would only be one JITLoader type for the GDB interface.<br>















<br>The patch could probably be fixed up as-is as a first step (leaving the JIT loading bits as a growth on the DynamicLoaderPOSIXDYLD) and we could move it out into its own plugin type once that's working. I should have time this coming week to get this working but if you'll also have time then I'm happy to leave it with you.<br>















<br>Cheers,<br>Andrew<br></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Dec 28, 2013 at 9:37 AM, Keno Fischer <span dir="ltr"><<a href="mailto:kfischer@college.harvard.edu" target="_blank">kfischer@college.harvard.edu</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">I've started looking into this and it's actually not that difficult to do (the JIT part at least). I think the most difficult thing is<div>















figuring out where to put the functionality. The way I see it, the JIT interface is almost a DynamicLoader, with the difference</div>

<div>that asking it about things like whether or not loading a dynamic library is safe doesn't make much sense. Another problem</div><div>is that currently there's a 1:1 relationship between Processes and DynamicLoaders. Perhaps a new class of Plugins </div>

















<div>(JITLoader?) could be added with a 1:n relationship to processes. Some of the interface (I'm thinking</div><div> DidLaunch,DidAttach,Get/SetStopWhenImagesChange) could be pulled out into an abstract base class. Does that make </div>

















<div>sense. I'd be happy to implement this once we decide on the design.</div><span><font color="#888888"><div><br></div><div>Keno</div></font></span></div><div><div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Wed, Dec 25, 2013 at 10:30 AM, Andrew MacPherson <span dir="ltr"><<a href="mailto:andrew.macp@gmail.com" target="_blank">andrew.macp@gmail.com</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">Looks great, thanks Keno. I'll look into this next week and keep you posted.<br><br>Cheers,<br>Andrew<br>

















</div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 24, 2013 at 1:19 PM, Keno Fischer <span dir="ltr"><<a href="mailto:kfischer@college.harvard.edu" target="_blank">kfischer@college.harvard.edu</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">I have this (as I said, I haven't tried it). It seems to be a different patch.</div><div>

<div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 24, 2013 at 11:17 AM, Andrew MacPherson <span dir="ltr"><<a href="mailto:andrew.macp@gmail.com" target="_blank">andrew.macp@gmail.com</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"><div>Hi Keno,<br><br>I found this old patch that hooks into the GDB JIT registration mechanism which we were planning to use as a starting point:<br>





















<br><a href="http://lists.cs.uiuc.edu/pipermail/lldb-dev/2010-December/000314.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/lldb-dev/2010-December/000314.html</a><br>

<br></div>If you have anything else we'd love to take a look!<br><br>Cheers,<br>Andrew<br></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Tue, Dec 24, 2013 at 8:34 AM, Keno Fischer <span dir="ltr"><<a href="mailto:kfischer@college.harvard.edu" target="_blank">kfischer@college.harvard.edu</a>></span> wrote:<br>























</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hi Andrew,<div><br></div><div>I'm also one of the Julia core developers and the guy currently working on </div>























<div>debugging support. I was given a patch to add MCJIT debugging support</div><div>to LLDB with the disclaimer that it probably doesn't work. I haven't tried it </div>

<div>yet, so I can't say how close it is, but it's probably at least a starting point. </div><div><br></div><div>I'd be happy to coordinate any efforts. </div><span><font color="#888888"><div><br>

</div><div>- Keno</div></font></span></div>
<br></div></div>_______________________________________________<br>
lldb-dev mailing list<br>
<a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>