Skip to content

Commit 395159d

Browse files
author
Roland Mesde
committed
8364106: Include java.runtime.version in thread dump output
Backport-of: 158e59ab9184127089f9693ce256001f64b5945c
1 parent 1430c4c commit 395159d

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

src/hotspot/share/runtime/threads.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1366,10 +1366,24 @@ void Threads::print_on(outputStream* st, bool print_stacks,
13661366
char buf[32];
13671367
st->print_raw_cr(os::local_time_string(buf, sizeof(buf)));
13681368

1369-
st->print_cr("Full thread dump %s (%s %s):",
1369+
st->print_cr("Full thread dump %s (%s %s)",
13701370
VM_Version::vm_name(),
13711371
VM_Version::vm_release(),
13721372
VM_Version::vm_info_string());
1373+
JDK_Version::current().to_string(buf, sizeof(buf));
1374+
const char* runtime_name = JDK_Version::runtime_name() != nullptr ?
1375+
JDK_Version::runtime_name() : "";
1376+
const char* runtime_version = JDK_Version::runtime_version() != nullptr ?
1377+
JDK_Version::runtime_version() : "";
1378+
const char* vendor_version = JDK_Version::runtime_vendor_version() != nullptr ?
1379+
JDK_Version::runtime_vendor_version() : "";
1380+
const char* jdk_debug_level = VM_Version::printable_jdk_debug_level() != nullptr ?
1381+
VM_Version::printable_jdk_debug_level() : "";
1382+
1383+
st->print_cr(" JDK version: %s%s%s (%s) (%sbuild %s)", runtime_name,
1384+
(*vendor_version != '\0') ? " " : "", vendor_version,
1385+
buf, jdk_debug_level, runtime_version);
1386+
13731387
st->cr();
13741388

13751389
#if INCLUDE_SERVICES

test/hotspot/jtreg/serviceability/dcmd/thread/PrintTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 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
@@ -168,6 +168,9 @@ public void run(CommandExecutor executor) {
168168
output.shouldNotMatch(jucLockPattern1);
169169
output.shouldNotMatch(jucLockPattern2);
170170
}
171+
172+
/* Check for presence of version string */
173+
output.shouldContain("JDK version:");
171174
}
172175

173176
@Test

0 commit comments

Comments
 (0)