Fixed
Status Update
Comments
vi...@google.com <vi...@google.com> #2
Can you please help share the host operating system details? Thank you very much!
li...@gmail.com <li...@gmail.com> #3
Host operating system : MacOS 10.14.4
vi...@google.com <vi...@google.com> #4
Thank you for your feedback. Team may reach out for more feedback in reproducing or triaging this issue.
li...@gmail.com <li...@gmail.com> #5
Thank you for tracking this problem. And could you tell me where I can find the class source code named `com.android.tools.ndk.run.lldb.AndroidLLDBDriver` in AOSP? could you give me a link? Thanks again.
ar...@google.com <ar...@google.com> #6
The NDK plugin source code is not on AOSP, because it uses some closed source codes that Google licensed.
em...@google.com <em...@google.com> #7
> Why userStartupCommands can't work when `Attach Debugger to Android Process` but work when run with `Debug 'app'`?
When you select "Run > Attach Debugger to Android Process", the debugger does *not* use the currently selected "Run Configuration". AFAIK, these have been designed to be two independent concepts. For instance, you can create and select some dummy run configuration (e.g., create a 'Remote' with bogus settings) and select it as the "current" Run Configuration, but then selecting 'Attach Debugger to Android Process" will still work. Or, you can delete all of your run configurations, yet still will be able to attach to an existing process.
I think you expect the settings that you applied to your main "app" Run Configuration to automatically be propagated to your implicit "Attach" configuration. This is not the case right now. Unfortunately, Android Studio does not have a way of letting the user create an explicit "Attach to existing Process" configuration and then add LLDB startup commands to it, so automating startup commands with "Attach" cannot be done that way either.
Does running the commands *manually* on the LLDB shell at post-attach time work for you at all? Or do your commands *have to* be executed before LLDB is attached?
When you select "Run > Attach Debugger to Android Process", the debugger does *not* use the currently selected "Run Configuration". AFAIK, these have been designed to be two independent concepts. For instance, you can create and select some dummy run configuration (e.g., create a 'Remote' with bogus settings) and select it as the "current" Run Configuration, but then selecting 'Attach Debugger to Android Process" will still work. Or, you can delete all of your run configurations, yet still will be able to attach to an existing process.
I think you expect the settings that you applied to your main "app" Run Configuration to automatically be propagated to your implicit "Attach" configuration. This is not the case right now. Unfortunately, Android Studio does not have a way of letting the user create an explicit "Attach to existing Process" configuration and then add LLDB startup commands to it, so automating startup commands with "Attach" cannot be done that way either.
Does running the commands *manually* on the LLDB shell at post-attach time work for you at all? Or do your commands *have to* be executed before LLDB is attached?
li...@gmail.com <li...@gmail.com> #8
I need to execute before LLDB is attached. Can you provide a configuration for `Attach Debugger to Android Process`?
em...@google.com <em...@google.com>
em...@google.com <em...@google.com> #9
Starting with Android Studio 4.1 Canary 1, the "Attach to Android Process" dialog will ask whether you want to use the debugger settings from an existing Run Configuration (see attached screenshot).
With this, you will be able to add your LLDB Startup Commands (and other debugger settings) to your existing (or any new) Android App run configuration, and then use it when attaching to an existing Android process.
With this, you will be able to add your LLDB Startup Commands (and other debugger settings) to your existing (or any new) Android App run configuration, and then use it when attaching to an existing Android process.
li...@gmail.com <li...@gmail.com> #10
Thanks very much. I think it will be useful.
Description
Description:
I wan't to add my custom LLDB Startup Commands before lldb attach to process.
Follow the steps:
Android Studio 3.5.2 -> Run/Debug Configuration -> Switch to Debugger Tab -> LLDB Startup Commands -> add my commands like this
settings append target.exec-search-paths "/Users/lizhangqu/software/flutter_dev/engine/src/out/android_debug_unopt"
settings show
But when I run with `Attach Debugger to Android Process` in the toolbar. The command can't execute which expected to execute.
However, When I run with `Debug 'app'` in the toolbar. The command works. Why?
So I do some hack works to debug.
Add some code in `com.android.tools.ndk.run.attach.NativeAttachState.execute(Executor executor, @NotNull ProgramRunner runner)` with javassist to log ` ((NativeAndroidDebuggerState)this.myRunConfig.getAndroidDebuggerContext().getAndroidDebuggerState()).getUserStartupCommands()`. It returns an empty list.
Why userStartupCommands can't work when `Attach Debugger to Android Process` but work when run with `Debug 'app'`?
And Can you tell me where is the android studio plugin's source code named `Android NDK Support` such as the java file `com.android.tools.ndk.run.lldb.AndroidLLDBDriver.java` ? I can't find it in AOSP. Thanks very much.