< prev index next >

src/hotspot/share/runtime/os.cpp

Print this page
rev 52037 : 8211852: inspect stack during error reporting
Reviewed-by:


1136   // Compressed klass needs to be decoded first.
1137 #ifdef _LP64
1138   if (UseCompressedClassPointers && ((uintptr_t)addr &~ (uintptr_t)max_juint) == 0) {
1139     narrowKlass narrow_klass = (narrowKlass)(uintptr_t)addr;
1140     Klass* k = Klass::decode_klass_raw(narrow_klass);
1141 
1142     if (Klass::is_valid(k)) {
1143       st->print_cr(UINT32_FORMAT " is a compressed pointer to class: " INTPTR_FORMAT, narrow_klass, p2i((HeapWord*)k));
1144       k->print_on(st);
1145       return;
1146     }
1147   }
1148 #endif
1149 
1150   // Try an OS specific find
1151   if (os::find(addr, st)) {
1152     return;
1153   }
1154 
1155   if (accessible) {
1156     st->print_cr(INTPTR_FORMAT " points into unknown readable memory", p2i(addr));




1157     return;
1158   }
1159 
1160   st->print_cr(INTPTR_FORMAT " is an unknown value", p2i(addr));
1161 }
1162 
1163 // Looks like all platforms can use the same function to check if C
1164 // stack is walkable beyond current frame. The check for fp() is not
1165 // necessary on Sparc, but it's harmless.
1166 bool os::is_first_C_frame(frame* fr) {
1167   // Load up sp, fp, sender sp and sender fp, check for reasonable values.
1168   // Check usp first, because if that's bad the other accessors may fault
1169   // on some architectures.  Ditto ufp second, etc.
1170   uintptr_t fp_align_mask = (uintptr_t)(sizeof(address)-1);
1171   // sp on amd can be 32 bit aligned.
1172   uintptr_t sp_align_mask = (uintptr_t)(sizeof(int)-1);
1173 
1174   uintptr_t usp    = (uintptr_t)fr->sp();
1175   if ((usp & sp_align_mask) != 0) return true;
1176 




1136   // Compressed klass needs to be decoded first.
1137 #ifdef _LP64
1138   if (UseCompressedClassPointers && ((uintptr_t)addr &~ (uintptr_t)max_juint) == 0) {
1139     narrowKlass narrow_klass = (narrowKlass)(uintptr_t)addr;
1140     Klass* k = Klass::decode_klass_raw(narrow_klass);
1141 
1142     if (Klass::is_valid(k)) {
1143       st->print_cr(UINT32_FORMAT " is a compressed pointer to class: " INTPTR_FORMAT, narrow_klass, p2i((HeapWord*)k));
1144       k->print_on(st);
1145       return;
1146     }
1147   }
1148 #endif
1149 
1150   // Try an OS specific find
1151   if (os::find(addr, st)) {
1152     return;
1153   }
1154 
1155   if (accessible) {
1156     st->print(INTPTR_FORMAT " points into unknown readable memory: ", p2i(addr));
1157     int bytenum = (intptr_t)addr & (sizeof(intptr_t) - 1);
1158     if (bytenum != 0) { st->print("(byte %d of) ", bytenum); }
1159     os::print_hex_dump(st, align_down(addr    , sizeof(intptr_t)),
1160                            align_up(  addr + 1, sizeof(intptr_t)), 1);
1161     return;
1162   }
1163 
1164   st->print_cr(INTPTR_FORMAT " is an unknown value", p2i(addr));
1165 }
1166 
1167 // Looks like all platforms can use the same function to check if C
1168 // stack is walkable beyond current frame. The check for fp() is not
1169 // necessary on Sparc, but it's harmless.
1170 bool os::is_first_C_frame(frame* fr) {
1171   // Load up sp, fp, sender sp and sender fp, check for reasonable values.
1172   // Check usp first, because if that's bad the other accessors may fault
1173   // on some architectures.  Ditto ufp second, etc.
1174   uintptr_t fp_align_mask = (uintptr_t)(sizeof(address)-1);
1175   // sp on amd can be 32 bit aligned.
1176   uintptr_t sp_align_mask = (uintptr_t)(sizeof(int)-1);
1177 
1178   uintptr_t usp    = (uintptr_t)fr->sp();
1179   if ((usp & sp_align_mask) != 0) return true;
1180 


< prev index next >