ART: Add debug code to test 913
To find a flaky environment, dump the stack under error condition.
Bug: 31385354
Test: m test-art-host-run-test-913-heaps
Change-Id: Idfb2248e4ae8eda8bbcc221c5533d97ca737da2c
diff --git a/test/913-heaps/heaps.cc b/test/913-heaps/heaps.cc
index 1de1a69..99bc48e 100644
--- a/test/913-heaps/heaps.cc
+++ b/test/913-heaps/heaps.cc
@@ -18,6 +18,7 @@
#include <stdio.h>
#include <string.h>
+#include <iostream>
#include <vector>
#include "android-base/stringprintf.h"
@@ -29,6 +30,7 @@
#include "native_stack_dump.h"
#include "openjdkjvmti/jvmti.h"
#include "runtime.h"
+#include "scoped_thread_state_change-inl.h"
#include "thread-inl.h"
#include "thread_list.h"
@@ -279,8 +281,14 @@
jlong size,
jint length,
const jvmtiHeapReferenceInfo* reference_info)
+ REQUIRES_SHARED(Locks::mutator_lock_)
: Elem(referrer, referree, size, length) {
memcpy(&info_, reference_info, sizeof(jvmtiHeapReferenceInfo));
+ // Debug stack trace for failure condition. Remove when done.
+ if (info_.stack_local.depth == 3 && info_.stack_local.slot == 13) {
+ DumpNativeStack(std::cerr, GetTid());
+ Thread::Current()->DumpJavaStack(std::cerr, false, false);
+ }
}
protected:
diff --git a/test/913-heaps/run b/test/913-heaps/run
index c6e62ae..dd35526 100755
--- a/test/913-heaps/run
+++ b/test/913-heaps/run
@@ -14,4 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-./default-run "$@" --jvmti
+./default-run "$@" --jvmti -Xcompiler-option -g