8253429: Error reporting should report correct state of terminated/aborted threads

Reviewed-by: dholmes, stuefe
This commit is contained in:
Zhengyu Gu 2020-10-01 11:57:21 +00:00
parent 2d9fa9da02
commit dd36d8c64d

@ -935,13 +935,18 @@ void Thread::print_on_error(outputStream* st, char* buf, int buflen) const {
st->print(" \"%s\"", name());
}
st->print(" [stack: " PTR_FORMAT "," PTR_FORMAT "]",
p2i(stack_end()), p2i(stack_base()));
if (osthread()) {
st->print(" [id=%d]", osthread()->thread_id());
OSThread* os_thr = osthread();
if (os_thr != NULL) {
if (os_thr->get_state() != ZOMBIE) {
st->print(" [stack: " PTR_FORMAT "," PTR_FORMAT "]",
p2i(stack_end()), p2i(stack_base()));
st->print(" [id=%d]", osthread()->thread_id());
} else {
st->print(" terminated");
}
} else {
st->print(" unknown state (no osThread)");
}
ThreadsSMRSupport::print_info_on(this, st);
}
@ -1331,6 +1336,7 @@ void NonJavaThread::post_run() {
unregister_thread_stack_with_NMT();
// Ensure thread-local-storage is cleared before termination.
Thread::clear_thread_current();
osthread()->set_state(ZOMBIE);
}
// NamedThread -- non-JavaThread subclasses with multiple