Path: blob/master/test/hotspot/jtreg/serviceability/sa/ClhsdbAttach.java
41152 views
/*1* Copyright (c) 2017, 2019, 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 819165833* @summary Test clhsdb attach, detach, reattach commands34* @requires vm.hasSA35* @library /test/lib36* @run main/othervm ClhsdbAttach37*/3839public class ClhsdbAttach {4041public static void main(String[] args) throws Exception {42System.out.println("Starting ClhsdbAttach test");4344LingeredApp theApp = null;45try {46ClhsdbLauncher test = new ClhsdbLauncher();47theApp = LingeredApp.startApp();48System.out.println("Started LingeredApp with pid " + theApp.getPid());49String attach = "attach " + theApp.getPid();5051List<String> cmds = List.of(52"where",53attach,54"flags MaxJavaStackTraceDepth",55"detach",56"universe",57"reattach",58"longConstant markWord::locked_value");5960Map<String, List<String>> expStrMap = new HashMap<>();61expStrMap.put("where", List.of(62"Command not valid until attached to a VM"));63expStrMap.put("flags MaxJavaStackTraceDepth", List.of(64"MaxJavaStackTraceDepth = "));65expStrMap.put("universe", List.of(66"Command not valid until attached to a VM"));67expStrMap.put("longConstant markWord::locked_value", List.of(68"longConstant markWord::locked_value"));6970test.run(-1, cmds, expStrMap, null);71} catch (SkippedException se) {72throw se;73} catch (Exception ex) {74throw new RuntimeException("Test ERROR " + ex, ex);75} finally {76LingeredApp.stopApp(theApp);77}78System.out.println("Test PASSED");79}80}818283