“breakpoint command add” does not work in LLDB command line in Android Studio

887 views
Skip to first unread message

Alex Petrenko

unread,
Jul 11, 2016, 12:37:25 PM7/11/16
to android-ndk

As far as I know, lldb supports automatic command execution when breakpoint is hit (similar to gdb's commands).

Manual says it should work like this:


(lldb) breakpoint command add 1.1 
Enter your debugger command(s). Type 'DONE' to end. 
> bt 
> DONE


This one should output backtrace each time when breakpoint 1.1 is hit. I am trying to do the same thing in LLDB console in Android Studio 2.1.2:


(lldb) breakpoint list
...
8: file = '/home/user/src_file.cpp', line = 2683, exact_match = 0, locations = 1, resolved = 1, hit count = 1
  8.1: where = libdroid_shared.so`(anonymous namespace)::onDbgThreadResume() + 20 at src_file.cpp:2683, address = 0x0000007f9cad6740, resolved, hit count = 1 

(lldb) breakpoint command add 8.1
(lldb) breakpoint command add 8.1
(lldb)


As you can see, the debugger does not offer me to enter commands. When I press Enter after breakpoint commmand add line it just outputs empty line, and there's no command line prompt.

I tried both 32 and 64 bit debuggers, with different files, breakpoints and apps, but it does not work. The same thing with gdb's commands works perfectly.

My questions:

  • Is this a known bug in Android Studio or lldb, is there a workaround?
  • Maybe this is just a bug in Android Studio UI? Can I use lldb without Android Studio, just the command line interface? How do I do that?

Dan Albert

unread,
Jul 11, 2016, 2:26:17 PM7/11/16
to android-ndk
File a bug a b.android.com.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/3200882f-eafb-4f28-98f9-8fa44368a9f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alex Petrenko

unread,
Jul 11, 2016, 9:15:21 PM7/11/16
to android-ndk

Alex Petrenko

unread,
Jul 12, 2016, 10:43:53 AM7/12/16
to android-ndk
Still would be very helpful if someone knew how to use LLDB without Android Studio.
I can easily do this with gdb, by using script similar to: http://pastebin.com/u5wWLakj
Is there a way to achieve this with LLDB?

Android Studio uses something more clever than that:

Starting LLDB server: /data/local/tmp/lldb/bin/start_lldb_server.sh /data/local/tmp/lldb unix-abstract /data/local/tmp/lldb/tmp platform-1468328048784.sock "lldb process:gdb-remote packets"
$ adb shell cat /data/local/tmp/lldb-server | sh -c 'cat > /data/local/tmp/lldb/bin/lldb-server && chmod 700 /data/local/tmp/lldb/bin/lldb-server'
$ adb shell cat /data/local/tmp/start_lldb_server.sh | sh -c 'cat > /data/local/tmp/lldb/bin/start_lldb_server.sh && chmod 700 /data/local/tmp/lldb/bin/start_lldb_server.sh'

So far I haven't figured what do I do with these sockets and how to make it work.

weishu tian

unread,
Dec 30, 2016, 9:28:47 AM12/30/16
to android-ndk
I have figured out that it is a bug of Android Studio; And I found the solution of use lldb stand-alone.

My Android Studio version is 2.2.3, the lldb of Android SDK is 2.2. You can find a file named 'lldb-server' in $ANDROID_SDK/lldb/android, then:

1. adb push lldb-sever /data/local/tmp/  (chomd 777 if need)
2. adb shell /data/local/tmp/lldb platform --server --listen unix-abstract:///data/local/tmp/debug.sock
3. run lldb in pc, enter the REPL env of lldb.
4. enter `platform select remote-android` in lldb
5. enter `platform connect unix-abstract-connect:///data/local/tmp/debug.sock
6. enter `process attach -p <pid>

 

在 2016年7月12日星期二 UTC+8下午10:43:53,Alex Petrenko写道:

Volodymyr B

unread,
Jan 5, 2018, 4:09:22 PM1/5/18
to android-ndk
look cool

do you know how to connect with LLDBFrontend?
Reply all
Reply to author
Forward
0 new messages