Skip to content

Commit 03f5c33

Browse files
committedJan 31, 2025
8349122: -XX:+AOTClassLinking is not compatible with jdwp
Reviewed-by: jrose, kvn
1 parent 0d30b86 commit 03f5c33

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed
 

‎src/hotspot/share/cds/filemap.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -2524,6 +2524,13 @@ bool FileMapInfo::validate_aot_class_linking() {
25242524
log_error(cds)("CDS archive has aot-linked classes. It cannot be used with -Djava.security.manager=%s.", prop);
25252525
return false;
25262526
}
2527+
2528+
#if INCLUDE_JVMTI
2529+
if (Arguments::has_jdwp_agent()) {
2530+
log_error(cds)("CDS archive has aot-linked classes. It cannot be used with JDWP agent");
2531+
return false;
2532+
}
2533+
#endif
25272534
}
25282535

25292536
return true;

‎src/hotspot/share/runtime/arguments.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ bool Arguments::_ClipInlining = ClipInlining;
102102
size_t Arguments::_default_SharedBaseAddress = SharedBaseAddress;
103103

104104
bool Arguments::_enable_preview = false;
105+
bool Arguments::_has_jdwp_agent = false;
105106

106107
LegacyGCLogging Arguments::_legacyGCLogging = { nullptr, 0 };
107108

@@ -2007,7 +2008,7 @@ jint Arguments::parse_vm_init_args(const JavaVMInitArgs *vm_options_args,
20072008
return JNI_OK;
20082009
}
20092010

2010-
#if !INCLUDE_JVMTI
2011+
#if !INCLUDE_JVMTI || INCLUDE_CDS
20112012
// Checks if name in command-line argument -agent{lib,path}:name[=options]
20122013
// represents a valid JDWP agent. is_path==true denotes that we
20132014
// 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
23052306
"Debugging agents are not supported in this VM\n");
23062307
return JNI_ERR;
23072308
}
2309+
#elif INCLUDE_CDS
2310+
if (valid_jdwp_agent(name, is_absolute_path)) {
2311+
_has_jdwp_agent = true;
2312+
}
23082313
#endif // !INCLUDE_JVMTI
23092314
JvmtiAgentList::add(name, options, is_absolute_path);
23102315
os::free(name);

‎src/hotspot/share/runtime/arguments.hpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -253,6 +253,9 @@ class Arguments : AllStatic {
253253
// preview features
254254
static bool _enable_preview;
255255

256+
// jdwp
257+
static bool _has_jdwp_agent;
258+
256259
// Used to save default settings
257260
static bool _AlwaysCompileLoopMethods;
258261
static bool _UseOnStackReplacement;
@@ -505,6 +508,9 @@ class Arguments : AllStatic {
505508
static void set_enable_preview() { _enable_preview = true; }
506509
static bool enable_preview() { return _enable_preview; }
507510

511+
// jdwp
512+
static bool has_jdwp_agent() { return _has_jdwp_agent; }
513+
508514
// Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid.
509515
static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen);
510516

0 commit comments

Comments
 (0)
Please sign in to comment.