# HG changeset patch # User minqi # Date 1415393289 28800 # Node ID ff5715ccba0df15a00c81d001058d3b111597433 # Parent d24e9561d2a401ac2a22ebfd311947944fca667a 8062247: [TESTBUG] Allow WhiteBox test to access JVM offsets Reviewed-by: coleenp, iklam, mseledtsov Contributed-by: yumin.qi@oracle.com diff -r d24e9561d2a4 -r ff5715ccba0d hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java --- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Fri Nov 07 13:50:55 2014 +0100 +++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Fri Nov 07 12:48:09 2014 -0800 @@ -207,4 +207,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; + } + }