[lldb-dev] Is there a just-my-code like debugging mode for LLDB?

Emre Kultursay via lldb-dev lldb-dev at lists.llvm.org
Fri May 8 09:07:07 PDT 2020

Hi lldb-dev,

*TL;DR: *Has there been any efforts to introduce something like "Just My
Code" debugging on LLDB? Debugging on Android would really benefit from


Native Android apps typically have a single .so file from the user, but
load ~150 system libraries.

When attaching LLDB remotely to an Android app, a significant amount of
time is spent on loading modules for those system libraries, even with a
warm LLDB cache that contains a copy of all these libraries.

With a cold LLDB cache, things are much worse, because LLDB copies all
those libraries from the device back to the host to populate its cache.
While one might think this happens only once for a user, things are a bit
worse for Android. There are just too many libraries to copy, making it
very slow, there are new Android releases every year, and users typically
use multiple devices (e.g., x86, x86_64 emulators, arm32, arm64 devices),
and multiple hosts (work, home, laptop/desktop); thereby suffering from
this issue more than necessary.

If we can eliminate the latency of loading these modules, we can deliver a
much faster debugging startup time. In essence, this can be considered as a
form of Just My Code debugging.

*Prototype and Experiments*

I built a simple prototype that only loads a single user module, and
totally avoids loading ~150 system modules. I ran it on my Windows host
against an Android emulator to measure the end to end latency of "Connect +
Attach + Resume + Hit 1st breakpoint immediately" .

   - For warm LLDB cache:
      - Without just-my-code: 23 seconds
      - With just-my-code: 14 seconds
   - For cold LLDB cache:
      - Without just-my-code: 120 seconds
      - With just-my-code: 16 seconds

I want to solicit some feedback and gather thoughts around this idea. It
would be great if there are any existing alternatives in LLDB to achieve my
goal, but otherwise, I can implement this on LLDB and I'd appreciate it if
anyone has any advice on how to implement such a feature.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20200508/a23184b0/attachment.html>

More information about the lldb-dev mailing list