ndk icon indicating copy to clipboard operation
ndk copied to clipboard

Include root lacks <jvmti.h>

Open serhiihuralniksc opened this issue 4 years ago • 6 comments

Description

Recent platform versions allow user to attach custom JVMTI agents to running debuggable apps. See ART-TI and Debug.attachJvmtiAgent(). At the same time NDK doesn't expose <jvmti.h> header that is needed to build compatible agent DSO. Given this, JVMTI appears to be not accessible for third-party users that want to use NDK to build their own agents (not taking into account a cases where user copies required header from elsewhere, including Android platform headers).

Can we have this header to be provided with NDK or it is not stable enough yet?

Environment Details

Not all of these will be relevant to every bug, but please provide as much information as you can.

  • NDK Version: 21.1.6352462
  • Build system: N/A
  • Host OS: N/A
  • ABI: N/A
  • NDK API level: N/A
  • Device API level: N/A

serhiihuralniksc avatar May 15 '20 20:05 serhiihuralniksc

last time we talked about this internally, there wasn't much interest in supporting it for apps. did you have a specific use case in mind that might help motivate it?

enh-google avatar May 15 '20 21:05 enh-google

@enh-google A couple only:

  • SetJNIFunctionTable may be used to organize deep tracking of JNI references and, in case of table overflow, provide user a reach debugging experience for analyzing where each ref came from (via associated stacktrace) and introspecting every object referenced from bloated table. An overflow itself can be faked by new user-provided JNI functions earlier than real 51200 limit will be hit by JVM.
  • great possibilities for implementing custom profilers that can be enabled-disabled by user-defined rules and are able to trigger app-specific profiling function (basically this is exactly what JVMTI official doc suggests, nothing new). Indeed this can be achieved via annotation-processing based bytecode instrumentation at build time but this is not really productive as it requires you to sprinkle your code with annotations that are unrelated to business logic and, that is even worse, waste a lot of time for continuous app rebuilds. The latter also discourages people from intensive usage of app-specific profiling.

It might be that platform/SDK/NDK provide something similar already, please forgive me my ignorance in this case.

serhiihuralniksc avatar May 15 '20 23:05 serhiihuralniksc

i've passed that on to the ART folks. (we're just the delivery guys :-) )

enh-google avatar May 15 '20 23:05 enh-google

Thanks! Do you maybe have some externally accessible link now or should I maybe fill something at https://partnerissuetracker.corp.google.com ?

serhiihuralniksc avatar May 15 '20 23:05 serhiihuralniksc

oh, yeah, if you have access you're probably better off going that route.

enh-google avatar May 15 '20 23:05 enh-google

Hi, any update on this issue?

KruzrTech avatar Apr 06 '21 05:04 KruzrTech

This got refiled as https://issuetracker.google.com/156720333 (thanks!). Triage SNAFU caused that to get lost for a while. I've unstuck it. Closing this since the other bug is the one assigned to the people that can do something about it (the NDK will pick it up automatically if/when ART adds the header).

DanAlbert avatar Aug 21 '24 20:08 DanAlbert