diff --git a/lldb/docs/use/remote.rst b/lldb/docs/use/remote.rst --- a/lldb/docs/use/remote.rst +++ b/lldb/docs/use/remote.rst @@ -140,6 +140,10 @@ The client ports are configurable through the environment variables ANDROID_PLATFORM_LOCAL_PORT and ANDROID_PLATFORM_LOCAL_GDB_PORT, respectively. +The "remote-android" platform requires ANDROID_PLATFORM_RUN_AS when target +application install path is not accessible with "adb pull". LLDB will use +"adb shell run-as $ANDROID_PLATFORM_RUN_AS cat path" to get module file. + Launching a locally built process on the remote machine ------------------------------------------------------- diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -204,7 +204,11 @@ AdbClient adb(m_device_id); char cmd[PATH_MAX]; - snprintf(cmd, sizeof(cmd), "cat '%s'", source_file.c_str()); + if (const char *run_as = std::getenv("ANDROID_PLATFORM_RUN_AS")) + snprintf(cmd, sizeof(cmd), "run-as '%s' cat '%s'", run_as, + source_file.c_str()); + else + snprintf(cmd, sizeof(cmd), "cat '%s'", source_file.c_str()); return adb.ShellToFile(cmd, minutes(1), destination); }