Path: blob/master/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintStatics.java
41152 views
/*1* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223import java.util.HashMap;24import java.util.List;25import java.util.Map;2627import jdk.test.lib.apps.LingeredApp;28import jtreg.SkippedException;2930/**31* @test32* @bug 819019833* @summary Test clhsdb printstatics command34* @requires vm.hasSA35* @library /test/lib36* @run main/othervm ClhsdbPrintStatics37*/3839public class ClhsdbPrintStatics {4041public static void main(String[] args) throws Exception {42System.out.println("Starting ClhsdbPrintStatics test");4344LingeredApp theApp = null;45try {46ClhsdbLauncher test = new ClhsdbLauncher();47theApp = LingeredApp.startApp();48System.out.println("Started LingeredApp with pid " + theApp.getPid());4950List<String> cmds = List.of(51"printstatics", "printstatics SystemDictionary",52"printstatics Threads", "printstatics Universe",53"printstatics JvmtiExport");5455Map<String, List<String>> expStrMap = new HashMap<>();56expStrMap.put("printstatics", List.of(57"All known static fields",58"Abstract_VM_Version::_vm_major_version",59"ClassLoaderDataGraph::_head",60"JNIHandles::_weak_global_handles", "PerfMemory::_top",61"java_lang_Class::_oop_size_offset"));62expStrMap.put("printstatics Threads", List.of(63"Static fields of Threads",64"_number_of_threads", "_number_of_non_daemon_threads"));65expStrMap.put("printstatics Universe", List.of(66"Static fields of Universe",67"Universe::_collectedHeap"));68expStrMap.put("printstatics JvmtiExport", List.of(69"Static fields of JvmtiExport",70"bool JvmtiExport::_can_access_local_variables",71"bool JvmtiExport::_can_hotswap_or_post_breakpoint",72"bool JvmtiExport::_can_post_on_exceptions"));7374test.run(theApp.getPid(), cmds, expStrMap, null);75} catch (SkippedException se) {76throw se;77} catch (Exception ex) {78throw new RuntimeException("Test ERROR " + ex, ex);79} finally {80LingeredApp.stopApp(theApp);81}82System.out.println("Test PASSED");83}84}858687