# HG changeset patch # User minqi # Date 1415393289 28800 # Node ID 643d6baecfe1c2b1ca5d1aef9177e8a36e1dc597 # Parent d44a81242b1e653f4cf41b886b9a0929615132ab 8062247: [TESTBUG] Allow WhiteBox test to access JVM offsets Reviewed-by: coleenp, iklam, mseledtsov Contributed-by: yumin.qi@oracle.com diff -r d44a81242b1e -r 643d6baecfe1 test/testlibrary/whitebox/sun/hotspot/WhiteBox.java --- a/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Wed Nov 12 10:34:08 2014 +0000 +++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Fri Nov 07 12:48:09 2014 -0800 @@ -208,4 +208,13 @@ .findAny() .orElse(null); } + public native int getOffsetForName0(String name); + public int getOffsetForName(String name) throws Exception { + int offset = getOffsetForName0(name); + if (offset == -1) { + throw new RuntimeException(name + " not found"); + } + return offset; + } + }