< prev index next >

src/hotspot/share/runtime/os.cpp

Print this page
rev 47287 : Port 09.17.Thread_SMR_logging_update from JDK9 to JDK10
rev 47289 : eosterlund, stefank CR - refactor code into threadSMR.cpp and threadSMR.hpp
rev 47292 : stefank, coleenp CR - refactor most JavaThreadIterator usage to use JavaThreadIteratorWithHandle.


1076                    "in the heap", p2i(addr));
1077       return;
1078     }
1079   }
1080   if (JNIHandles::is_global_handle((jobject) addr)) {
1081     st->print_cr(INTPTR_FORMAT " is a global jni handle", p2i(addr));
1082     return;
1083   }
1084   if (JNIHandles::is_weak_global_handle((jobject) addr)) {
1085     st->print_cr(INTPTR_FORMAT " is a weak global jni handle", p2i(addr));
1086     return;
1087   }
1088 #ifndef PRODUCT
1089   // we don't keep the block list in product mode
1090   if (JNIHandleBlock::any_contains((jobject) addr)) {
1091     st->print_cr(INTPTR_FORMAT " is a local jni handle", p2i(addr));
1092     return;
1093   }
1094 #endif
1095 
1096   {
1097     ThreadsListHandle tlh;
1098     JavaThreadIterator jti(tlh.list());
1099     for (JavaThread *thread = jti.first(); thread != NULL; thread = jti.next()) {
1100       // Check for privilege stack
1101       if (thread->privileged_stack_top() != NULL &&
1102           thread->privileged_stack_top()->contains(addr)) {
1103         st->print_cr(INTPTR_FORMAT " is pointing into the privilege stack "
1104                      "for thread: " INTPTR_FORMAT, p2i(addr), p2i(thread));
1105         if (verbose) thread->print_on(st);
1106         return;
1107       }
1108       // If the addr is a java thread print information about that.
1109       if (addr == (address)thread) {
1110         if (verbose) {
1111           thread->print_on(st);
1112         } else {
1113           st->print_cr(INTPTR_FORMAT " is a thread", p2i(addr));
1114         }
1115         return;
1116       }
1117       // If the addr is in the stack region for this thread then report that
1118       // and print thread info
1119       if (thread->on_local_stack(addr)) {
1120         st->print_cr(INTPTR_FORMAT " is pointing into the stack for thread: "
1121                      INTPTR_FORMAT, p2i(addr), p2i(thread));
1122         if (verbose) thread->print_on(st);
1123         return;
1124       }
1125     }
1126   } // ThreadsListHandle destroyed here.
1127 
1128   // Check if in metaspace and print types that have vptrs (only method now)
1129   if (Metaspace::contains(addr)) {
1130     if (Method::has_method_vptr((const void*)addr)) {
1131       ((Method*)addr)->print_value_on(st);
1132       st->cr();
1133     } else {
1134       // Use addr->print() from the debugger instead (not here)
1135       st->print_cr(INTPTR_FORMAT " is pointing into metadata", p2i(addr));
1136     }
1137     return;
1138   }
1139 
1140   // Try an OS specific find
1141   if (os::find(addr, st)) {
1142     return;
1143   }
1144 
1145   st->print_cr(INTPTR_FORMAT " is an unknown value", p2i(addr));
1146 }




1076                    "in the heap", p2i(addr));
1077       return;
1078     }
1079   }
1080   if (JNIHandles::is_global_handle((jobject) addr)) {
1081     st->print_cr(INTPTR_FORMAT " is a global jni handle", p2i(addr));
1082     return;
1083   }
1084   if (JNIHandles::is_weak_global_handle((jobject) addr)) {
1085     st->print_cr(INTPTR_FORMAT " is a weak global jni handle", p2i(addr));
1086     return;
1087   }
1088 #ifndef PRODUCT
1089   // we don't keep the block list in product mode
1090   if (JNIHandleBlock::any_contains((jobject) addr)) {
1091     st->print_cr(INTPTR_FORMAT " is a local jni handle", p2i(addr));
1092     return;
1093   }
1094 #endif
1095 
1096   for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {



1097     // Check for privilege stack
1098     if (thread->privileged_stack_top() != NULL &&
1099         thread->privileged_stack_top()->contains(addr)) {
1100       st->print_cr(INTPTR_FORMAT " is pointing into the privilege stack "
1101                    "for thread: " INTPTR_FORMAT, p2i(addr), p2i(thread));
1102       if (verbose) thread->print_on(st);
1103       return;
1104     }
1105     // If the addr is a java thread print information about that.
1106     if (addr == (address)thread) {
1107       if (verbose) {
1108         thread->print_on(st);
1109       } else {
1110         st->print_cr(INTPTR_FORMAT " is a thread", p2i(addr));
1111       }
1112       return;
1113     }
1114     // If the addr is in the stack region for this thread then report that
1115     // and print thread info
1116     if (thread->on_local_stack(addr)) {
1117       st->print_cr(INTPTR_FORMAT " is pointing into the stack for thread: "
1118                    INTPTR_FORMAT, p2i(addr), p2i(thread));
1119       if (verbose) thread->print_on(st);
1120       return;
1121     }
1122   }

1123 
1124   // Check if in metaspace and print types that have vptrs (only method now)
1125   if (Metaspace::contains(addr)) {
1126     if (Method::has_method_vptr((const void*)addr)) {
1127       ((Method*)addr)->print_value_on(st);
1128       st->cr();
1129     } else {
1130       // Use addr->print() from the debugger instead (not here)
1131       st->print_cr(INTPTR_FORMAT " is pointing into metadata", p2i(addr));
1132     }
1133     return;
1134   }
1135 
1136   // Try an OS specific find
1137   if (os::find(addr, st)) {
1138     return;
1139   }
1140 
1141   st->print_cr(INTPTR_FORMAT " is an unknown value", p2i(addr));
1142 }


< prev index next >