nisargjhaveri / vscode-android-debug

Android Native Debugging support in VS Code
https://marketplace.visualstudio.com/items?itemName=nisargjhaveri.android-debug
MIT License
17 stars 8 forks source link

Missing Debug Symbols? #12

Open drandall-microsoft opened 6 months ago

drandall-microsoft commented 6 months ago

I've been trying to debug a native-activity sample project. As far as I can tell, the debugger attaches, but I can't hit any breakpoints. Here is a copy of my launch configuration

    {
        "name" : "Android Launch",
        "type": "android-debug",
        "request": "launch",
        "target": "last-selected",
        "mode" : "native",
        "apkPath": "${workspaceFolder}/Minimalist/build/outputs/apk/debug/Minimalist-debug.apk",
        "launchActivity": "android.app.NativeActivity",
        "native" : {
            "symbolSearchPaths": [
                "${workspaceFolder}/Minimalist/build/outputs/native-debug-symbols/debug/x86_64/",
            ],
        }

The symbolSearchPath example lists "${workspaceFolder}/app/build/intermediates/cmake/debug/obj/${command:abi}/ but my intermediates folder doesn't contain a cmake folder. My outputs/native-debug-symbols/debug just contains a native-debug-symbols.zip. I tried unzipping that, which provided the ABI folders, and I just hard coded it to x86_64. The only file in that folder is libMinimalist.so.dbg which I don't know if that is supported.

Here is my Debug Console Log

Launching the app activity com.durandal.Minimalist/android.app.NativeActivity
Getting pid for the launched app
Attaching to process 16129 (com.durandal.Minimalist)
Starting Native debugger
Attached to process 16129
Resuming process by attaching Java debugger

And in the LogCat I can see that a debugger has connected

05-03 09:41:58.001 16129 16129 I System.out: Debugger has connected
05-03 09:41:59.413 16129 16129 I System.out: debugger has settled (1452)

Let me know what other information

nisargjhaveri commented 5 months ago

Are you using gcc to compile the native code for the app? This extension currently use lldb debugger, not sure how well it works with debug symbols in other formats.

drandall-microsoft commented 5 months ago

Looks like it's using Clang++ in toolchains/llvm

nisargjhaveri commented 5 months ago

Did a quick search, and seems like lldb should support .so.dbg files as well. Need to debug further on why lldb is not resolving the symbols file.

You can enable lldb logs to see what lldb is doing, in case that can give any hints.

drandall-microsoft commented 5 months ago

Apologies for the slow response. I'm not sure how to enable the lldb logs (I found this(https://github.com/vadimcn/codelldb/wiki/LLDB-Logging), but didn't see an obvious way to add it to the task). I have put up a minimal-ish repo with my setup (and .vs files in the readme) here: https://github.com/dstbstr/HelloAndroid/tree/main