Rust source debugging does not work with Android Studio
Categories
(Core :: Graphics: WebRender, defect, P4)
Tracking
()
People
(Reporter: sotaro, Unassigned)
References
(Blocks 1 open bug)
Details
Reporter | ||
Updated•6 years ago
|
Updated•6 years ago
|
Comment 1•6 years ago
|
||
Comment 2•6 years ago
|
||
Comment 3•6 years ago
|
||
Comment 4•6 years ago
|
||
Comment 5•6 years ago
•
|
||
Does comment 4 answer your question? If so, is this something you can look at, or redirect to somebody who can? Getting Rust debugging working on Android in some form would really help with the big mobile push that Mozilla is doing this year.
Comment 6•5 years ago
|
||
Update on this:
Looks like rust debugging works in Android Studio, but is a bit cumbersome.
Currently my workflow is:
- Start Debugger and wait for lldb to break at initial process launch (Only works if you've setup lldb symbol folders in AS and .lldbinit file in home as documented here.
- Lookup symbol of function you want to break in using for example:
> readelf -Ws obj-aarch64-unknown-linux-android/toolkit/library/build/libxul.so | grep pre_update
, using regexp if you need finer grain search - In Android studio add symbol breakpoint in lldb debug console:
b _symbolnamehere
- Continue and breakpoint should hit at beginning of function.
- From there use
run to cursor
for getting to the line you want to break at.
This is a very rough flow and I'm sure there are more tips/tricks. Debugging using this method often takes way more time than debugging C++ code and is very error-prone.
@Eric Rahm: Is this something your team handles?
Comment 7•5 years ago
|
||
(In reply to Kris Taeleman (:kris/kris) from comment #6)
Update on this:
Looks like rust debugging works in Android Studio, but is a bit cumbersome.
Currently my workflow is:
- Start Debugger and wait for lldb to break at initial process launch (Only works if you've setup lldb symbol folders in AS and .lldbinit file in home as documented here.
- Lookup symbol of function you want to break in using for example:
> readelf -Ws obj-aarch64-unknown-linux-android/toolkit/library/build/libxul.so | grep pre_update
, using regexp if you need finer grain search- In Android studio add symbol breakpoint in lldb debug console:
b _symbolnamehere
- Continue and breakpoint should hit at beginning of function.
- From there use
run to cursor
for getting to the line you want to break at.This is a very rough flow and I'm sure there are more tips/tricks. Debugging using this method often takes way more time than debugging C++ code and is very error-prone.
@Eric Rahm: Is this something your team handles?
We might be able to help out with low level problems with rust lldb integration (really this was Tom's area, but he is no longer an active contributor). I'd like to determine if this is an Android Studio UI issue or lower level. How well does using the lldb command line directly work for you?
Also note: rust itself ships some pretty printers that you might want to setup.
Comment 8•5 years ago
|
||
I'm pretty sure this is an Android Studio UI issue. I've seen some forum comments that Jetbrains has rust debugging UI support in CLion, but they have not implemented it in Android Studio (See https://github.com/intellij-rust/intellij-rust/issues/3399).
I'm very new to lldb debugging, so not sure how well it works, I make do, but line breakpoints are probably the biggest gap.
If Android Studio Rust debugging UI is not possible (due to being out of our control), maybe the easier path is to create a gdb debug workflow for android with ./mach that wraps all of the adb commands required to start? That would allow us to easily hook up other visual debuggers like VS Code.
Thanks for the pretty-printer info, I did not know that!
Comment 9•5 years ago
|
||
Okay, so Android Studio is out of our realm, but you could attempt to file a bug for better rust support.
From the command-line I think what you're looking for is mach run --debug
. I'm not 100% sure that still works for Android, but the GeckoView folks might be able to give your more guidance.
Comment 10•5 years ago
|
||
Nothing we can do here.
Description
•