On Wed, 28 Aug 2024 03:42:27 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
> ``` > public boolean isSharingEnabled() { > if (sharingEnabled == null) { > Address address = VM.getVM().getDebugger().lookup(null, > "UseSharedSpaces"); > if (address == null && getOS().equals("win32")) { > // On Win32 symbols are prefixed with the dll name. So look for > // UseSharedSpaces as a symbol in jvm.dll. > address = VM.getVM().getDebugger().lookup(null, > "jvm!UseSharedSpaces"); > } > sharingEnabled = address.getJBooleanAt(0); > } > return sharingEnabled.booleanValue(); > } > ``` > > I'm not sure why this is failing. Based on the existing code and comments, it > seems at some point SA worked without relying on the windbg native symbol > support. Code like isSharingEnabled() probably got added afterwards and was > never tested with it disabled. "UseSharedSpaces" is exported from jvm.dll, but the issue here on Windows SymbolLookup searches for decorated symbols (i.e. "??_7UseSharedSpaces@@6B@") and the symbol is exported undecorated. >From globalDefinition.hpp (note extern "C"): extern "C" { // Make sure UseSharedSpaces is accessible to the serviceability agent. extern JNIEXPORT jboolean UseSharedSpaces; } ------------- PR Comment: https://git.openjdk.org/jdk/pull/20684#issuecomment-2316420789