Skip to content

Commit 10ae4d0

Browse files
author
duke
committed
Backport c75b1d4bf65d927e18b10ea6de263a331b78e13a
1 parent 8c455fd commit 10ae4d0

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

src/hotspot/share/prims/jvmtiAgentList.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class JvmtiAgentList : AllStatic {
6161
private:
6262
static JvmtiAgent* _list;
6363

64-
static Iterator all();
6564
static void initialize();
6665
static void convert_xrun_agents();
6766

@@ -82,6 +81,7 @@ class JvmtiAgentList : AllStatic {
8281

8382
static JvmtiAgent* lookup(JvmtiEnv* env, void* f_ptr);
8483

84+
static Iterator all();
8585
static Iterator agents() NOT_JVMTI({ Iterator it; return it; });
8686
static Iterator java_agents();
8787
static Iterator native_agents();

src/hotspot/share/runtime/os.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include "oops/oop.inline.hpp"
5050
#include "prims/jvm_misc.hpp"
5151
#include "prims/jvmtiAgent.hpp"
52+
#include "prims/jvmtiAgentList.hpp"
5253
#include "runtime/arguments.hpp"
5354
#include "runtime/atomic.hpp"
5455
#include "runtime/frame.inline.hpp"
@@ -1121,6 +1122,31 @@ void os::print_environment_variables(outputStream* st, const char** env_list) {
11211122
}
11221123
}
11231124

1125+
void os::print_jvmti_agent_info(outputStream* st) {
1126+
#if INCLUDE_JVMTI
1127+
const JvmtiAgentList::Iterator it = JvmtiAgentList::all();
1128+
if (it.has_next()) {
1129+
st->print_cr("JVMTI agents:");
1130+
} else {
1131+
st->print_cr("JVMTI agents: none");
1132+
}
1133+
while (it.has_next()) {
1134+
const JvmtiAgent* agent = it.next();
1135+
if (agent != nullptr) {
1136+
const char* dyninfo = agent->is_dynamic() ? "dynamic " : "";
1137+
const char* instrumentinfo = agent->is_instrument_lib() ? "instrumentlib " : "";
1138+
const char* loadinfo = agent->is_loaded() ? "loaded" : "not loaded";
1139+
const char* initinfo = agent->is_initialized() ? "initialized" : "not initialized";
1140+
const char* optionsinfo = agent->options();
1141+
const char* pathinfo = agent->os_lib_path();
1142+
if (optionsinfo == nullptr) optionsinfo = "none";
1143+
if (pathinfo == nullptr) pathinfo = "none";
1144+
st->print_cr("%s path:%s, %s, %s, %s%soptions:%s", agent->name(), pathinfo, loadinfo, initinfo, dyninfo, instrumentinfo, optionsinfo);
1145+
}
1146+
}
1147+
#endif
1148+
}
1149+
11241150
void os::print_register_info(outputStream* st, const void* context) {
11251151
int continuation = 0;
11261152
print_register_info(st, context, continuation);

src/hotspot/share/runtime/os.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,7 @@ class os: AllStatic {
806806
static void print_summary_info(outputStream* st, char* buf, size_t buflen);
807807
static void print_memory_info(outputStream* st);
808808
static void print_dll_info(outputStream* st);
809+
static void print_jvmti_agent_info(outputStream* st);
809810
static void print_environment_variables(outputStream* st, const char** env_list);
810811
static void print_context(outputStream* st, const void* context);
811812
static void print_tos_pc(outputStream* st, const void* context);

src/hotspot/share/utilities/vmError.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,12 @@ void VMError::report(outputStream* st, bool _verbose) {
12751275
os::print_dll_info(st);
12761276
st->cr();
12771277

1278+
#if INCLUDE_JVMTI
1279+
STEP_IF("printing jvmti agent info", _verbose)
1280+
os::print_jvmti_agent_info(st);
1281+
st->cr();
1282+
#endif
1283+
12781284
STEP_IF("printing native decoder state", _verbose)
12791285
Decoder::print_state_on(st);
12801286
st->cr();
@@ -1453,6 +1459,11 @@ void VMError::print_vm_info(outputStream* st) {
14531459
os::print_dll_info(st);
14541460
st->cr();
14551461

1462+
#if INCLUDE_JVMTI
1463+
os::print_jvmti_agent_info(st);
1464+
st->cr();
1465+
#endif
1466+
14561467
// STEP("printing VM options")
14571468

14581469
// VM options

0 commit comments

Comments
 (0)