8349122: -XX:+AOTClassLinking is not compatible with jdwp

Reviewed-by: jrose, kvn
This commit is contained in:
Ioi Lam 2025-01-31 05:37:38 +00:00
parent 0d30b869d8
commit 03f5c33b53
3 changed files with 20 additions and 2 deletions

View File

@ -2524,6 +2524,13 @@ bool FileMapInfo::validate_aot_class_linking() {
log_error(cds)("CDS archive has aot-linked classes. It cannot be used with -Djava.security.manager=%s.", prop);
return false;
}
#if INCLUDE_JVMTI
if (Arguments::has_jdwp_agent()) {
log_error(cds)("CDS archive has aot-linked classes. It cannot be used with JDWP agent");
return false;
}
#endif
}
return true;

View File

@ -102,6 +102,7 @@ bool Arguments::_ClipInlining = ClipInlining;
size_t Arguments::_default_SharedBaseAddress = SharedBaseAddress;
bool Arguments::_enable_preview = false;
bool Arguments::_has_jdwp_agent = false;
LegacyGCLogging Arguments::_legacyGCLogging = { nullptr, 0 };
@ -2007,7 +2008,7 @@ jint Arguments::parse_vm_init_args(const JavaVMInitArgs *vm_options_args,
return JNI_OK;
}
#if !INCLUDE_JVMTI
#if !INCLUDE_JVMTI || INCLUDE_CDS
// Checks if name in command-line argument -agent{lib,path}:name[=options]
// represents a valid JDWP agent. is_path==true denotes that we
// are dealing with -agentpath (case where name is a path), otherwise with
@ -2305,6 +2306,10 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, JVMFlagOrigin
"Debugging agents are not supported in this VM\n");
return JNI_ERR;
}
#elif INCLUDE_CDS
if (valid_jdwp_agent(name, is_absolute_path)) {
_has_jdwp_agent = true;
}
#endif // !INCLUDE_JVMTI
JvmtiAgentList::add(name, options, is_absolute_path);
os::free(name);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -253,6 +253,9 @@ class Arguments : AllStatic {
// preview features
static bool _enable_preview;
// jdwp
static bool _has_jdwp_agent;
// Used to save default settings
static bool _AlwaysCompileLoopMethods;
static bool _UseOnStackReplacement;
@ -505,6 +508,9 @@ class Arguments : AllStatic {
static void set_enable_preview() { _enable_preview = true; }
static bool enable_preview() { return _enable_preview; }
// jdwp
static bool has_jdwp_agent() { return _has_jdwp_agent; }
// Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid.
static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen);