baldurk / renderdoc

RenderDoc is a stand-alone graphics debugging tool.
https://renderdoc.org
MIT License
8.81k stars 1.32k forks source link

x86-64 bit Android support #1160

Closed gittmi closed 5 years ago

gittmi commented 5 years ago

Description

HI,
I have a query regarding platform support by RenderDoc. Does RenderDoc currently supports x86-64 bit Android platform? Is it possible to capture the trace of a debuggable android application on x86-64 bit platform? I am having this doubt because, Renderdoc seems to use gapid lib interceptor. gapid lib interceptor I think currently has no support for x86-64 bit?

Thanks, Hithendra

Repro steps

Environment

baldurk commented 5 years ago

I don't have any plans to support Android other than the ARM platforms - Android already requires a disproportionate maintenance burden for its use, and that is almost entirely on ARM so any work to support other ABIs is not feasible. If it 'just works' then that's great, and I'm happy if people submit fixes, but it's not something I will work on or officially support.

As you've mentioned I don't think interceptor-lib supports x86-64, though I believe it does support x86 builds which should run on any x86-64 platform.

You might be able to get it working if you disable interceptor-lib and compile without it, the PLT hooking isn't particularly ABI sensitive so it may work. However you might run into the same problems that mean the PLT hooking doesn't always hook correctly or early enough.

gittmi commented 5 years ago

Thanks baldurk. What is PLT hooking?

baldurk commented 5 years ago

PLT hooking is an alternate fallback mode that RenderDoc is built with by default that doesn't use any assembly patching. Instead it looks up tables in the ELF format which store imported function calls from the linker, and any imported functions that point to function I want to intercept are overwritten. That includes dlopen/dlsym so that any dynamic functions are intercepted.

The problem is that on android dlopen can't be reliably hooked because Android's libc is quite flawed/obtusely engineered. So it usually relies on being able to 'refresh' the hooks at some point before any work happens, but that might mean it doesn't refresh in time and misses hooking libraries before the graphics API is initialised.

The short version is that in theory it's more ABI independent, at least as long as handling is implemented for the ELF format on that ABI, which is true for x86, x64, arm32 and arm64 in the code at the moment.

That's still no guarantee that RenderDoc will work on x86/x64 though.

gittmi commented 5 years ago

If we add support in gapid interceptor-library for Android x86-64 bit, Renderdoc will work on Android x86-64 bit platform. Is this understanding correct? Will it require any changes to be done on Renderdoc side?

baldurk commented 5 years ago

Yes in theory if interceptor-lib was changed to support x86-64 then it could be updated on renderdoc's side with minimal change aside from updating the code to use the latest LLVM. I still have no plans to support x86-64 android officially though so I would likely not investigate any bugs found and I wouldn't ship support in any official builds.

HaiPhan2002 commented 2 years ago

Hello @baldurk, I go here to ask the support for x86-64 for Android, and seem you have no plan to support it. In the alternative way, could you please share how to build the android APK for renderdoc, so I can try to make the test with x86-64 arch. If I success with it, I will make a MR for this support. What do you think?

HaiPhan2002 commented 2 years ago

Hello @baldurk, I go here to ask the support for x86-64 for Android, and seem you have no plan to support it. In the alternative way, could you please share how to build the android APK for renderdoc, so I can try to make the test with x86-64 arch. If I success with it, I will make a MR for this support. What do you think?

Found the instruction here, will follow it. https://github.com/baldurk/renderdoc/blob/v1.x/docs/CONTRIBUTING/Dependencies.md#android

baldurk commented 2 years ago

Please do not comment on years-old closed issues.