<div dir="ltr">Hi Todd,<div><br></div><div style>It's great that you are looking at lldb!</div><div><br></div><div style>In general, it looks like many of the things you want to do with lldb right now you can, to some extent. I don't think there are too many people looking at lldb for Linux right now as the Linux buildbots are failing so there may be bugs introduced as time goes on. Also, the only real way to do some remote debugging with Linux today is to use gdbserver. The major feature lldb for Linux (and useful for lldb in general) would benefit from is a "lldbserver" that works for all platforms.</div>
<div><br></div><div>I've also provided some comments inlined below...<br></div><div><br><div class="gmail_extra">Thanks,</div><div class="gmail_extra">Matt<br><br><div class="gmail_quote">On Mon, Nov 18, 2013 at 11:40 PM, Todd Fiala <span dir="ltr"><<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hi all!</span><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">I'm starting up an effort to get LLDB running on Android. I just wanted to reach out, say hi, and give you an outline of how I'm thinking about attacking this effort. I'm looking for feedback, so please fire away if you have any suggestions or comments!</div>
<div style="font-family:arial,sans-serif;font-size:13px"><div><br></div><div> I'm thinking of attacking the effort in stages, looking something like this:</div><div><br></div><div>1. Get LLDB up and running against a local Linux x86 process. </div>
<div><br></div><div> It looks like many aspects of this already work. I've heard there might be some rough edges around core dump support, DWARF 4/5 support, and possibly some optimized debug info support on the clang side, so any work here might touch those areas.</div>
<div><br></div></div><div style="font-family:arial,sans-serif;font-size:13px">I see we have what looks like 2 buildbots dedicated to building lldb in linux scenarios:</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px"><a href="http://lab.llvm.org:8011/builders/lldb-x86_64-debian-clang" target="_blank">http://lab.llvm.org:8011/builders/lldb-x86_64-debian-clang</a></div>
<div style="font-family:arial,sans-serif;font-size:13px">
<a href="http://lab.llvm.org:8011/builders/lldb-x86_64-linux" target="_blank">http://lab.llvm.org:8011/builders/lldb-x86_64-linux</a></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
Android currently builds linux host tools as 32-bit. Both of those buildbots above appear to be 64-bit. I'd love to get the equivalent of an Ubuntu 12.04 LTS x64 buildbot building a 32-bit LLDB executable. How can I go about setting that up? </div>
<div style="font-family:arial,sans-serif;font-size:13px"><div><br></div></div></div></blockquote><div> </div><div style>> You can provide your own buildbot using the instructions here: <a href="http://llvm.org/docs/HowToAddABuilder.html">http://llvm.org/docs/HowToAddABuilder.html</a></div>
<div style><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13px">
<div></div><div>2. Get the LLDB remote solution up and running against a remote Linux x86 process. </div><div><br></div></div><div style="font-family:arial,sans-serif;font-size:13px">
Here we get to the first high-level question mark: do we continue to use gdbserver, use debugserver, or base something on lldb-platform? I haven't dug into this yet. I've heard some thoughts on this topic, such as (a) LLDB has extended the gdb remote protocol and offers some benefits over using gdbserver, (b) debugserver is currently very part-specific and might be a painful way to go in the short term (but I haven't heard comments on the longer-term potential benefits of toughing through that), and (c) lldb-platform is a reasonable starting point and has been used to get some traction bringing up LLDB on other chipsets. Like in (1), I'll want to set up a build bot that builds and runs remote tests in this environment.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Any thoughts on this?</div><div style="font-family:arial,sans-serif;font-size:13px"><div>
<br></div></div></div></blockquote><div style>> You can use gdbserver with lldb today. Though, there are packets lldb supports that gdb doesn't. For instance, lldb figures out the remote server register set through special packets. This works with debugserver (debugserver is mac/ios only) but not with gdbserver. In the gdbserver case, I believe lldb will default to some version of ARM registers for the register set. So, connecting to gdbserver you may need to know the remote registers beforehand and provide that to lldb (more details here <a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=192646">http://llvm.org/viewvc/llvm-project?view=revision&revision=192646</a>). Other then this, my understanding is that lldb works reasonably well with gdbserver. There are other benefits of debugserver over gdbserver today such as better network/packet performance though I haven't seen the numbers myself.</div>
<div style><br></div><div style>There was a proposal made on the mailing list a few months ago with regards to implementing platform-independent remote debugging. That proposal is found here: <a href="http://www.mail-archive.com/lldb-dev@cs.uiuc.edu/msg02164.html">http://www.mail-archive.com/lldb-dev@cs.uiuc.edu/msg02164.html</a>. It's fairly detailed but in essence the idea was that if debug support was added for, say, FreeBSD on ARM (in one place), then both native and remote debugging would work for this platform immediately. So, among other things suggested in the proposal, a new "lldbserver" which supports the current packets debugserver does but is platform independent. Overall, this will require effort and I don't think anyone is working on it. It would be great to have!</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13px">
<div></div><div>3. Get the LLDB remote solution up and running against a remote Linux ARM system.<br></div><div><br></div></div><div style="font-family:arial,sans-serif;font-size:13px">The idea being that it will be easier for me to poke around on the Linux ARM system than it would be to go straight for the Android device or emulator, but gets me working against an ARM system, one step closer to a typical Nexus device. And helps out ARM Linux remote support in the process (if there are any weak spots). I don't know yet what the scope of work here might entail. Similar to (2), I'll want to set up a build bot that builds and runs remote tests in this environment as well.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><div><img></div></div></div></blockquote><div style>> If you have a gdbserver built for Linux ARM this might just work. You'll only be able to poke around on the 'gdb-remote plugin' side of lldb in this case. This plugin is used independent of what gdbserver or debugserver you are connecting to and works well.</div>
<div style> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13px">
<div></div></div><div style="font-family:arial,sans-serif;font-size:13px"><div>4. Getting LLDB remote solution up and running against an Android ARM device.</div>
<div><br></div></div></div></blockquote><div style>> Same as above, the gdbserver that comes with the Android NDK should work (maybe it will even work in the Linux case?).</div><div style> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13px"><div></div><div>5. Either directly implement or make it straightforward for Android vendors to fill in anything necessary to use our remote solution on other Android hardware.</div>
<div><br></div></div></div></blockquote><div>> Only thing I can think of here is supporting new x86_64/ARM/MIPS registers as they come along.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13px"><div></div></div><div style="font-family:arial,sans-serif;font-size:13px"><div>I look forward to working with the LLDB community on this effort! Suggestions or comments are appreciated.<br>
</div><div><br></div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">
<div style="font-family:arial,sans-serif;font-size:13px"><div>Sincerely,</div><div>Todd Fiala</div></div>
</div>
<br>_______________________________________________<br>
lldb-dev mailing list<br>
<a href="mailto:lldb-dev@cs.uiuc.edu">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></div></div>