<div dir="ltr"><div>Hi Todd,</div><div><br></div><div><br></div>Thanks for the detailed response!<div><br></div><div> We were hoping not to have to continue down the path of merging the Apple 6.x gdb/mi extensions into our <a href="https://github.com/apportable/gdb">7.x gdb fork</a>, but it looks that's the best near-term route.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 4, 2014 at 10:16 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Paul,<div><br></div><div>In the short term, we're working on getting top of tree lldb working with the stock gdbserver.  Steve Pucci is focused on that effort.  There are quite a few holes in the existing lldb support for stock linux gdbservers when they are dealing with shared libraries, and Android native code is all shared libraries (and looks like Linux).  We're hoping to get this working soon and might be one way to go to work with lldb and Android in the shorter term.  Steve is starting with the ARM architecture and then likely will move on to the others.</div>

<div><br></div><div>I'm working on implementing something we're calling lldb-gdbserver (or llgs for short).  It's what we'll roll debugserver into as soon as it's working reasonably well for linux.  The top of tree build only builds it for linux x86_64 right now.  I'll be putting some effort into it over the next few weeks and hope to get it up and running in some basic fashion relatively quickly.  llgs, like debugserver, will implement all of the lldb extensions that increase the throughput of the gdb remote protocol.  This will take longer to get this all going than the part Steve is working on.  To get it working across x86_64, x86, ARM and MIPS Android is likely going to take some time.</div>

<div><br></div><div>That's where lldb sits now with respect to Android.  If you were to use gdb, you could run with that right now.  I think if you go that route, you're likely to use the gdb/mi interface to drive a local gdb talking to the android gdbserver.  You'll end up needing to do something like ndk-gdb, ndk-gdb.py or the like to set up the connection.  If you abstract that, you could start with that, confident that you can get it started now.  You can check out the Eclipse plugins that Android has in AOSP (both the SDK and NDK plugins) to get an idea what looks like.  The GDB part is just built on the CDT plugin.</div>

<div><br></div><div>If we were a little further along, we would have an lldb-platform for android that would run on the host side (rather than the remote side where it typically runs I think).  That would wrap all the adb setup for port forwarding and whatnot needed to set up the debug connection to the device.  But that's a ways off, as I won't bother doing that until we have gdbserver and llgs working.</div>

<div><br></div><div>The one bit that we'll be putting effort into in lldb for Android remotes is having the stack backtraces be able understand transitions between native and java code.  That'll be a big diff vs. current gdb support.  For an IDE environment like XCode or VS, this might be less interesting since theoretically you could meld them with a java jdb connection and gdb in the IDE (see NVidia's VS-based tools, I think they do this).  But being able to do this at the native debugger level is going to be very helpful for several scenarios.</div>

<div><br></div><div>So, I'd probably sum it up as: if you need to move fast and quick, we're not ready yet.  But if you want to know where we're investing long term, lldb is where we're putting energy.  It probably would be worth trying to abstract it to some level if you go with gdb.  With lldb you'll end up have the c++ and python APIs you can use, which can be a nicer way to integrate than text over your alternative.</div>

<div><br></div><div>Hope that helps :-)</div><div><br></div><div>Sincerely,</div><div>Todd Fiala</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 4, 2014 at 6:58 PM, Paul Beusterien <span dir="ltr"><<a href="mailto:paulb@apportable.com" target="_blank">paulb@apportable.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">Any updates on the Android lldb initiative?<div><br></div><div>We're prototyping Apportable Android NDK development in Xcode and investigating whether to integrate lldb or gdb for debugging. Any recommendations?</div>


<div><br></div><div>Thanks,</div><div>Paul Beusterien</div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jan 7, 2014 at 8:49 AM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Jean-Daniel,<div><br></div><div>Currently I've had to switch gears a bit and address some holes in our testing on the Android side so that we can verify that the gdb remote pipe remains functional between the host and device.  This has kept me busy for the last couple weeks + holiday.  Thus I do not have anything to share at the moment.  It's the top item on my list after that.</div>



<div><br></div><div>I'll be sure to have a look at your work when I get there.  Thanks for checking on it!</div><div><br></div><div>Sincerely,</div><div>Todd Fiala</div></div><div class="gmail_extra"><div><div>
<br><br><div class="gmail_quote">
On Tue, Jan 7, 2014 at 8:07 AM, Jean-Daniel Dupas <span dir="ltr"><<a href="mailto:devlists@shadowlab.org" target="_blank">devlists@shadowlab.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word">Hi,<div><br></div><div>I'd like to know if you have made some progress on the new debug server and the native layer implementation and if you can share it.</div><div><br></div><div>On my side, I have a simple NativeProcess plugin and a fully working Mach implementation of the NativeProtocol.</div>



<div>My current implementation passes almost all lldb tests.</div><div><br></div><div>I had to tweak the Native Protocol and some other layer a little to make it works.</div><div>I would be interested to known what issue you encounter while working on the linux implementation, and if my Mach implementation fit in your work.</div>



<div><br></div><div>My work can be found at <a href="https://github.com/Jean-Daniel/lldb/tree/native" target="_blank">https://github.com/Jean-Daniel/lldb/tree/native</a> in the native branch</div><div><br></div><div>Note that as I consider it as an experimentation sandbox, I often rebase the whole patch set to keep the tree clean and don't bother with branch and merge (and obviously breaks the history, but as I'm no only follower until now, this has never been an issue).</div>



<div><br></div><div>Thanks</div><div>Jean-Daniel</div><div><br><div><div>Le 4 déc. 2013 à 19:41, Todd Fiala <<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>> a écrit :</div><div><div>
<br><blockquote type="cite"><div dir="ltr">Great, thanks.<div><br></div><div>Ed, I'll coordinate with you on git sharing as code develops.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Dec 4, 2013 at 10:36 AM, Greg Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes working in trunk should be fine because no one is using this feature yet and it shouldn't affect anyone's current work flows.<br>





<span><font color="#888888"><br>
Greg<br>
</font></span><div><div><br>
On Dec 4, 2013, at 8:56 AM, Todd Fiala <<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>> wrote:<br>
<br>
> Going back through the initial proposal here:<br>
><br>
> <a href="http://www.mail-archive.com/lldb-dev@cs.uiuc.edu/msg02164.html" target="_blank">http://www.mail-archive.com/lldb-dev@cs.uiuc.edu/msg02164.html</a><br>
><br>
> I see the proposal was to do this work in trunk:<br>
><br>
> > Since the new classes can be implemented without impacting the current functionality, we propose doing this work in trunk.  Note that Greg's platform branch was recently merged.<br>
><br>
> Assuming that is still valid, I could just work in trunk it seems.  Sound reasonable?<br>
><br>
> -Todd<br>
><br>
><br>
><br>
> On Wed, Dec 4, 2013 at 8:40 AM, Todd Fiala <<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>> wrote:<br>
> I'm going to start working on getting lldb-gdbserver working under Linux x86_64.<br>
><br>
> What's going to be the right submission workflow for this?  Should I plan on working in a separate branch until I have something working, and then put up a large patch?  I'll be working in git locally.  If we have interim work at check points (but not generally useful yet), does lldb use some kind of svn branching where it might make sense to do checkpoint check-ins?  That would allow sharing progress outside of my local group here.<br>





><br>
> Thanks!<br>
><br>
><br>
> On Thu, Nov 21, 2013 at 10:49 AM, Greg Clayton <<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>> wrote:<br>
> Todd,<br>
><br>
> I went ahead and created a new "lldb-gdbserver" tool in "trunk/tools/lldb-gdbserver" in the repository.<br>
><br>
> I also started the Host layer abstraction (see include/Host/Debug.h) for processes (NativeProcessProtocol) and threads (NativeThreadProtocol).<br>
><br>
> In order to get a lldb-gdbserver up and running, it will be a matter of adding new packet support to the GDBRemoteCommunicationServer class to accept all of the standard GDB remote packets used for debugging. The GDBRemoteCommunicationServer class currently supports the lldb-platform packets, but doesn't implement a lot of the normal GDB remote packets.<br>





><br>
> So the work flow to get this working on linux will be:<br>
> 1 - Implement a linux version NativeProcessProtocol and NativeThreadProtocol by having them used the ProcessMonitor stuff that is down in the linux native debugger plug-in.<br>
> 2 - Implement any needed GDB remote packets in GDBRemoteCommunicationServer and back them by a single instance of NativeProcessProtocol when launching or attaching to a process.<br>
><br>
> If you need any help let me know. I am sure there is stuff missing from NativeProcessProtocol and NativeThreadProtocol, so let me know if you need anything else. Also please ask questions as you go if you need any help.<br>





><br>
> Greg Clayton<br>
><br>
><br>
> On Nov 20, 2013, at 4:15 PM, Todd Fiala <<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>> wrote:<br>
><br>
> > Perfect, thanks!<br>
> ><br>
> > Technically I'll be using whatever the Android NDK gdbserver is - I'll need to track down what (if any) patches are applied to that.<br>
> ><br>
> ><br>
> > On Wed, Nov 20, 2013 at 3:56 PM, Greg Clayton <<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>> wrote:<br>
> > If you are going to use a stock gdbserver binary, you will need to make a target definition python file. We have a few examples checked in:<br>
> ><br>
> > svn cat <a href="http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/x86_64_linux_target_definition.py" target="_blank">http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/x86_64_linux_target_definition.py</a><br>





> > svn cat <a href="http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/x86_64_target_definition.py" target="_blank">http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/x86_64_target_definition.py</a><br>





> ><br>
> > When debugging using GDB, you will first need to see the exact registers that the gdbserver supplies:<br>
> ><br>
> > (gdb) maint print raw-registers<br>
> ><br>
> > Then you will need to make a register definition file based off of that and point lldb to use it:<br>
> ><br>
> > (lldb) settings set plugin.process.gdb-remote.target-definition-file /path/to/trunk/examples/python/x86_64_target_definition.py<br>
> ><br>
> > Then LLDB will be able to debug to a remote gdb server that doesn't support any of the dynamic register definition packets.<br>
> ><br>
> > Greg<br>
> ><br>
> ><br>
> > On Nov 20, 2013, at 2:50 PM, Todd Fiala <<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>> wrote:<br>
> ><br>
> > > Great, thanks Andy.  Right now I'm just at the point of using the stock adb/gdbserver and see what that looks like.  I'll definitely be looking at your patch in a bit here :-)<br>
> > ><br>
> > ><br>
> > > On Wed, Nov 20, 2013 at 2:39 PM, Kaylor, Andrew <<a href="mailto:andrew.kaylor@intel.com" target="_blank">andrew.kaylor@intel.com</a>> wrote:<br>
> > > Take a look at the patch I sent you.  It uses an lldb platform based on ADB to set up the port forwarding and possibly copy files then connects to gdbserver.  The implementation is rough, but the basic idea seemed to work pretty well.  I was using it to copy over and launch a new version of gdbserver because the one that came with the x86 emulator at the time didn’t work.<br>





> > ><br>
> > ><br>
> > ><br>
> > > -Andy<br>
> > ><br>
> > ><br>
> > ><br>
> > > From: <a href="mailto:lldb-dev-bounces@cs.uiuc.edu" target="_blank">lldb-dev-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:lldb-dev-bounces@cs.uiuc.edu" target="_blank">lldb-dev-bounces@cs.uiuc.edu</a>] On Behalf Of Todd Fiala<br>




> > > Sent: Wednesday, November 20, 2013 2:19 PM<br>
> > > To: Greg Clayton<br>
> > > Cc: lldb-dev<br>
> > > Subject: Re: [lldb-dev] LLDB for Android initiative<br>
> > ><br>
> > ><br>
> > ><br>
> > > ><br>
> > > > There is probably some amount of overlap in lldb-platform and what we currently do with adb (Android Debug Bridge).  Eventually I'll need to figure out what makes sense to speed up the compile/deploy/debug/fix cycle.<br>





> > ><br>
> > > You can make a new platform named "remote-andriod" that can talk to adb, and just skip using the "lldb-platform" binary. Anything that is missing in that we need in the lldb_private::Platform class could then be added to adb, and if we are missing anything in the lldb_private::Platform compared to adb we could add to the platform API. How do you communicate with adb? Sockets?<br>





> > ><br>
> > ><br>
> > ><br>
> > > ADB runs on the host/local side, and it knows how to forward ports to devices (typically over USB).  So, we talk to the local ADB port that then forwards communication to the actual device.  I'll need to have a look at the guts of it - it might make sense to only use it as a port forwarder and go with an lldb-platform on the device side and just stick with that.  I'll have a deeper look at that once I get Android gdbserver (or equivalent) working.<br>





> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > > _______________________________________________<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>
> ><br>
><br>
><br>
><br>
<br>
</div></div></blockquote></div><br></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>



</blockquote></div></div></div><span><font color="#888888"><br><div>
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;white-space:normal;font-family:Helvetica;word-spacing:0px"><div>



-- Jean-Daniel</div><div><br></div><div><br></div></span><br>

</div>
<br></font></span></div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span><font color="#888888">-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'">


<tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td>



<td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>



<td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</font></span></div>
<br>_______________________________________________<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></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">

<td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td>

<td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>

<td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</div>
</div></div></blockquote></div><br></div>