Amie89
Amie89

Reputation: 21

AOSP lldbclient.py missing?

I'm building AOSP from source and have created a small C++ program that prints some messages to logcat when started. Now I wanted to debug the program according to https://source.android.com/devices/tech/debug/gdb

In the reference you're encouraged to use lldb in favor of gdb and there is also a short section on using vs code as debugger.

However, I cannot find the mentioned script lldbclient anywhere in my source nor in Android Code Search, only gdbclient.py seems to be present.

Q1: Where can I find lldbclient script?

When running the gdbclient.py script the option --setup-forwarding vscode seems to be ignored and gdb is always started.

Q2: If there isn't a lldbclient script, what options do I have to pass to gdbclient.py to enable debugging with lldb and vs code?

What did I do so far?

gdbclient.py -r /data/mysample_bin --setup-forwarding vscode

Starts my native program with attached gdb and allows me to step through my program.

Though I do not know how to code python, I was able to track down a call sequence in the script to method generate_setup_script, which is called with parameter debugger=gdb. Therefore no lldb configuration for vs code is created. Passing --no-gdb or --lldb to the script doesn't change this behavior.

Upvotes: 1

Views: 1051

Answers (2)

Colin Snell
Colin Snell

Reputation: 1

You need check the version of AOSP.

gdbclient.py -r /data/mysample_bin --setup-forwarding vscode

I have tried it and it works fine on Android 11, but it prompts me on Android 9.

gdbclient.py -p 476 --setup-forwarding vscode
usage: gdbclient.py [-h] [--adb ADB_PATH] [-a | -d | -e | -s SERIAL]
                    (-p PID | -n NAME | -r ...) [--port [PORT]]
                    [--user [USER]]
gdbclient.py: error: unrecognized arguments: --setup-forwarding vscode

The specific content is development/scripts/gdbclient.py.

Upvotes: 0

Ricky Nguyen Anh Giau
Ricky Nguyen Anh Giau

Reputation: 87

Q1: You can find lldbclient.py script in the repository https://android.googlesource.com/platform/development, branch android-s-beta-2 (or another android-s branch).
Q2: Android also provides some tutorial debugging with Vscode: https://source.android.com/devices/tech/debug/gdb#vscode.

Upvotes: 0

Related Questions