7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244)

Reviewed-by: kvn
This commit is contained in:
Tom Rodriguez 2011-09-05 17:09:05 -07:00
parent dece7fbfec
commit edb7b9514a
36 changed files with 678 additions and 729 deletions

View file

@ -2859,6 +2859,44 @@ void JavaThread::trace_frames() {
}
}
class PrintAndVerifyOopClosure: public OopClosure {
protected:
template <class T> inline void do_oop_work(T* p) {
oop obj = oopDesc::load_decode_heap_oop(p);
if (obj == NULL) return;
tty->print(INTPTR_FORMAT ": ", p);
if (obj->is_oop_or_null()) {
if (obj->is_objArray()) {
tty->print_cr("valid objArray: " INTPTR_FORMAT, (oopDesc*) obj);
} else {
obj->print();
}
} else {
tty->print_cr("invalid oop: " INTPTR_FORMAT, (oopDesc*) obj);
}
tty->cr();
}
public:
virtual void do_oop(oop* p) { do_oop_work(p); }
virtual void do_oop(narrowOop* p) { do_oop_work(p); }
};
static void oops_print(frame* f, const RegisterMap *map) {
PrintAndVerifyOopClosure print;
f->print_value();
f->oops_do(&print, NULL, (RegisterMap*)map);
}
// Print our all the locations that contain oops and whether they are
// valid or not. This useful when trying to find the oldest frame
// where an oop has gone bad since the frame walk is from youngest to
// oldest.
void JavaThread::trace_oops() {
tty->print_cr("[Trace oops]");
frames_do(oops_print);
}
#ifdef ASSERT
// Print or validate the layout of stack frames