7179701: MaxJavaStackTraceDepth of zero is not handled correctly/consistently in the VM

Value of zero means unlimited stack trace.  If you want no stack trace, use -XX:-StackTraceInThrowable

Reviewed-by: dholmes, hseigel
This commit is contained in:
Coleen Phillimore 2018-01-31 11:07:55 -05:00
parent 0a10af4b06
commit 7660d97e2e
5 changed files with 112 additions and 11 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -677,7 +677,7 @@ JvmtiEnvBase::get_owned_monitors(JavaThread *calling_thread, JavaThread* java_th
int depth = 0;
for (javaVFrame *jvf = java_thread->last_java_vframe(&reg_map); jvf != NULL;
jvf = jvf->java_sender()) {
if (depth++ < MaxJavaStackTraceDepth) { // check for stack too deep
if (MaxJavaStackTraceDepth == 0 || depth++ < MaxJavaStackTraceDepth) { // check for stack too deep
// add locked objects for this frame into list
err = get_locked_objects_in_frame(calling_thread, java_thread, jvf, owned_monitors_list, depth-1);
if (err != JVMTI_ERROR_NONE) {