Discussion:
“breakpoint command add” does not work in LLDB command line in Android Studio
Alex Petrenko
2016-07-11 16:14:16 UTC
Permalink
As far as I know, lldb supports automatic command execution when breakpoint
is hit (similar to gdb's commands).

Manual <http://lldb.llvm.org/tutorial.html> 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?
--
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 android-***@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.
'Dan Albert' via android-ndk
2016-07-11 18:25:43 UTC
Permalink
File a bug a b.android.com.
Post by Alex Petrenko
As far as I know, lldb supports automatic command execution when
breakpoint is hit (similar to gdb's commands).
(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
(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.
- 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?
--
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
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
<https://groups.google.com/d/msgid/android-ndk/3200882f-eafb-4f28-98f9-8fa44368a9f2%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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 android-***@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/CAFVaGhuvBvqRmWOy-dQ2ntWJNxRUaHuD%3DE8ZCNzdSP7e4s1NAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Alex Petrenko
2016-07-12 00:19:22 UTC
Permalink
Done https://code.google.com/p/android/issues/detail?id=215718 :(
Post by 'Dan Albert' via android-ndk
File a bug a b.android.com.
Post by Alex Petrenko
As far as I know, lldb supports automatic command execution when
breakpoint is hit (similar to gdb's commands).
(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
(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.
- 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?
--
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
<javascript:>.
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
<https://groups.google.com/d/msgid/android-ndk/3200882f-eafb-4f28-98f9-8fa44368a9f2%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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 android-***@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/1dc43276-20a4-4bc6-bcc9-aa21c2a68044%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Alex Petrenko
2016-07-12 13:05:40 UTC
Permalink
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.
Post by Alex Petrenko
As far as I know, lldb supports automatic command execution when
breakpoint is hit (similar to gdb's commands).
(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
(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.
- 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?
--
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 android-***@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/1a6b4d27-9581-4fc5-abdd-d391c93030f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
weishu tian
2016-12-30 08:50:32 UTC
Permalink
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写道
Post by Alex Petrenko
Still would be very helpful if someone knew how to use LLDB without
Android Studio.
http://pastebin.com/u5wWLakj
Is there a way to achieve this with LLDB?
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.
Post by Alex Petrenko
As far as I know, lldb supports automatic command execution when
breakpoint is hit (similar to gdb's commands).
(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
(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.
- 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?
--
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 android-***@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/86749029-9724-4bed-bd08-7eeb0792d866%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Volodymyr B
2018-01-05 21:09:22 UTC
Permalink
look cool

do you know how to connect with LLDBFrontend?
Post by weishu tian
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
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写道
Post by Alex Petrenko
Still would be very helpful if someone knew how to use LLDB without
Android Studio.
http://pastebin.com/u5wWLakj
Is there a way to achieve this with LLDB?
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.
Post by Alex Petrenko
As far as I know, lldb supports automatic command execution when
breakpoint is hit (similar to gdb's commands).
(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
(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.
- 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?
--
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 android-***@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/b3de1641-7b18-4711-b23b-0e30dcd4b814%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...