mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
7034585: Adjust fillInStackTrace filtering to assist 6998871
Allow for one or more fillInStackTrace frames to be skipped Reviewed-by: mchung, kvn
This commit is contained in:
parent
2ea041a2b2
commit
09c93cbb25
2 changed files with 26 additions and 16 deletions
|
@ -1453,23 +1453,32 @@ void java_lang_Throwable::fill_in_stack_trace(Handle throwable, TRAPS) {
|
||||||
st_method = st.method();
|
st_method = st.method();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// the format of the stacktrace will be:
|
||||||
|
// - 1 or more fillInStackTrace frames for the exception class (skipped)
|
||||||
|
// - 0 or more <init> methods for the exception class (skipped)
|
||||||
|
// - rest of the stack
|
||||||
|
|
||||||
if (!skip_fillInStackTrace_check) {
|
if (!skip_fillInStackTrace_check) {
|
||||||
// check "fillInStackTrace" only once, so we negate the flag
|
if ((method->name() == vmSymbols::fillInStackTrace_name() ||
|
||||||
// after the first time check.
|
method->name() == vmSymbols::fillInStackTrace0_name()) &&
|
||||||
skip_fillInStackTrace_check = true;
|
throwable->is_a(method->method_holder())) {
|
||||||
if (method->name() == vmSymbols::fillInStackTrace_name()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
skip_fillInStackTrace_check = true; // gone past them all
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// skip <init> methods of the exceptions klass. If there is <init> methods
|
|
||||||
// that belongs to a superclass of the exception we are going to skipping
|
|
||||||
// them in stack trace. This is simlar to classic VM.
|
|
||||||
if (!skip_throwableInit_check) {
|
if (!skip_throwableInit_check) {
|
||||||
|
assert(skip_fillInStackTrace_check, "logic error in backtrace filtering");
|
||||||
|
|
||||||
|
// skip <init> methods of the exception class and superclasses
|
||||||
|
// This is simlar to classic VM.
|
||||||
if (method->name() == vmSymbols::object_initializer_name() &&
|
if (method->name() == vmSymbols::object_initializer_name() &&
|
||||||
throwable->is_a(method->method_holder())) {
|
throwable->is_a(method->method_holder())) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
// if no "Throwable.init()" method found, we stop checking it next time.
|
// there are none or we've seen them all - either way stop checking
|
||||||
skip_throwableInit_check = true;
|
skip_throwableInit_check = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,6 +330,7 @@
|
||||||
template(dispatch_name, "dispatch") \
|
template(dispatch_name, "dispatch") \
|
||||||
template(getSystemClassLoader_name, "getSystemClassLoader") \
|
template(getSystemClassLoader_name, "getSystemClassLoader") \
|
||||||
template(fillInStackTrace_name, "fillInStackTrace") \
|
template(fillInStackTrace_name, "fillInStackTrace") \
|
||||||
|
template(fillInStackTrace0_name, "fillInStackTrace0") \
|
||||||
template(getCause_name, "getCause") \
|
template(getCause_name, "getCause") \
|
||||||
template(initCause_name, "initCause") \
|
template(initCause_name, "initCause") \
|
||||||
template(setProperty_name, "setProperty") \
|
template(setProperty_name, "setProperty") \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue