On Tue, 25 Nov 2025 16:32:11 GMT, Chris Plummer <[email protected]> wrote:
>> src/jdk.jdwp.agent/share/native/libjdwp/eventFilter.c line 1444:
>>
>>> 1442: } else {
>>> 1443: error = threadControl_setEventMode(JVMTI_DISABLE,
>>> EI_VIRTUAL_THREAD_END, thread);
>>> 1444: }
>>
>> Q: Why is the `THREAD_START` event disabled globally (for all threads) but
>> the `THREAD_END` event is disabled for specific thread?
>
> THREAD_START can't have a thread filter. THREAD_END can. "thread" ==
> requestThread(node) == the thread filter if there is one, so when disabling
> THREAD_START it could be an actual thread or it could just be NULL. For
> THREAD_START "thread" should always be NULL, so I suppose I could have just
> asserted that and used "thread" as the argument instead of "NULL".
Actually it appears that JDWP THREAD_START can have a filter but JVMTI
THREAD_START does not allow you to set the thread to enable the events on. That
means when JDWP THREAD_START events are requested and a thread filter is
provided, JVMTI THREAD_START needs to be enabled for all threads. That's
actually how it is working now. I tried adding the assert and it was triggered.
So that means passing "thread" instead of NULL would sometimes end up passing
an actual thread to JVMTI and it would produce a [JVMTI_ERROR_ILLEGAL_ARGUMENT
in that case.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28485#discussion_r2560862724