<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">So one idea is to improve the PlatformAndroid to use "adb" to copy all system libraries over and pre-cache all system libraries instead of letting it happen one by one.<div class=""><br class=""></div><div class="">Android is also very inefficient in loading shared libraries. It will load them one by one and each one involves 2 stops since the breakpoint we set gets hit once before the library is loaded and once again when it has been loaded. Each stop for shared libraries takes a few hundred milliseconds.</div><div class=""><br class=""></div><div class="">So it might be nice to have the PlatformAndroid grab all system libraries and populate the cache for a device in one large command and see if that improves things. To test this you can just download all system libraries to a single directory manually and then do set some settings:</div><div class=""><br class=""></div><div class="">(lldb) settings set target.exec-search-paths /path/to/cache</div><div class="">(lldb) settings set target.debug-file-search-paths /path/to/cache</div><div class=""><br class=""></div><div class="">So time the "adb" command that wildcard copies all libraries over, then set the settings, then run your debug sessions and see how much this helps. That will give you a good idea of sequentially grabbing each library is the cost.</div><div class=""><br class=""></div><div class="">If the cost is in parsing these libraries, we can look at parallelizing the loading of all the device shared libraries first (prior to debugging) and then launching when everything is pre-loaded.</div><div class=""><br class=""></div><div class="">Greg</div><div class=""><br class=""></div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On May 8, 2020, at 9:07 AM, Emre Kultursay via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-size:small">Hi lldb-dev,</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small"><b class="">TL;DR: </b>Has there been any efforts to introduce something like "Just My Code" debugging on LLDB? Debugging on Android would really benefit from this.</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small"><b class="">Details:</b></div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">Native Android apps typically have a single .so file from the user, but load ~150 system libraries. </div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">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. </div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">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.</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">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. <br class=""></div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small"><b class="">Prototype and Experiments</b></div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">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" .<br class=""></div><div class="gmail_default" style=""><ul style="" class=""><li style="font-size:small" class="">For warm LLDB cache:</li><ul style="font-size:small" class=""><li class="">Without just-my-code: 23 seconds</li><li class="">With just-my-code: 14 seconds</li></ul><li style="" class="">For cold LLDB cache:</li><ul class=""><li style="" class="">Without just-my-code: 120 seconds</li><li style="" class="">With just-my-code: 16 seconds</li></ul></ul><div class=""><br class=""></div><div class="">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.<br class=""></div><div class=""><br class=""></div><div class="">Thanks.</div><div class="">-Emre</div><div class=""><br class=""></div><div class=""><br class=""></div></div><div class="gmail_default" style="font-size:small"> </div><div class="gmail_default" style="font-size:small"></div></div>
_______________________________________________<br class="">lldb-dev mailing list<br class=""><a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev<br class=""></div></blockquote></div><br class=""></div></body></html>