On Mon, 13 May 2024 21:47:32 GMT, Alex Menkov <amen...@openjdk.org> wrote:

> If debugger attaches to the debuggee, detaches and re-attaches again, are the 
> monitors recreated again?
> (with rankedMonitor you added an assert if `DebugRawMonitor::monitor` is not 
> null)

Almost all of the debugMonitorCreate() calls seem to come (indirectly) from 
initialize(), which is only called once.

cmdQueueLock, which is the one monitor we call debugMonitorDestroy() on, is 
called from debugLoop_run(), which is called whenever a debugger connection is 
initiated. This is the only case of creating, destroying, and then recreating. 
I wonder if there is some need for that.

popFrameEventLock and popFrameProceedLock are created lazily when first needed. 
There is a check to make sure they are not recreated if already created. They 
are never destroyed.

That seems to be it. So we pretty much create all monitors upon initialization 
and never recreate those that are created during initialization.

With regard to the assert, this can only be an issue for cmdQueueLock, and 
since  debugMonitorDestroy() is called on it (and that clears the needed 
fields), the assert shouldn't be triggered.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19044#discussion_r1599160098

Reply via email to