[lldb-dev] LLDB for Android initiative

Todd Fiala tfiala at google.com
Tue Nov 19 08:19:13 PST 2013

Hi Alex,

Thanks for the offer!

If my work is successful, AOSP will end up with an LLDB built from that
work.  I'm planning on working upstream for the real work, and I intend to
keep patches as bite-sized as possible to reduce latency on upstream
approval.  So I think the bulk of the work will be in the top of tree
unless something makes that impractical.  We're trying to improve the
native debugging experience on Android, and this is going to be one of our
investments there.

Regarding the NDK and debugging, there was an OTA upgrade issue to Android
4.3 where the Android device's run-as command (/system/bin/run-as) would
lose its setgid/setuid permissions.  This would render gdbserver unable to
attach to the device process, making (as you would guess) remote debugging
impossible.  One of the first things I did when I joined Google was to add
a CTS test to verify run-as works.  This issue was one of the more common
issues I saw.  It gets fixed by doing an over-the-USB cable re-imaging if
you're on a Nexus device, or whatever your vendor requires for system
imaging otherwise.  This should be resolved in 4.4.

Thanks for your interest in this work!

Todd Fiala

On Tue, Nov 19, 2013 at 8:09 AM, Alex Weisberger <
alex.m.weisberger at gmail.com> wrote:

> Hi Todd,
> I work on a sizable cross-platform mobile app that uses the Android NDK
> pretty heavily. I've had very hit or miss experiences debugging with gdb in
> that environment, so I think this is a great idea.
> Have you started a branch for this effort or anything like that? I would
> be very interested in helping improve the NDK debugging experience in any
> way.
> Sincerely,
> -Alex Weisberger
> On Mon, Nov 18, 2013 at 11:40 PM, Todd Fiala <tfiala at google.com> wrote:
>> Hi all!
>> 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!
>>  I'm thinking of attacking the effort in stages, looking something like
>> this:
>> 1. Get LLDB up and running against a local Linux x86 process.
>>  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.
>> I see we have what looks like 2 buildbots dedicated to building lldb in
>> linux scenarios:
>> http://lab.llvm.org:8011/builders/lldb-x86_64-debian-clang
>>  http://lab.llvm.org:8011/builders/lldb-x86_64-linux
>> 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?
>> 2. Get the LLDB remote solution up and running against a remote Linux x86
>> process.
>> 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.
>> Any thoughts on this?
>> 3. Get the LLDB remote solution up and running against a remote Linux ARM
>> system.
>> 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.
>> 4. Getting LLDB remote solution up and running against an Android ARM
>> device.
>> 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.
>> I look forward to working with the LLDB community on this effort!
>>  Suggestions or comments are appreciated.
>> Sincerely,
>> Todd Fiala
>> _______________________________________________
>> lldb-dev mailing list
>> lldb-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Todd Fiala | Software Engineer | tfiala at google.com | 650-397-1352
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20131119/e3226430/attachment.html>

More information about the lldb-dev mailing list