RFR: 8359472: JVM crashes when attaching a dynamic agent before JVMTI_PHASE_LIVE [v2]
Francesco Andreuzzi
fandreuzzi at openjdk.org
Fri Oct 17 16:13:10 UTC 2025
On Thu, 16 Oct 2025 22:29:55 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
>> test/hotspot/jtreg/serviceability/EarlyDynamicLoad/libEarlyDynamicLoad.c line 38:
>>
>>> 36: static void JNICALL VMStartJcmd(jvmtiEnv* jvmti, JNIEnv* env) {
>>> 37: char cmd[256];
>>> 38: snprintf(cmd, sizeof(cmd), "%s %d JVMTI.agent_load some.jar", getenv("JCMD_PATH"), PID());
>>
>> Wouldn't be easier to have single env variable like ATTACH_CMD `.../bin/jcmd 45678 JVMTI.agent_load some.jar` which is completely set by java? So native code is simplified and there are less dependencies.
>
> Also, I'd suggest to convert native part from C to C++. Some examples in the test base can be found easily. There is already a number of tests with C based native agents. We need to convert them to C++ at some point.
Thanks for the suggestion, I changed the test structure so this is not applicable anymore.
Also, converted the native part to c++: 1af09f8ba080416b94aeb947da3a6be1acf9167d
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27766#discussion_r2440490778
More information about the serviceability-dev
mailing list