From c4363e615c85e7a2361baebb9bb9674bea8377c2 Mon Sep 17 00:00:00 2001 From: Charlie Birks Date: Fri, 4 Oct 2019 12:17:02 +0100 Subject: [PATCH] Fix injecting on Android 9 Names aren't returned in GetLocalVariable and slots don't start at 0. --- renderdoc/android/jdwp.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/renderdoc/android/jdwp.cpp b/renderdoc/android/jdwp.cpp index c639fb838..a3f02f6d4 100644 --- a/renderdoc/android/jdwp.cpp +++ b/renderdoc/android/jdwp.cpp @@ -216,6 +216,15 @@ bool InjectLibraries(const std::string &deviceID, Network::Socket *sock) int32_t slotIdx = conn.GetLocalVariable(vulkanLoaderClass, vulkanLoaderMethod, "librarySearchPath"); + // Android 9 doesn't return names and changed how slots are indexed, try an offset from this + if(slotIdx == -1) + { + slotIdx = conn.GetLocalVariable(vulkanLoaderClass, vulkanLoaderMethod, "this"); + + if(slotIdx != -1) + slotIdx += 4; + } + // as a default, use the 4th slot as it's the 4th argument argument (0 is this), if symbols // weren't available we can't identify the variable by name if(slotIdx == -1)